Fixed #4106 - InputText: size property

pull/4107/head
Tuğçe Küçükoğlu 2023-07-04 12:28:31 +03:00
parent 3d49b11814
commit 019f1607e9
3 changed files with 23 additions and 2 deletions

View File

@ -5,6 +5,12 @@ const InputTextProps = [
default: 'null', default: 'null',
description: 'Value of the component.' description: 'Value of the component.'
}, },
{
name: 'size',
type: 'string',
default: 'null',
description: 'Defines the size of the component, valid values are "small" and "large".'
},
{ {
name: 'pt', name: 'pt',
type: 'any', type: 'any',

View File

@ -2,14 +2,25 @@
import BaseComponent from 'primevue/basecomponent'; import BaseComponent from 'primevue/basecomponent';
const classes = { const classes = {
root: ({ instance }) => ['p-inputtext p-component', { 'p-filled': instance.filled }] root: ({ instance, props }) => [
'p-inputtext p-component',
{
'p-filled': instance.filled,
'p-inputtext-sm': props.size === 'small',
'p-inputtext-lg': props.size === 'large'
}
]
}; };
export default { export default {
name: 'BaseInputText', name: 'BaseInputText',
extends: BaseComponent, extends: BaseComponent,
props: { props: {
modelValue: null modelValue: null,
size: {
type: String,
default: null
}
}, },
css: { css: {
classes classes

View File

@ -38,6 +38,10 @@ export interface InputTextProps extends InputHTMLAttributes {
* Value of the component. * Value of the component.
*/ */
modelValue?: Nullable<string>; modelValue?: Nullable<string>;
/**
* Defines the size of the component.
*/
size?: 'small' | 'large' | undefined;
/** /**
* Uses to pass attributes to DOM elements inside the component. * Uses to pass attributes to DOM elements inside the component.
* @type {InputTextPassThroughOptions} * @type {InputTextPassThroughOptions}