---
title: Divider
---

import LibraryInfo from '@theme/LibraryInfo'
import { Feedback, TokensTable, PropsTable } from '../../src/components'
import { Divider } from '@telus-uds/components-web'
import { Divider as BaseDocs } from 'docs/@telus-uds/components-base'
import AvailableOnBoth from '../../partials/_platform-considerations-both.mdx'

# Divider

<LibraryInfo figmaLink="https://www.figma.com/embed?embed_host=share&url=https%3A%2F%2Fwww.figma.com%2Ffile%2F4zJn2Qn6uXOqPP1GVDipy6%2F%25F0%259F%258D%2580-Allium-Components%3Fnode-id%3D433%253A1917" />

```jsx live
<Divider />
```

## Introduction

Divider is effectively a styled, cross-platform `hr` component.

[Follow the appropriate instructions](importing-components) to add this component in to your app.

## Guidance

Divider is based on the flexbox model and uses `alignSelf: flex` to span its flex parent.

## Vertical

Vertical dividers can be created by passing a `vertical` boolean prop. In a flexbox row, vertical dividers will automatically size to their parent height.

:::info
Note that for a vertical divider the parent flex element **must** have flex direction set to row.
This is the default for web but not for React Native.
:::

## Space

Pass a number referring to a position on the space scale to the `space` prop to create space either side of the divider.

```jsx live
<Divider space={1} />
```

As with other `space` props you can also use a responsive object.

```jsx live
<Divider space={{ xs: 1, sm: 2, md: 3, lg: 4, xl: 6 }} />
```

To reduce the length of a divider, as well as creating space between it and its neighbours, wrap it in
a `Box` component. For example, this will have the second-smallest theme-supported spacing value between
the dividing line and its neighbours, and will shorten the line at either end by the same amount:

```jsx live
<Box variant={{ background: 'light' }} space={4}>
  <Divider />
</Box>
```

### Accessibility

Dividers are labelled with ARIA attributes `role="separator"` and `aria-orientation="vertical/horizontal"` automatically.
Note these only apply on web.

### Platform considerations

<AvailableOnBoth />

## Props

<PropsTable base={BaseDocs} />

## Tokens

<TokensTable base={BaseDocs} component="Divider" />

## Variants

### Weight

Regular or `thick`.

```js live
<StackView space={2}>
  <Divider />
  <Divider variant={{ weight: 'thick' }} />
</StackView>
```

### Decorative

Use a decorative divider to highlight an element.

```js live
<StackView space={2}>
  <Divider variant={{ decorative: true }} />
  <Divider variant={{ decorative: true, weight: 'thick' }} />
</StackView>
```

### Inverse

Use inverse on dark backgrounds.

```js live dark
<StackView space={2}>
  <Divider variant={{ inverse: true }} />
  <Divider variant={{ inverse: true, weight: 'thick' }} />
</StackView>
```

## Feedback

<Feedback component="Divider" />
