FUNSTACK UI

HomeWhyGetting startedConceptsComponentsRoadmap
GitHub

FUNSTACK UI is in beta. Part of the FUNSTACK family with FUNSTACK Router and FUNSTACK Static, which build this site.

Introduction

  • Why FUNSTACK UI
  • Overview
  • Getting started

Concepts

  • Action props
  • Pending & optimistic state
  • Transitions & ViewTransition
  • Suspense
  • Browser-owned state
  • Server Components

Guides

  • Replacing the element (render)
  • Direction and locales
  • Experimental features
  • Next.js App Router
  • React Router framework mode
  • Content Security Policy
  • Using with AI agents

Components

  • Buttons
    • Button
    • Toggle
    • ToggleGroup
    • Toolbar
  • Disclosure
    • Tabs
    • Accordion
    • Collapsible
    • NavigationMenu
  • Overlays
    • Tooltip
    • HoverCard
    • Popover
    • Dialog
    • AlertDialog
    • Drawer
    • Menu
    • Context menu (Menu)
    • Menubar (Menu)
    • Toast
  • Forms
    • Field and Form
    • Checkbox
    • CheckboxGroup
    • RadioGroup
    • Switch
    • Select
    • Combobox
    • MultiSelect
    • Slider
    • NumberField
    • OTPField
    • TextField
  • Output
    • Progress
    • Meter
    • Avatar
  • Layout
    • Separator
    • Scroll areas (recipe)

Resources

  • Roadmap & changelog
  • GitHub ↗

Separator

A line between two pieces of content (WAI-ARIA separator). It has no state, no action and nothing pending: what it adds over a bare <hr> is the vertical case (aria-orientation plus a styling hook), the decorative case (role="none") and a name for your styled layer. It has no "use client", so a Server Component renders it.

Docs
Getting started
Separator

Release notes

Separator is a plain line with a name, an orientation and a decorative mode.


Comments

No comments yet.

Show code
SeparatorLayout.tsx
// No "use client": a Server Component, and Separator runs on the server with it (the part is
// directive-free). A semantic separator between two sections of an article, and decorative
// vertical lines between the links of a breadcrumb, where "separator" would only be noise.
import { Separator } from "@funstack/ui/separator";

export function SeparatorLayout() {
  return (
    <div className="demo-separator-card">
      <nav aria-label="Breadcrumb" className="demo-separator-crumbs">
        <a href="/">Docs</a>
        <Separator orientation="vertical" decorative className="demo-separator" />
        <a href="/getting-started">Getting started</a>
        <Separator orientation="vertical" decorative className="demo-separator" />
        <span aria-current="page">Separator</span>
      </nav>
      <section>
        <h4>Release notes</h4>
        <p>Separator is a plain line with a name, an orientation and a decorative mode.</p>
      </section>
      {/* Semantic: a thematic break that a screen reader announces. */}
      <Separator className={(s) => `demo-separator demo-separator-${s.orientation}`} />
      <section>
        <h4>Comments</h4>
        <p>No comments yet.</p>
      </section>
    </div>
  );
}
separator.css
/* Separator: an <hr> keeps its user-agent margins, border and border-derived height, so the
   recipe resets them and draws the line from data-orientation. */
.demo-separator {
  margin: 0;
  border: 0;
  background: var(--color-border);
  flex: none;
}
.demo-separator[data-orientation="horizontal"] {
  block-size: 1px;
  inline-size: 100%;
}
.demo-separator[data-orientation="vertical"] {
  inline-size: 1px;
  align-self: stretch;
}

.demo-separator-card {
  display: grid;
  gap: 0.75rem;
  inline-size: min(28rem, 100%);
}
.demo-separator-card h4 {
  margin: 0 0 0.25rem;
}
.demo-separator-card p {
  margin: 0;
  color: var(--color-text-secondary);
}

.demo-separator-crumbs {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  font-size: 0.9rem;
}
.demo-separator-crumbs .demo-separator {
  block-size: 1em;
  align-self: center;
  transform: rotate(20deg);
}

This example is a Server Component (no "use client"), and so is Separator: the function className ran on the server.

Async and platform behaviour: Transition types · Optimistic and pending · Suspense · Browser-owned state · Before hydration

Anatomy

import { Separator } from "@funstack/ui/separator";

<article>…</article>
<Separator />                                     {/* hr role="separator" aria-orientation="horizontal" */}
<article>…</article>

<nav aria-label="Breadcrumb">
  <a href="/">Home</a>
  <Separator orientation="vertical" decorative /> {/* hr role="none" data-orientation="vertical" data-decorative */}
  <a href="/docs">Docs</a>
</nav>

One plain component, no parts. It renders <hr>, which is void: there is no children prop. The part writes the role itself (separator, or none while decorative), so a render element of another tag is a separator too.

Props

PropTypeDefaultDescription
orientation"horizontal" | "vertical""horizontal"The direction of the line itself. A vertical separator sits between things laid out in a row. Rendered as aria-orientation (both values) and data-orientation.
decorativebooleanfalseA visual line with no meaning: role="none" and no aria-orientation. Leave it false when the line marks a real break a sighted reader would describe ("the comments start here"); set it for a line that only tidies a row or a list.
classNamestring | ((state: SeparatorState) => string | undefined)–A class name, or a function of the part's state.
styleCSSProperties | ((state: SeparatorState) => CSSProperties | undefined)–Inline style, or a function of the part's state.
renderReactElement | ((props, state: SeparatorState) => ReactNode)–Replace the <hr> (element form) or take over rendering (function form). The part writes the role, so any element is a separator (or, with decorative, none).
State
SeparatorState is { orientation, decorative }, the two props (orientation defaults to "horizontal").
Owned
role in both modes ("separator", or "none" while decorative; either wins over a render element's own), aria-orientation, data-orientation, data-decorative.

Every other <hr> prop passes through, ref included. role="separator" on the default <hr> restates its implicit role: assistive technology reads the same thing, and render={<div />} stays a separator.

Data attributes

AttributeOnMeaning
data-orientationSeparator"horizontal" or "vertical", always (decorative too).
aria-orientationSeparatorThe same value; absent while decorative.
data-decorativeSeparatorPresent while decorative (state.decorative).

Keyboard and ARIA

CaseRenderedAnnounced
defaulthr[role=separator][aria-orientation=horizontal]separator
orientation="vertical"hr[role=separator][aria-orientation=vertical]separator, vertical where the screen reader says so
decorativehr[role=none][data-decorative]nothing
  • Not focusable, no keyboard interaction, in every case.
  • Inside a Menu, a Toolbar or a Select, use Menu.Separator, Toolbar.Separator (it takes the orientation perpendicular to the toolbar's) or Select.Separator.
  • Inside a listbox (Combobox, MultiSelect) a separator is not allowed, but a role="none" element is: <Separator decorative /> between options or groups is valid, a semantic one is not.
  • A line with a word in it ("or") is render={<div>or</div>}. The children of a separator are presentational, so the word is not announced: right for "or", wrong for anything that matters.

Transition types

Concept: Transitions & ViewTransition

None: the separator never changes on its own, and it takes no transition prop.

Optimistic and pending

Concept: Pending & optimistic state

None: no state, no action, nothing pending.

Suspense

Concept: Suspense

Nothing specific: the separator renders no content region.

Browser-owned state

Concept: Browser-owned state

None.

Before hydration

Concept: Server Components

Everything: there is no behaviour. The component is itself a Server Component; rendered by one, it runs once, on the server, function className, style and render included.

Recipes

CSS

The library ships no CSS. An <hr> has user-agent margins, a border and a border-derived height, so reset them:

.separator { margin: 0; border: 0; background: var(--line); flex: none; }
.separator[data-orientation="horizontal"] { block-size: 1px; inline-size: 100%; }
.separator[data-orientation="vertical"]   { inline-size: 1px; align-self: stretch; }

Tailwind: data-[orientation=horizontal]:h-px data-[orientation=vertical]:w-px.

Inside a Toolbar

A standalone Separator does not read the Toolbar's orientation (that would make it a client component). It works there, but stays horizontal unless told otherwise; use Toolbar.Separator.