Skip to main content
Version: Current (v6.4.2)

MUI Customization

You can customize the underlying Material UI (MUI) components used by @rjsf/mui by passing props directly through the uiSchema. This is extremely useful for applying simple customizations (like adding an endAdornment to an input field, tweaking margins, or changing variants) without having to build a completely custom Widget or Template.

Basic Usage

The @rjsf/mui package looks for a mui key inside the ui:options of your uiSchema. Any top-level properties defined here will be applied to the primary MUI wrapper component for that field (e.g. TextField for inputs, FormGroup for checkboxes, Paper/Grid for object/array wrappers).

{
"myField": {
"ui:options": {
"mui": {
"variant": "filled",
"fullWidth": false,
"sx": {
"backgroundColor": "background.paper",
"padding": 2
}
}
}
}
}

slotProps vs rjsfSlotProps

@rjsf/mui distinguishes between two kinds of slot customization:

  • slotProps: Passed directly to MUI's native slotProps API on a component (e.g., TextField's htmlInput, input, inputLabel targets). These are standard MUI customization points.
  • rjsfSlotProps: Used by RJSF template components (e.g., ArrayFieldTemplate, ObjectFieldTemplate) to target their specific sub-components (e.g., paper, grid, box). This key is explicitly extracted before spreading, which prevents prop bleeding — ensuring configuration is not accidentally passed to unintended child components.

Using slotProps (for MUI widgets like BaseInputTemplate)

{
"myPriceField": {
"ui:options": {
"mui": {
"slotProps": {
"input": {
"startAdornment": "$"
}
}
}
}
}
}

Using rjsfSlotProps (for structural templates)

{
"myArrayField": {
"ui:options": {
"mui": {
"rjsfSlotProps": {
"arrayPaper": {
"elevation": 10
}
}
}
}
}
}

Customizing Templates (e.g. Object and Array wrappers)

MUI theme customizations are natively passed down into both your standard fields and their wrapping structural templates (like ArrayFieldTemplate or ObjectFieldTemplate) (see table below).

If you wish to specifically target the individual array items handled by ArrayFieldItemTemplate instead of the whole array container, you nest these overrides by targeting the items inside the schema:

{
"myArrayField": {
"items": {
"ui:options": {
"mui": {
"rjsfSlotProps": {
"arrayItemGridContainer": {
"spacing": 2
}
}
}
}
}
}
}

Components and their rjsfSlotProps targets

Different templates and widgets expose different rjsfSlotProps targets based on their underlying MUI composition.

RJSF ComponentrjsfSlotProps targets availableDescription
BaseInputTemplate(uses native slotProps)Uses MUI's slotProps.htmlInput, slotProps.input, slotProps.inputLabel directly.
FieldTemplatefieldFormControlProps passed to the outer FormControl wrapper.
fieldTypographyProps passed to the Typography component used for the description.
ObjectFieldTemplateobjectGridContainerProps passed to the outer Grid container.
objectGridItemProps passed to each property's Grid item.
objectAddButtonGridContainerProps passed to the Grid container adjacent to the Add button.
objectAddButtonGridItemProps passed to the Grid item wrapping the Add button.
ArrayFieldTemplatearrayBoxProps passed to the inner Box container holding the array items.
arrayPaperProps passed to the outer Paper wrapper.
arrayAddButtonGridContainerProps passed to the Grid container adjacent to the Add button.
arrayAddButtonGridItemProps passed to the Grid item wrapping the Add button.
arrayAddButtonBoxProps passed to the Box wrapping the Add button.
ArrayFieldItemTemplatearrayItemGridContainerProps passed to the outer Grid container for the item row.
arrayItemGridItemProps passed to the content Grid item.
arrayItemOuterBoxProps passed to the outer Box.
arrayItemPaperProps passed to the Paper elevation component.
arrayItemInnerBoxProps passed to the inner Box holding the children.
arrayItemToolbarGridProps passed to the Grid holding the toolbar buttons.
CheckboxesWidgetformGroupProps passed to the FormGroup container.
checkboxProps passed to individual Checkbox components.
formControlLabelProps passed to the FormControlLabel components wrapping each checkbox.
CheckboxWidgetcheckboxProps passed to the single Checkbox component.
formControlLabelProps passed to the FormControlLabel component wrapping the checkbox.
RadioWidgetradioGroupProps passed to the RadioGroup component.
radioProps passed to the individual Radio components.
formControlLabelProps passed to the FormControlLabel components wrapping each radio.
SelectWidgetinputLabelProps passed to the native MUI InputLabel component.
selectProps passed to the native MUI Select component.
ErrorListerrorBoxProps passed to the inner Box.
errorListProps passed to the List container.
errorListItemProps passed to individual ListItem components wrapping each error.
errorListItemIconProps passed to the ListItemIcon next to each error.
errorListItemTextProps passed to the ListItemText displaying the error.
errorPaperProps passed to the outer Paper wrapper.
errorTypographyProps passed to the Typography displaying the "Errors" title.
FieldErrorTemplatefieldErrorListProps passed to the List container.
fieldErrorListItemProps passed to individual ListItem components.
fieldErrorFormHelperTextProps passed to the FormHelperText displaying the error text.
FieldHelpTemplatehelpFormHelperTextProps passed to the FormHelperText used for help text.
DescriptionFielddescTypographyProps passed to the Typography component.
TitleFieldtitleBoxProps passed to the outer Box wrapper.
titleDividerProps passed to the Divider element.
titleTypographyProps passed to the Typography component used for the title.
titleGridContainerProps passed to Grid container when title has optional data controls.
titleGridItemProps passed to the Grid item containing the title.
titleOptionalDataGridItemProps passed to the Grid item containing the optional data control.
MultiSchemaFieldTemplatemultiBoxProps passed to the wrapper Box.
multiFormControlProps passed to the wrapper FormControl.
SubmitButtonsubmitBoxProps passed to the Box wrapping the submit button.
submitButtonProps passed to the Button element.
WrapIfAdditionalTemplatewrapGridContainerProps passed to the outer Grid container.
wrapKeyGridItemProps passed to the Grid item containing the key TextField.
wrapChildrenGridItemProps passed to the Grid item containing the field children.
wrapRemoveButtonGridItemProps passed to the Grid item containing the remove button.