Separator

Visually or semantically separates content.

Horizontal
shadcn/ui
The Foundation for your Design System
A set of beautifully designed components that you can customize, extend, and build on.
Vertical
Blog
Docs
Source
Vertical Menu
Settings Manage preferences
Account Profile & security
Help Support & docs
In List
Item 1
Value 1
Item 2
Value 2
Item 3
Value 3

Installation

Install the dependencies

pnpm add cn class-variance-authority github:sveltery/base

Copy the component

Copy the following files into src/lib/components/ui/separator.

src/lib/components/ui/separator/Separator.svelte
<script lang="ts">
  import { Separator as Primitive } from '@sveltery/base/separator';
  import { cn } from 'cn';
  import type { SeparatorProps } from './types.js';
  let { orientation = 'horizontal', class: classProp, ...props }: SeparatorProps = $props();
  const className = $derived(cn('shrink-0 bg-border data-horizontal:h-px data-horizontal:w-full data-vertical:w-px data-vertical:self-stretch', classProp));
</script>
<Primitive data-slot="separator" {orientation} class={className} {...props} />
src/lib/components/ui/separator/types.ts
export type { SeparatorProps, SeparatorState } from '@sveltery/base/separator';
src/lib/components/ui/separator/index.ts
export { default as Separator } from './Separator.svelte';
export type { SeparatorProps, SeparatorState } from './types.js';

Update the import paths

Change the imports to match your project setup.

Usage

<script lang="ts">
  import { Separator } from '$lib/components/ui/separator';
</script>
<Separator />

API reference

Separator is styled on top of the Sveltery Base Separator primitive, which owns its behavior, focus handling and accessibility. See the Base UI Separator documentation for the behavior it ports.