Separator
A hairline between groups, decorative or announced.
Studio plan Five seats, shared drafts
Source
<script lang="ts">
import 'portal-bits/styles.css';
import 'portal-bits/tokens.css';
import type { Snippet } from 'svelte';
let { children }: { children: Snippet } = $props();
</script>
{@render children()}
<script lang="ts">
import SeparatorExample from './SeparatorExample.svelte';
</script>
<SeparatorExample orientation={"horizontal"} />
<script lang="ts">
import { Separator } from 'portal-bits';
let { orientation = 'horizontal' }: { orientation?: 'horizontal' | 'vertical' } = $props();
</script>
<div class="card" data-orientation={orientation}>
<div>
<strong>Studio plan</strong>
<span>Five seats, shared drafts</span>
</div>
<Separator {orientation} />
<nav aria-label="Plan links">
<a href="#billing">Billing</a>
<Separator orientation="vertical" />
<a href="#seats">Seats</a>
<Separator orientation="vertical" />
<a href="#history">History</a>
</nav>
</div>
<style>
.card {
display: grid;
gap: 16px;
width: 360px;
max-width: 100%;
font-size: 14px;
}
.card[data-orientation='vertical'] {
display: flex;
align-items: center;
width: auto;
}
div > div {
display: grid;
gap: 2px;
}
strong {
font-weight: 500;
}
span {
color: var(--portal-muted);
}
nav {
display: flex;
align-items: center;
gap: 12px;
height: 20px;
}
a {
color: inherit;
}
</style>
API reference
These tables list the props and snippets that Separator declares. Attributes passed through to an element or primitive are listed under Forwarded attributes, not here.
Props
| Name | Type | Default | Required | Binding | Description |
|---|---|---|---|---|---|
orientation | 'horizontal' | 'vertical' | horizontal | No | One-way | Direction of the hairline. |
decorative | boolean | true | No | One-way | Hides the line from assistive technology. Set it to false when the line separates content. |
class | string | "" | No | One-way | Extra classes, added after the component classes. |
Forwarded attributes
None. Separator forwards no attributes.
The primitive underneath is a Bits UI peer dependency. Its own options are documented in the Bits UI Separator documentation. Only the props listed on this page are part of the Separator contract. No data attributes are documented as stable.
Limits
- A vertical separator needs a parent with a height, such as a flex row.
- It uses the hairline token. The 1px line is an adaptation of the measured borders.