Separator

Primitives

Horizontal and vertical divider line with optional centered label, dashed style, configurable thickness, color, and spacing. Accessibility-aware (decorative by default).

GitHub

Installation

bash
1
npx native-mate add separator

Examples

#FAFAFA
Radius100%

Usage

tsx
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
import { Separator } from '~/components/ui/separator'

// Default horizontal
<Separator />

// With label
<Separator label="or" />
<Separator label="continue with" />

// Dashed
<Separator dashed />
<Separator dashed label="or" />

// Custom thickness & color
<Separator thickness={2} color="#6366f1" />

// Vertical (inside a row)
<View style={{ flexDirection: 'row', height: 40 }}>
  <Button variant="ghost">Cut</Button>
  <Separator orientation="vertical" spacing={4} />
  <Button variant="ghost">Copy</Button>
  <Separator orientation="vertical" spacing={4} />
  <Button variant="ghost">Paste</Button>
</View>

// Custom spacing
<Separator spacing={16} label="section" />

Props

PropTypeDefaultDescription
orientation"horizontal"|"vertical""horizontal"Direction of the divider.
thicknessnumberStyleSheet.hairlineWidthLine width/height in dp.
colorstringLine color. Defaults to theme.colors.border.
spacingnumber8Margin on both sides (vertical for horizontal, horizontal for vertical).
labelstringOptional text centered in the line, e.g. "or".
labelColorstringLabel text color. Defaults to theme.colors.muted.
labelSizenumber11Label font size.
labelWeightTextStyle["fontWeight"]"500"Label font weight.
dashedbooleanfalseRenders the line as dashed instead of solid.
decorativebooleantrueHides from assistive technology when true.

Example

tsx
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
import { Separator } from '~/components/ui/separator'
import { View } from 'react-native'

export function SeparatorExamples() {
  return (
    <View style={{ padding: 16, gap: 0 }}>
      <Separator />
      <Separator label="or" />
      <Separator dashed />
      <Separator dashed label="or" />
      <Separator thickness={2} color="#6366f1" />
      <Separator spacing={16} />

      {/* Toolbar with vertical separators */}
      <View style={{ flexDirection: 'row', alignItems: 'center', height: 44 }}>
        <Button variant="ghost" size="sm">Cut</Button>
        <Separator orientation="vertical" />
        <Button variant="ghost" size="sm">Copy</Button>
        <Separator orientation="vertical" />
        <Button variant="ghost" size="sm">Paste</Button>
      </View>
    </View>
  )
}

Accessibility

FeatureDetail
DecorativeWhen decorative={true} (default) the separator is hidden from screen readers. Set decorative={false} when the separator has semantic meaning.
RoleWhen decorative={false}, accessibilityRole="separator" is applied automatically.