Skip to content

useInput API

API reference docs for the useInput hook. Learn about the input parameters and other APIs of this exported module.

Demos

For examples and details on the usage of this React hook, visit the demo pages:

Import

import { useInput } from '@mui/base/InputUnstyled';

Parameters

NameTypeDefaultDescription
defaultValueunknown
The default value. Use when the component is not controlled.
disabledboolean
If true, the component is disabled. The prop defaults to the value (false) inherited from the parent FormControl component.
errorboolean
If true, the input will indicate an error by setting the aria-invalid attribute. The prop defaults to the value (false) inherited from the parent FormControl component.
inputRefReact.Ref<HTMLInputElement>
onBlurReact.FocusEventHandler
onChangeReact.ChangeEventHandler<HTMLInputElement>
onClickReact.MouseEventHandler
onFocusReact.FocusEventHandler
requiredboolean
If true, the input element is required. The prop defaults to the value (false) inherited from the parent FormControl component.
valueunknown

Return value

NameTypeDefaultDescription