# Separator

> A thin line between content; for dividing the sections of a page, a card or a toolbar.

Source: https://shadleaf.dev/1.2.0/components/separator/

A thin horizontal or vertical line between pieces of content.

**Example: Separator.**

```html
<sl:separator/>
```

## When to use

- Between the sections of a page, a card or a panel.
- Between groups of buttons or links in a toolbar or a header (vertical).

Use something else for:

- Between the items of a list: the [item separator](https://shadleaf.dev/1.2.0/components/item.md#group).
- Between the groups of a menu or a select: the separator part of that component.

## Vertical

`orientation="vertical"` draws a vertical line that stretches to the height of the row it is in. Put it in a flex
container, such as a toolbar or a row of links.

**Example: Vertical.** A vertical separator stretches to the height of the flex row it is in.

```html
<sl:button as="a" href="/blog" variant="link">Blog</sl:button>
<sl:separator orientation="vertical"/>
<sl:button as="a" href="/docs" variant="link">Docs</sl:button>
<sl:separator orientation="vertical"/>
<sl:button as="a" href="/source" variant="link">Source</sl:button>
```

## Decorative or announced

A separator is decorative by default: it only draws a line and is hidden from assistive technology
(`role="none"`). When the line divides the content into groups a screen reader user should know about, write
`decorative="false"`. It is then announced as a separator (`role="separator"`, with `aria-orientation` when
vertical).

**Example: Announced.** decorative="false" makes it a separator for assistive technology too.

```html
<sl:separator decorative="false"/>
```

## Attributes

Attributes of `<sl:separator>`: A thin line between content. A vertical one stretches to the height of the row it is in, so it needs a flex container.

| Attribute | Values | Default | Description |
| --- | --- | --- | --- |
| `orientation` | `horizontal`, `vertical` | `horizontal` | Direction of the line. |
| `decorative` | *boolean* | `true` | Hide the line from assistive technology, as most separators only draw a line. With `decorative="false"` it is announced as a separator, for one that divides content into groups. |

Every prop can also be set from an expression: `th:orientation="${...}"`. Any other attribute passes through to the rendered element, and `class` is appended.

## Styling hooks

The classes and attributes your own CSS can select to restyle the component, as explained in
[your own CSS rules](https://shadleaf.dev/1.2.0/guides/adjustability.md#5-your-own-css-rules).

Styling hooks of `<sl:separator>`.

**Parts**

| Class | Element |
| --- | --- |
| `.separator` | `<div>` |

**Props**

| Prop | Selector | Values |
| --- | --- | --- |
| `orientation` | `.separator[data-orientation="…"]`, `.separator:not([data-orientation])` | `vertical`; `horizontal` (default) |
