Skip to content
Pebble Pro is here at $49 one timeSee what’s included ↗
Pebble
ComponentsDocsMCPPricing
⌕ Find a component↗Log in
All components 673

Categories

Core inputs & forms46Buttons & actions33Navigation36Overlays & feedback49Data display33Charts & data viz40Cards & layout43Marketing blocks38App shells & pages37AI interfaces40Text & typography effects33Backgrounds & visual effects38Motion & transitions32Numbers & counters32Media34E-commerce333D & interactive36Themed sets40
Start with the essentials.Installation guide ↗Connect your agent ↗
← All componentsCards & layout

Separator

A thin horizontal or vertical divider line, decorative by default.

Preview

Harbour allotments

24 plots
9 members
3 new
Today
  • Priya approved the soil report

    14:20
  • Malik uploaded 38 photos to North ridge

    11:05
Yesterday
  • Ines opened plot C-11 for planting

    16:48

Order #4821

03 Nov
  • Compost, 40 L$18.00
  • Seed potatoes, 2 kg$7.40
  • Twine$3.25
Member discount−$2.87
Total$25.78
Paid by card

Install

Add the editable source with the shadcn CLI. Your project also needs the shared theme tokens this component uses. Setup and requirements. The Pebble installer is not published yet.

npx shadcn@latest add https://pebbleui.com/r/separator.json

Props

PropTypeDefaultDescription
orientation"horizontal" | "vertical""horizontal"Direction of the line.
variant"solid" | "dashed""solid"Solid hairline, or dashed for a soft break.
labelReactNode-Text set in a gap in the middle of a horizontal line, e.g. "Today" or "or". Ignored when vertical.
decorativebooleantruetrue renders role=none; false renders role=separator for assistive tech.
classNamestring-Wins over the defaults.
Build notes
Built on the Radix Separator primitive, which handles the role switch and
`data-orientation`. The line is a background-filled box (`bg-border`), sized
by `data-[orientation=horizontal]:h-px w-full` or
`data-[orientation=vertical]:w-px self-stretch`. Vertical uses `self-stretch`
instead of the source's `h-full`, so it fills a flex row's cross axis without
the parent needing an explicit height. `shrink-0` stops flex layouts from
squeezing it away. In forced-colors mode author backgrounds are dropped, so
the line is painted with `CanvasText`.

**Pebble (2026-11-03).** Two optional props. `variant="dashed"` paints the
line with a `repeating-linear-gradient` of `var(--color-border)` (4 px on,
4 px off) along the orientation's axis, so it stays a 1 px box with no border
tricks. `label` (horizontal only) turns the root into a `flex items-center
gap-3` row whose two halves are `before:`/`after:` pseudo-elements and whose
only child is the `separator-label` span in `text-xs font-medium
text-muted-foreground`; the label stays readable by assistive tech even when
the separator is decorative, and the root carries `data-labelled`. A label on
a vertical separator is ignored. The demo groups a feed by day with labelled
separators, splits inline meta with vertical ones and uses dashed rules on a
receipt.

<!-- PEBBLE-LICENSE -->
View source

registry/layout/separator/separator.tsx

"use client";

/* PEBBLE-LICENSE
Built by Pebble. Component: separator.

First-party license: MIT

The following first-party terms apply only to original Pebble material.

MIT License

Copyright (c) 2026 Praxys Solutions LLC (Pebble)

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

THIRD-PARTY NOTICES
These notices apply to identified upstream portions; Pebble terms do not replace or narrow their rights.

Upstream: https://raw.githubusercontent.com/shadcn-ui/ui/main/LICENSE.md
MIT License

Copyright (c) 2023 shadcn

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
END PEBBLE-LICENSE */

import * as React from "react";
import { Separator as SeparatorPrimitive } from "radix-ui";

import { cn } from "@/lib/utils";

// Pebble: a divider is a hairline in the border token. `dashed` marks a soft
// break (subtotal rules, "draft below here"); a label sits in a gap in the
// line, in 12 px muted text.
const lines = {
  solid: "bg-border",
  dashed:
    "data-[orientation=horizontal]:bg-[repeating-linear-gradient(to_right,var(--color-border)_0_4px,transparent_4px_8px)] data-[orientation=vertical]:bg-[repeating-linear-gradient(to_bottom,var(--color-border)_0_4px,transparent_4px_8px)]",
} as const;

export type SeparatorProps = React.ComponentProps<typeof SeparatorPrimitive.Root> & {
  variant?: keyof typeof lines;
  /** Text shown in a gap in the middle of a horizontal line ("Today", "or"). */
  label?: React.ReactNode;
};

/** False for values React renders as nothing: null, booleans, "", empty arrays. */
function isRenderableLabel(label: React.ReactNode): boolean {
  if (label == null || typeof label === "boolean" || label === "") return false;
  if (Array.isArray(label)) return label.some(isRenderableLabel);
  return true;
}

export function Separator({
  orientation = "horizontal",
  decorative = true,
  variant = "solid",
  label,
  className,
  ...props
}: SeparatorProps) {
  const labelId = React.useId();
  // Booleans, `""` and empty arrays render nothing, so they count as no label.
  if (isRenderableLabel(label) && orientation === "horizontal") {
    // The two line halves are pseudo-elements, so the label is the only
    // content and stays readable by assistive tech when decorative. A
    // semantic separator's children are presentational, so it names itself
    // from the label instead.
    const half = cn(
      "before:h-px before:flex-1 before:content-[''] after:h-px after:flex-1 after:content-['']",
      variant === "solid"
        ? "before:bg-border after:bg-border"
        : "before:bg-[repeating-linear-gradient(to_right,var(--color-border)_0_4px,transparent_4px_8px)] after:bg-[repeating-linear-gradient(to_right,var(--color-border)_0_4px,transparent_4px_8px)]",
      "forced-colors:before:bg-[CanvasText] forced-colors:after:bg-[CanvasText]",
    );
    return (
      <SeparatorPrimitive.Root
        data-slot="separator"
        data-variant={variant}
        data-labelled=""
        orientation={orientation}
        decorative={decorative}
        // A consumer's own `aria-label` wins; their `aria-labelledby` wins via `props`.
        aria-labelledby={decorative || props["aria-label"] != null ? undefined : labelId}
        className={cn(
          "flex w-full shrink-0 items-center gap-3 text-xs font-medium text-muted-foreground",
          half,
          className,
        )}
        {...props}
      >
        <span id={labelId} data-slot="separator-label" className="shrink-0">
          {label}
        </span>
      </SeparatorPrimitive.Root>
    );
  }
  return (
    <SeparatorPrimitive.Root
      data-slot="separator"
      data-variant={variant}
      orientation={orientation}
      decorative={decorative}
      className={cn(
        "shrink-0",
        lines[variant],
        "data-[orientation=horizontal]:h-px data-[orientation=horizontal]:w-full",
        "data-[orientation=vertical]:w-px data-[orientation=vertical]:self-stretch",
        // Forced colors drop author backgrounds; paint the line with text colour.
        "forced-colors:bg-[CanvasText]",
        className,
      )}
      {...props}
    />
  );
}
Pebble

Small details.
Better interfaces.

React components to explore, make your own, and build on.

Library

  • Components
  • Installation
  • Pricing

Resources

  • For agents
  • About
  • Support

Legal

  • License
  • Terms
  • Privacy
  • Final sale

Built by Pebble

A product of Praxys Solutions LLC ↗

Pebble Pro is live

$49 one time, lifetime updates ↗