API reference: @salmonui/inputs/text-field
TextFieldcomponent
import { TextField } from '@salmonui/inputs/text-field';function TextField(props: TextFieldProps): ReactNode;
Single-line text input: a native <input> with label,
description, validation, adornments and an optional clear button. ref is
the input; unknown props go to the input, className / style to the root.
Props: TextFieldProps
| Name | Signature | Description |
|---|---|---|
typeoptional | readonly type?: 'text' | 'password' | 'email' | 'tel' | 'url' | 'search' | undefined; | Input type; numbers use |
refoptional | readonly ref?: Ref<HTMLInputElement> | undefined; | The native |
labeloptionalinherited | label?: ReactNode; | |
descriptionoptionalinherited | description?: ReactNode; | |
errorMessageoptionalinherited | errorMessage?: ((ctx: { readonly errors: readonly string[]; }) => ReactNode) | ReactNode; | Error text (or a function of the errors) shown while the field is invalid. |
invalidoptionalinherited | invalid?: boolean; | Forces the error state. |
validationoptionalinherited | validation?: FieldValidation; | Rules in the Data Grid vocabulary. |
validateOnoptionalinherited | validateOn?: ValidateOn; | When errors appear; default the |
sizeoptionalinherited | size?: FieldSize; | Metric set. Default |
valueoptionalinherited | value?: string; | |
defaultValueoptionalinherited | defaultValue?: string; | |
onValueChangeoptionalinherited | onValueChange?: ((value: string, details: TextChangeDetails) => void); | |
clearableoptionalinherited | clearable?: boolean; | Shows a clear button while there is a value; Escape clears too. |
startAdornmentoptionalinherited | startAdornment?: ReactNode; | |
endAdornmentoptionalinherited | endAdornment?: ReactNode; | |
localeTextoptionalinherited | localeText?: TextFieldLocaleText; | |
classNameoptionalinherited | className?: string; | Root class and style (the input gets every other prop). |
styleoptionalinherited | style?: CSSProperties; | |
classNamesoptionalinherited | classNames?: { readonly group?: string; readonly input?: string; readonly label?: string; readonly description?: string; readonly error?: string; }; | Part classes: |