Separator
updatedA line that separates content, horizontal or vertical, with an optional label.
kappa-ui
Vue components you copy into your project.
Open Props in the corner of the example to try size.
size sets the thickness, from 1px for xs, the default, to 5px for xl.
Installation
Usage
<script setup lang="ts">
import { Separator } from '@/components/ui/separator'
</script>
<template>
<Separator />
<Separator orientation="vertical" />
<Separator label="or" />
</template>
Separator is Reka UI's separator with kappa-ui's styles. It is a --border line across the full width, or with orientation="vertical" the full height of its parent, so a vertical one sits in a row with a set height, such as h-5 or a stretching flex item.
As in shadcn, the separator is decorative by default: it gets role="none" and screen readers skip it. When it divides content that a reader should know is divided, set :decorative="false"; it then gets role="separator" and, when vertical, aria-orientation.
Examples
Label
label, or the default slot for richer content, puts text in the middle of the line. A vertical separator keeps the text upright between its two halves.
API Reference
class is also accepted and merged over the base classes.
Separator
| Prop | Default | Type and description |
|---|---|---|
| orientation | "horizontal" | DataOrientation
|
| decorative | true | booleanHides the separator from assistive technology with |
| asChild | — | booleanRender the single child instead of a wrapper, merging the separator's attributes and classes onto it. |
| as | — | AsTag | ComponentThe element or component to render. |
| label | — | stringText shown in the middle of the line. |
| size | "xs" | SeparatorSizeThickness, from 1px for |
| Slot | Scope and description |
|---|---|
| default | {}Content for the label, in place of |
Props
- orientation
"horizontal" DataOrientationhorizontalspans the width of its parent,verticalits height.- decorative
true booleanHides the separator from assistive technology withrole="none". On by default; turn it off when the separation carries meaning.- asChild
booleanRender the single child instead of a wrapper, merging the separator's attributes and classes onto it.- as
AsTag | ComponentThe element or component to render.- label
stringText shown in the middle of the line.- size
"xs" SeparatorSizeThickness, from 1px forxsto 5px forxl.
Slots
- default
{}Content for the label, in place oflabel.
CSS variables
| Variable | Default | Description |
|---|---|---|
| --separator-size | 1px | The line's thickness, set by size. Set it in class, as in [--separator-size:0.5px], for a thickness outside the scale. |
Data attributes
| data-slot | Attributes | Description |
|---|---|---|
| separator | data-orientation, data-size | The separator. Without a label it is the line itself. data-size is xs when left out. |
| separator-line | — | One of the two lines on either side of a label. |
| separator-label | — | The label between the lines. |