Input
The Input component provides users with a field to enter and edit text.
useInput API
Import
import { useInput } from '@mui/base/useInput';
// or
import { useInput } from '@mui/base';| Name | Type | Default | Description |
|---|---|---|---|
| defaultValue | unknown | The default value. Use when the component is not controlled. | |
| disabled | boolean | If | |
| error | boolean | If | |
| inputRef | React.Ref<HTMLInputElement | HTMLTextAreaElement> | ||
| onBlur | React.FocusEventHandler<HTMLInputElement | HTMLTextAreaElement> | ||
| onChange | React.ChangeEventHandler<HTMLInputElement | HTMLTextAreaElement> | ||
| onClick | React.MouseEventHandler | ||
| onFocus | React.FocusEventHandler<HTMLInputElement | HTMLTextAreaElement> | ||
| required | boolean | If | |
| value | unknown |
| Name | Type | Default | Description |
|---|---|---|---|
| disabled | boolean | If | |
| error | boolean | If | |
| focused | boolean | If | |
| formControlContext | FormControlState | undefined | Return value from the | |
| getInputProps | <ExternalProps extends Record<string, any> = {}>(externalProps?: ExternalProps) => UseInputInputSlotProps<ExternalProps> | Resolver for the input slot's props. | |
| getRootProps | <ExternalProps extends Record<string, any> = {}>(externalProps?: ExternalProps) => UseInputRootSlotProps<ExternalProps> | Resolver for the root slot's props. | |
| inputRef | React.RefCallback<HTMLInputElement | HTMLTextAreaElement> | null | ||
| required | boolean | If | |
| value | unknown | The |