# React Native Separator

> A React Native separator (divider) for iOS, Android and the web: a horizontal or vertical line between content, decorative by default or announced as a separator.

# Separator

A thin line between pieces of content.

```tsx
import { Separator } from 'patine-ui';
```

```tsx live
import { HStack, Separator, Text, VStack } from 'patine-ui';

export default function Example() {
  return (
    <VStack gap="md">
      <VStack gap="xs">
        <Text weight="medium">Patine UI</Text>
        <Text size="sm" color="textSecondary">Components for iOS, Android and the web.</Text>
      </VStack>
      <Separator />
      <HStack gap="md" align="center" style={{ height: 20 }}>
        <Text size="sm">Docs</Text>
        <Separator orientation="vertical" />
        <Text size="sm">Components</Text>
        <Separator orientation="vertical" />
        <Text size="sm">GitHub</Text>
      </HStack>
    </VStack>
  );
}
```

## Example: a receipt

A café's digital receipt: full-width lines split the order from the totals and the payment, and vertical ones split the details in the header row.

```tsx live
import { Box, HStack, Separator, Text, VStack } from 'patine-ui';

const LINES = [
  { item: 'Flat white', qty: 2, price: 3.8 },
  { item: 'Almond croissant', qty: 1, price: 3.6 },
  { item: 'Banana bread', qty: 1, price: 3.2 },
];
const subtotal = LINES.reduce((sum, l) => sum + l.qty * l.price, 0);

const Row = ({ left, right, bold }: { left: string; right: string; bold?: boolean }) => (
  <HStack justify="space-between">
    <Text weight={bold ? 'semibold' : 'regular'}>{left}</Text>
    <Text weight={bold ? 'semibold' : 'regular'}>{right}</Text>
  </HStack>
);

export default function Example() {
  return (
    <Box border radius="lg" padding="lg" gap="md" style={{ width: '100%', maxWidth: 360 }}>
      <VStack gap="xs" align="center">
        <Text size="lg" weight="semibold">Kaffeebar Nord</Text>
        <HStack gap="sm" align="center" style={{ height: 16 }}>
          <Text size="sm" color="textSecondary">Nov 18</Text>
          <Separator orientation="vertical" />
          <Text size="sm" color="textSecondary">09:42</Text>
          <Separator orientation="vertical" />
          <Text size="sm" color="textSecondary">Table 4</Text>
        </HStack>
      </VStack>
      <Separator />
      <VStack gap="xs">
        {LINES.map((l) => (
          <Row key={l.item} left={`${l.qty} × ${l.item}`} right={`€${(l.qty * l.price).toFixed(2)}`} />
        ))}
      </VStack>
      <Separator />
      <VStack gap="xs">
        <Row left="Subtotal" right={`€${subtotal.toFixed(2)}`} />
        <Row left="incl. VAT 9%" right={`€${(subtotal - subtotal / 1.09).toFixed(2)}`} />
        <Row left="Total" right={`€${subtotal.toFixed(2)}`} bold />
      </VStack>
      <Separator />
      <Text size="sm" color="textSecondary">Paid with Visa •••• 4242</Text>
    </Box>
  );
}
```

## Accessibility

A separator is decorative by default, so screen readers skip it. Set `decorative={false}` when it divides content in a meaningful way; it's then announced as a separator with its orientation.

## Props

Separator also takes `View` props.

| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| `orientation` | `'horizontal' \| 'vertical'` | `'horizontal'` | The line's direction. |
| `decorative` | `boolean` | `true` | Hide it from screen readers. |
| `theme` | `DeepPartial<Theme>` | — | Theme override. |
