|
| 1 | +--- |
| 2 | +name: Divider |
| 3 | +menu: Components |
| 4 | +route: /components/divider |
| 5 | +--- |
| 6 | + |
| 7 | +import { Playground } from 'docz'; |
| 8 | +import { ItemWrapper } from '../../../../docs/components/ItemWrapper.ts'; |
| 9 | +import { Divider } from '../Divider.tsx'; |
| 10 | +import { WrappedHorizontalDivider, WrappedVerticalDivider, SectionPlaceholder } from './WrappedDivider.tsx'; |
| 11 | + |
| 12 | +# Divider |
| 13 | + |
| 14 | +**Primary UI element for visually separating content** |
| 15 | + |
| 16 | +Renders a divider UI component: horizontal or vertical line that visually separates two pieces of data, content or UI. |
| 17 | +<br/> |
| 18 | + |
| 19 | +### Default Behaviour |
| 20 | +The horizontal divider takes up the full available width and the vertical divider takes up the full available height. |
| 21 | + |
| 22 | +The horizontal divider is rendered by default. Set **vertical** prop to `true` to change the divider orientation. |
| 23 | +<br/> |
| 24 | + |
| 25 | +### Divider vs Border |
| 26 | +The default color of Divider is **$border.primary** (#C6CDD4), however... |
| 27 | + |
| 28 | +**Divider is NOT a border, and should not be used as such. Please do not use this component as a border for elements.** |
| 29 | + |
| 30 | +Divider is naturally expected to have a certain offset from the elements it is 'dividing' or separating. |
| 31 | +<br/> |
| 32 | + |
| 33 | +### Style Props |
| 34 | +The Divider has the following design props: |
| 35 | +- **offset** - set the divider offset from the content it is separating (uses _mx_, _my_ styled system props) |
| 36 | +<br/> |
| 37 | +<br/> |
| 38 | + |
| 39 | +## Usage |
| 40 | + |
| 41 | +### Horizontal (with default offset) |
| 42 | + |
| 43 | +<ItemWrapper> |
| 44 | + <WrappedHorizontalDivider offset='1rem' /> |
| 45 | +</ItemWrapper> |
| 46 | + |
| 47 | +```jsx |
| 48 | +<Divider /> |
| 49 | +``` |
| 50 | +<br/> |
| 51 | + |
| 52 | +### Horizontal (without offset) |
| 53 | + |
| 54 | +<ItemWrapper> |
| 55 | + <WrappedHorizontalDivider offset={0} /> |
| 56 | +</ItemWrapper> |
| 57 | + |
| 58 | +```jsx |
| 59 | +<Divider offset={0} /> |
| 60 | +``` |
| 61 | +<br/> |
| 62 | + |
| 63 | +### Vertical (with default offset) |
| 64 | + |
| 65 | +<ItemWrapper> |
| 66 | + <WrappedVerticalDivider offset='1rem' /> |
| 67 | +</ItemWrapper> |
| 68 | + |
| 69 | +```jsx |
| 70 | +<Divider vertical /> |
| 71 | +``` |
| 72 | +<br/> |
| 73 | + |
| 74 | +### Vertical (without offset) |
| 75 | + |
| 76 | +<ItemWrapper> |
| 77 | + <WrappedVerticalDivider offset={0} /> |
| 78 | +</ItemWrapper> |
| 79 | + |
| 80 | +```jsx |
| 81 | +<Divider vertical /> |
| 82 | +``` |
| 83 | +<br/> |
| 84 | + |
| 85 | +# Playground |
| 86 | + |
| 87 | +<Playground> |
| 88 | + <section>Section 1</section> |
| 89 | + <Divider /> |
| 90 | + <section>Section 2</section> |
| 91 | +</Playground> |
| 92 | + |
| 93 | +<Playground> |
| 94 | + {/* We need the row flow to see vertical divider */} |
| 95 | + <div style={{ display: 'flex' }}> |
| 96 | + <SectionPlaceholder>Section 1</SectionPlaceholder> |
| 97 | + <Divider vertical /> |
| 98 | + <SectionPlaceholder>Section 2</SectionPlaceholder> |
| 99 | + </div> |
| 100 | +</Playground> |
| 101 | + |
0 commit comments