[go: up one dir, main page]

Skip to content

Divider API

API reference docs for the React Divider component. Learn about the props, CSS, and other APIs of this exported module.

DemosImport
import Divider from '@mui/material/Divider';
// or
import { Divider } from '@mui/material';

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

Props

Props of the native component are also available.

NameTypeDefaultDescription
absoluteboolfalse

Absolutely position the element.

childrennode-

The content of the component.

classesobject-

Override or extend the styles applied to the component.

See CSS classes API below for more details.

componentelementType-

The component used for the root node. Either a string to use a HTML element or a component.

flexItemboolfalse

If true, a vertical divider will have the correct height when used in flex container. (By default, a vertical divider will have a calculated height of 0px if it is the child of a flex container.)

lightboolfalse

If true, the divider will have a lighter color.

orientation'horizontal'
| 'vertical'
'horizontal'

The component orientation.

sxArray<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.

textAlign'center'
| 'left'
| 'right'
'center'

The text alignment.

variant'fullWidth'
| 'inset'
| 'middle'
| string
'fullWidth'

The variant to use.

The ref is forwarded to the root element.
Theme default props

You can use MuiDivider to change the default props of this component with the theme.

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 nameRule nameDescription
.MuiDivider-absoluteabsoluteStyles applied to the root element if absolute={true}.
.MuiDivider-flexItemflexItemStyles applied to the root element if flexItem={true}.
.MuiDivider-fullWidthfullWidthStyles applied to the root element if variant="fullWidth".
.MuiDivider-insetinsetStyles applied to the root element if variant="inset".
.MuiDivider-lightlightStyles applied to the root element if light={true}.
.MuiDivider-middlemiddleStyles applied to the root element if variant="middle".
.MuiDivider-rootrootStyles applied to the root element.
.MuiDivider-textAlignLefttextAlignLeftStyles applied to the root element if textAlign="left" orientation="horizontal".
.MuiDivider-textAlignRighttextAlignRightStyles applied to the root element if textAlign="right" orientation="horizontal".
.MuiDivider-verticalverticalStyles applied to the root element if orientation="vertical".
.MuiDivider-withChildrenwithChildrenStyles applied to the root element if divider have text.
.MuiDivider-withChildrenVerticalwithChildrenVerticalStyles applied to the root element if divider have text and orientation="vertical".
.MuiDivider-wrapperwrapperStyles applied to the span children element if orientation="horizontal".
.MuiDivider-wrapperVerticalwrapperVerticalStyles applied to the span children element if orientation="vertical".

You can override the style of the component using one of these customization options:

Source code

If you did not find the information in this page, consider having a look at the implementation of the component for more detail.