--- productId: material-ui title: React Divider component components: Divider githubLabel: 'scope: divider' materialDesign: https://m2.material.io/components/dividers githubSource: packages/mui-material/src/Divider --- # Divider The Divider component provides a thin, unobtrusive line for grouping elements to reinforce visual hierarchy. ## Introduction The Material UI Divider component renders as a dark gray `
` by default, and features several useful props for quick style adjustments. ```tsx import Card from '@mui/material/Card'; import Box from '@mui/material/Box'; import Chip from '@mui/material/Chip'; import Stack from '@mui/material/Stack'; import Divider from '@mui/material/Divider'; import Typography from '@mui/material/Typography'; export default function IntroDivider() { return ( Toothbrush $4.50 Pinstriped cornflower blue cotton blouse takes you on a walk to the park or just down the hall. Select type ); } ``` ## Basics ```jsx import Divider from '@mui/material/Divider'; ``` ### Variants The Divider component supports three variants: `fullWidth` (default), `inset`, and `middle`. ```tsx import List from '@mui/material/List'; import ListItem from '@mui/material/ListItem'; import ListItemText from '@mui/material/ListItemText'; import Divider from '@mui/material/Divider'; const style = { py: 0, width: '100%', maxWidth: 360, borderRadius: 2, border: '1px solid', borderColor: 'divider', backgroundColor: 'background.paper', }; export default function DividerVariants() { return ( ); } ``` ### Orientation Use the `orientation` prop to change the Divider from horizontal to vertical. When using vertical orientation, the Divider renders a `
` with the corresponding accessibility attributes instead of `
` to adhere to the WAI-ARIA [spec](https://www.w3.org/TR/wai-aria-1.2/#separator). ```tsx import FormatAlignLeftIcon from '@mui/icons-material/FormatAlignLeft'; import FormatAlignCenterIcon from '@mui/icons-material/FormatAlignCenter'; import FormatAlignRightIcon from '@mui/icons-material/FormatAlignRight'; import FormatBoldIcon from '@mui/icons-material/FormatBold'; import Box from '@mui/material/Box'; import Divider, { dividerClasses } from '@mui/material/Divider'; export default function VerticalDividers() { return ( ); } ``` ### Flex item Use the `flexItem` prop to display the Divider when it's being used in a flex container. ```tsx import FormatBoldIcon from '@mui/icons-material/FormatBold'; import FormatItalicIcon from '@mui/icons-material/FormatItalic'; import Box from '@mui/material/Box'; import Divider from '@mui/material/Divider'; export default function FlexDivider() { return ( ); } ``` ### With children Use the `textAlign` prop to align elements that are wrapped by the Divider. ```tsx import { styled } from '@mui/material/styles'; import Divider from '@mui/material/Divider'; import Chip from '@mui/material/Chip'; const Root = styled('div')(({ theme }) => ({ width: '100%', ...theme.typography.body2, color: (theme.vars || theme).palette.text.secondary, '& > :not(style) ~ :not(style)': { marginTop: theme.spacing(2), }, })); export default function DividerText() { const content = (

{`Lorem ipsum dolor sit amet, consectetur adipiscing elit.`}

); return ( {content} CENTER {content} LEFT {content} RIGHT {content} {content} ); } ``` ## Customization ### Use with a List When using the Divider to separate items in a List, use the `component` prop to render it as an `
  • `—otherwise it won't be a valid HTML element. ```tsx import List from '@mui/material/List'; import ListItem from '@mui/material/ListItem'; import ListItemText from '@mui/material/ListItemText'; import Divider from '@mui/material/Divider'; const style = { p: 0, width: '100%', maxWidth: 360, borderRadius: 2, border: '1px solid', borderColor: 'divider', backgroundColor: 'background.paper', }; export default function ListDividers() { return ( ); } ``` ### Icon grouping The demo below shows how to combine the props `variant="middle"` and `orientation="vertical"`. ```tsx import Card from '@mui/material/Card'; import Divider, { dividerClasses } from '@mui/material/Divider'; import FormatAlignLeftIcon from '@mui/icons-material/FormatAlignLeft'; import FormatAlignCenterIcon from '@mui/icons-material/FormatAlignCenter'; import FormatAlignRightIcon from '@mui/icons-material/FormatAlignRight'; import FormatBoldIcon from '@mui/icons-material/FormatBold'; export default function VerticalDividerMiddle() { return ( ); } ``` ## Accessibility Due to its implicit role of `separator`, the Divider, which is a `
    ` element, will be announced by screen readers as a "Horizontal Splitter" (or vertical, if you're using the `orientation` prop). If you're using it as a purely stylistic element, we recommend setting `aria-hidden="true"` which will make screen readers bypass it. ```js