OutlinedInput API
API reference docs for the React OutlinedInput component. Learn about the props, CSS, and other APIs of this exported module.
Component demos
Import
import OutlinedInput from '@mui/material/OutlinedInput';
// or
import { OutlinedInput } from '@mui/material';
Props of the InputBase component are also available.
Name | Type | Default | Description |
---|---|---|---|
autoComplete | string | This prop helps users to fill forms faster, especially on mobile devices. The name can be confusing, as it's more like an autofill. You can learn more about it following the specification. | |
autoFocus | bool | If | |
classes | object | Override or extend the styles applied to the component. See CSS API below for more details. | |
color | 'primary' | 'secondary' | string | The color of the component. It supports both default and custom theme colors, which can be added as shown in the palette customization guide. The prop defaults to the value ( | |
components | { Input?: elementType, Root?: elementType } | {} | The components used for each slot inside. |
defaultValue | any | The default value. Use when the component is not controlled. | |
disabled | bool | If | |
endAdornment | node | End | |
error | bool | If | |
fullWidth | bool | false | If |
id | string | The id of the | |
inputComponent | elementType | 'input' | The component used for the |
inputProps | object | {} | Attributes applied to the |
inputRef | ref | Pass a ref to the | |
label | node | The label of the | |
margin | 'dense' | 'none' | If | |
maxRows | number | string | Maximum number of rows to display when multiline option is set to true. | |
minRows | number | string | Minimum number of rows to display when multiline option is set to true. | |
multiline | bool | false | If |
name | string | Name attribute of the | |
notched | bool | If | |
onChange | func | Callback fired when the value is changed. Signature: function(event: React.ChangeEvent
| |
placeholder | string | The short hint displayed in the | |
readOnly | bool | It prevents the user from changing the value of the field (not from interacting with the field). | |
required | bool | If | |
rows | number | string | Number of rows to display when multiline option is set to true. | |
slots | { input?: elementType, root?: elementType } | {} | The components used for each slot inside. |
startAdornment | node | Start | |
sx | Array<func | object | bool> | func | object | The system prop that allows defining system overrides as well as additional CSS styles. See the `sx` page for more details. | |
type | string | 'text' | Type of the |
value | any | The value of the |
ref
is forwarded to the root element.Inheritance
While not explicitly documented above, the props of the InputBase component are also available in OutlinedInput. You can take advantage of this to target nested components.
Theme default props
You can use MuiOutlinedInput
to change the default props of this component with the theme.
These class names are useful for styling with CSS. They are applied to the component's slots when specific states are triggered.
Class name | Rule name | Description |
---|---|---|
.Mui-disabled | Styles applied to the root element if disabled={true} . | |
.Mui-error | State class applied to the root element if error={true} . | |
.Mui-focused | Styles applied to the root element if the component is focused. | |
.MuiOutlinedInput-adornedEnd | adornedEnd | Styles applied to the root element if endAdornment is provided. |
.MuiOutlinedInput-adornedStart | adornedStart | Styles applied to the root element if startAdornment is provided. |
.MuiOutlinedInput-colorSecondary | colorSecondary | Styles applied to the root element if the color is secondary. |
.MuiOutlinedInput-input | input | Styles applied to the input element. |
.MuiOutlinedInput-inputAdornedEnd | inputAdornedEnd | Styles applied to the input element if endAdornment is provided. |
.MuiOutlinedInput-inputAdornedStart | inputAdornedStart | Styles applied to the input element if startAdornment is provided. |
.MuiOutlinedInput-inputMultiline | inputMultiline | Styles applied to the input element if multiline={true} . |
.MuiOutlinedInput-inputSizeSmall | inputSizeSmall | Styles applied to the input element if size="small" . |
.MuiOutlinedInput-inputTypeSearch | inputTypeSearch | Styles applied to the input element if type="search" . |
.MuiOutlinedInput-multiline | multiline | Styles applied to the root element if multiline={true} . |
.MuiOutlinedInput-notchedOutline | notchedOutline | Styles applied to the NotchedOutline element. |
.MuiOutlinedInput-root | root | Styles applied to the root element. |
.MuiOutlinedInput-sizeSmall | sizeSmall | Styles applied to the input element if size="small" . |
You can override the style of the component using one of these customization options:
- With a global class name.
- With a rule name as part of the component's
styleOverrides
property in a custom theme.