Separator
A separator draws a thin line between groups of content, such as the sections of a card or a menu.
When to use
Section titled “When to use”- Use it between groups that belong together but read separately, such as the profile and the stats of an artist card.
- Prefer spacing first; add a line only when spacing alone doesn’t show the groups.
- Use
verticalbetween items in a row, such as toolbar buttons.
Rara Senandika
Penyanyi pop, Bandung
3 rilis · 12.480 pendengar bulanan
Rara Senandika
Penyanyi pop, Bandung
3 rilis · 12.480 pendengar bulanan
Anatomy
Section titled “Anatomy”- 1Horizontal separator
- 2Vertical separator
A 1px line on border, horizontal by default.
Variants
Section titled “Variants”| Orientation | Use it for |
|---|---|
horizontal (default) |
Between stacked groups. |
vertical |
Between items in a row. |
| React | Vue | Flutter | Type | Default | Use |
|---|---|---|---|---|---|
orientation |
orientation |
ShadSeparator.horizontal / .vertical |
text | horizontal |
The direction of the line. |
always role="separator" |
decorative |
not announced | boolean | true in Vue |
Whether screen readers hear it. |
import { Separator } from "@/components/ui/separator"
export default function SeparatorDemo() { return ( <div className="w-full max-w-xs rounded-lg border border-border bg-card p-4 text-sm"> <p className="font-medium">Rara Senandika</p> <p className="text-muted-foreground">Penyanyi pop, Bandung</p> <Separator className="my-3" /> <p className="text-muted-foreground">3 rilis · 12.480 pendengar bulanan</p> </div> )}<script setup lang="ts">import { Separator } from "@/components/ui/separator"</script>
<template> <div class="w-full max-w-xs rounded-lg border border-border bg-card p-4 text-sm"> <p class="font-medium">Rara Senandika</p> <p class="text-muted-foreground">Penyanyi pop, Bandung</p> <Separator :decorative="false" class="my-3" /> <p class="text-muted-foreground">3 rilis · 12.480 pendengar bulanan</p> </div></template>import 'package:flutter/widgets.dart';import 'package:shadcn_ui/shadcn_ui.dart';
class SeparatorDemo extends StatelessWidget { const SeparatorDemo({super.key});
@override Widget build(BuildContext context) { final theme = ShadTheme.of(context); return SizedBox( width: 320, child: ShadCard( child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ Text('Rara Senandika', style: theme.textTheme.small), Text('Penyanyi pop, Bandung', style: theme.textTheme.muted), const ShadSeparator.horizontal(margin: EdgeInsets.symmetric(vertical: 12)), Text('3 rilis · 12.480 pendengar bulanan', style: theme.textTheme.muted), ], ), ), ); }}Install
Section titled “Install”npx shadcn@latest add https://design.sosialoka.tech/r/react/separator.jsonnpx shadcn-vue@latest add https://design.sosialoka.tech/r/vue/separator.jsonAccessibility
Section titled “Accessibility”- A separator between real sections has
role="separator"; a line that is only decoration is hidden from screen readers (decorativein Vue). - It never takes the focus.
