Skip to content
+

Form Control

The Form Control component is a utility that lets you associate a form input with auxiliary components, such as labels, error indicators, or helper text.

FormControl API

Import

import { FormControl } from '@mui/base/FormControl';
// or
import { FormControl } from '@mui/base';

Learn about the difference by reading this guide on minimizing bundle size.

Props

Props of the native component are also available.

NameTypeDefaultDescription
childrennode
| func
-

The content of the component.

classNamestring-

Class name applied to the root element.

disabledboolfalse

If true, the label, input and helper text should be displayed in a disabled state.

errorboolfalse

If true, the label is displayed in an error state.

onChangefunc-

Callback fired when the form element's value is modified.

requiredboolfalse

If true, the label will indicate that the input is required.

slotProps{ root?: func
| object }
{}

The props used for each slot inside the FormControl.

slots{ root?: elementType }{}

The components used for each slot inside the FormControl. Either a string to use a HTML element or a component.

See Slots API below for more details.

valueany-

The value of the form element.


The ref is forwarded to the root element.

Slots

To learn how to customize the slot, check out the Overriding component structure guide.

Slot nameClass nameDefault componentDescription
root.base-FormControl-root'div'The component that renders the root.

CSS classes

These class names are useful for styling with CSS. They are applied to the component's slots when specific states are triggered.

Class nameDescription
.base--disabledState class applied to the root element if disabled={true}.
.base--errorState class applied to the root element if error={true}.
.base--focusedState class applied to the root element if the inner input is focused.
.base--requiredState class applied to the root element if required={true}.
.base-FormControl-filledState class applied to the root element if the inner input has value.