Skip to main content

Divider

A divider is a thin line that groups content in lists and containers. It follows the Material Design 3 Divider specification: 1dp, drawn in outlineVariant.

Usage​

import { Column, Divider, Typography } from '@rootnative/components'
import { mdiResolver } from '@rootnative/components/mdi'
import { ThemeProvider } from '@rootnative/core'
import { SafeAreaProvider } from 'react-native-safe-area-context'

export default function App() {
return (
<SafeAreaProvider>
<ThemeProvider iconResolver={mdiResolver}>
<Column gap="md" style={{ padding: 24 }}>
<Typography variant="bodyLarge">Above</Typography>
<Divider />
<Typography variant="bodyLarge">Below</Typography>
</Column>
</ThemeProvider>
</SafeAreaProvider>
)
}

Insets​

insetStart insets the leading edge, and insetEnd insets the trailing edge. Both take a number in dp. insetStart also accepts true, which applies the MD3 list inset of 56dp. That offset aligns a divider with list text that follows a 24dp leading icon.

Prop valueResult
<Divider />Full-bleed
<Divider insetStart />56dp leading inset (MD3 list inset)
<Divider insetStart={16} />16dp leading inset
<Divider insetStart={16} insetEnd={16} />Inset on both ends
import { Column, Divider, Typography } from '@rootnative/components'
import { mdiResolver } from '@rootnative/components/mdi'
import { ThemeProvider } from '@rootnative/core'
import { SafeAreaProvider } from 'react-native-safe-area-context'

export default function App() {
return (
<SafeAreaProvider>
<ThemeProvider iconResolver={mdiResolver}>
<Column gap="lg" style={{ padding: 24 }}>
<Typography variant="labelSmall">Full-bleed</Typography>
<Divider />
<Typography variant="labelSmall">insetStart</Typography>
<Divider insetStart />
<Typography variant="labelSmall">inset + insetEnd</Typography>
<Divider insetStart={16} insetEnd={16} />
</Column>
</ThemeProvider>
</SafeAreaProvider>
)
}

Vertical​

Set orientation="vertical" to separate content side by side. A vertical divider stretches to the height of its parent, so it must sit inside a row-direction container that has a height. In this orientation insetStart and insetEnd apply to the top and bottom edges.

import { Divider, Row, Typography } from '@rootnative/components'
import { mdiResolver } from '@rootnative/components/mdi'
import { ThemeProvider } from '@rootnative/core'
import { SafeAreaProvider } from 'react-native-safe-area-context'

export default function App() {
return (
<SafeAreaProvider>
<ThemeProvider iconResolver={mdiResolver}>
<Row gap="md" align="center" style={{ padding: 24, height: 80 }}>
<Typography variant="bodyLarge">Drafts</Typography>
<Divider orientation="vertical" />
<Typography variant="bodyLarge">Sent</Typography>
<Divider orientation="vertical" />
<Typography variant="bodyLarge">Spam</Typography>
</Row>
</ThemeProvider>
</SafeAreaProvider>
)
}

Thickness and color​

thickness sets the line weight in dp, and containerColor overrides the line color. Both default to the MD3 values (1dp, outlineVariant). Use them for an emphasis rule, not for ordinary content separation.

import { Column, Divider } from '@rootnative/components'
import { mdiResolver } from '@rootnative/components/mdi'
import { ThemeProvider, useTheme } from '@rootnative/core'
import { SafeAreaProvider } from 'react-native-safe-area-context'

function Demo() {
const theme = useTheme()
return (
<Column gap="lg" style={{ padding: 24 }}>
<Divider />
<Divider thickness={2} />
<Divider thickness={4} containerColor={theme.colors.primary} />
</Column>
)
}

export default function App() {
return (
<SafeAreaProvider>
<ThemeProvider iconResolver={mdiResolver}>
<Demo />
</ThemeProvider>
</SafeAreaProvider>
)
}

Relationship to ListDivider​

ListDivider, exported from @rootnative/components/list, is an alias of Divider with the same props. It stays exported so existing list code keeps working. In new code, import Divider directly.

Props​

PropTypeDefaultRequiredDescription
orientationenumhorizontalNoAxis the divider is drawn along. A vertical divider stretches to the height of its parent, so it must sit inside a row-direction container.
insetStartnumber | booleanNoInset from the leading edge (start for horizontal, top for vertical). `true` applies the MD3 list inset (56dp), which aligns the divider with list text that follows a leading icon. A number sets the inset in dp.
insetEndnumber | booleanNoInset from the trailing edge (end for horizontal, bottom for vertical). Same units as `insetStart`.
thicknessnumber1NoLine thickness in dp.
containerColorstringtheme.colors.outlineVariantNoOverride the line color.
styleStyleProp<ViewStyle>-No-