Skip to content

Separator

Visual divider for separating content sections. Supports horizontal and vertical orientation with an optional centered label.

import { Separator } from "phoundry-ui";

Basic Horizontal

Loading interactive example…

View source
basic-horizontal.svelte
<script lang="ts">
import { Separator } from "phoundry-ui";
</script>
<div class="space-y-3">
<p class="text-xs text-txt-secondary">Content above</p>
<Separator />
<p class="text-xs text-txt-secondary">Content below</p>
</div>

With Label

Loading interactive example…

View source
with-label.svelte
<script lang="ts">
import { Separator } from "phoundry-ui";
</script>
<div class="space-y-3">
<p class="text-xs text-txt-secondary">Content above</p>
<Separator label="Or continue with" />
<p class="text-xs text-txt-secondary">Content below</p>
</div>

Vertical

Loading interactive example…

View source
vertical.svelte
<script lang="ts">
import { Separator } from "phoundry-ui";
</script>
<div class="flex h-8 items-center gap-4">
<span class="text-xs text-txt-secondary">Home</span>
<Separator orientation="vertical" />
<span class="text-xs text-txt-secondary">Settings</span>
<Separator orientation="vertical" />
<span class="text-xs text-txt-secondary">Profile</span>
</div>

Center snippet (children)

Loading interactive example…

View source
center-snippet-children.svelte
<script lang="ts">
import { Separator } from "phoundry-ui";
import { Badge } from "phoundry-ui";
</script>
<p class="mb-2 text-xs text-txt-secondary">
Use <code>children</code> when the center needs richer markup than a plain
string <code>label</code>.
</p>
<Separator>
{#snippet children()}
<Badge size="xs">Beta</Badge>
{/snippet}
</Separator>

API

From phoundry-ui@0.4.21

NameTypeDefaultDescription
orientation"horizontal" | "vertical"'horizontal'Direction of the divider.
labelstring—Centered text label shown on the divider line.
childrenSnippet<[]>—Custom content to display in the center instead of a label.
classClassValue—Additional CSS classes.
stylestring—Inline styles on the stable component root.

Usage tips

  • Use the label prop for “or” dividers in forms (e.g. “Or continue with”).
  • Vertical separators need a parent with explicit height and display: flex.
  • Pass a children snippet for custom center content (icons, badges, etc.).

Styling

.ph-separator is the stable root hook. Consumer class values are additive, and style applies to that root. Styling uses vanilla CSS with semantic state attributes. The root always emits data-orientation and data-has-label, and uses the matching aria-orientation for separator semantics. Its one-pixel rule, vertical stretching, centered label, and snippet precedence are unchanged. Internal part selectors and --_ph-* properties remain implementation details.

Documentation is licensed under CC BY 4.0. Phoundry names and marks remain reserved.