Skip to main content

Divider

Divider is a separator that splits content into groups, such as sections of a list or items in a toolbar.

Import

import { Divider } from '@vortexlabs/vortex-native';
import type { DividerProps } from '@vortexlabs/vortex-native';

Other links

<Divider contentPosition="center">Label</Divider>

Features

  • Supports horizontal and vertical separators with responsive orientation.
  • Can contain text at the start, center, or end of horizontal dividers.
  • Supports insets from the container edges.

Orientation

Divider is horizontal by default. Set vertical to separate items in a row; the divider takes the height of its row.

<Stack direction="row" gap={3}>
    <Text>Edit</Text>
    <Divider vertical />
    <Text>Share</Text>
</Stack>

Pass a breakpoint object to vertical to switch orientation across breakpoints.

<Stack direction={{ xs: "column", md: "row" }} gap={3}>
    <Text>Edit</Text>
    <Divider vertical={{ xs: false, md: true }} />
    <Text>Share</Text>
</Stack>

Content Position

Pass children to add a label. contentPosition places it at the start, center, or end; the default is center. Vertical dividers hide their children.

<Divider contentPosition="center">or</Divider>
<Divider contentPosition="start">or</Divider>
<Divider contentPosition="end">or</Divider>

Inset

Use inset to pull the line in from the container edges, in 4pt units: left and right when horizontal, top and bottom when vertical.

<Stack backgroundColor="surface" paddingBlock={4}>
    <Divider inset={4} />
</Stack>

Accessibility

Description
Renders a View with role="separator".