Separator
Neo-brutalist visual separator supporting horizontal and vertical orientations.
Demo
水平分隔线
上方内容
下方内容
垂直分隔线
变体
尺寸
文字分隔线
Installation
pnpm dlx brutx-vue@latest add separatorUsage
<script setup>
import { Separator } from 'brutx-ui-vue'
</script>
<template>
<div>
<p class="text-sm font-medium">Content above</p>
<Separator />
<p class="text-sm font-medium">Content below</p>
</div>
</template>Orientation
Horizontal (default):
<template>
<Separator orientation="horizontal" />
</template>Vertical:
<template>
<div class="flex h-8 items-center gap-4">
<span class="text-sm font-bold">Item 1</span>
<Separator orientation="vertical" />
<span class="text-sm font-bold">Item 2</span>
</div>
</template>Separator with Text
When orientation="horizontal" and the default slot has content, the Separator renders as a centered text separator: separators on both sides with the slot content in the middle.
<template>
<Separator>Section Title</Separator>
</template>Text separators also support variant and size:
<template>
<Separator variant="primary" size="lg">Primary Title</Separator>
</template>Note: In text separator mode, the
classattribute is applied to the separators on both sides rather than the outer container. This is consistent with the behavior in normal mode whereclassis applied to the separator element.
Variants
| Variant | Description |
|---|---|
default | Foreground color (bg-brutal-fg) |
primary | Primary color (bg-brutal-primary) |
muted | Muted color (bg-brutal-muted) |
<template>
<div class="space-y-2">
<Separator variant="default" />
<Separator variant="primary" />
<Separator variant="muted" />
</div>
</template>Sizes
| Size | Thickness |
|---|---|
sm | 2px |
default | var(--brutal-border-width, 3px) |
lg | 5px |
<template>
<div class="space-y-2">
<Separator size="sm" />
<Separator size="default" />
<Separator size="lg" />
</div>
</template>API Reference
| Name | Type | Default | Description |
|---|---|---|---|
variant | "default" | "muted" | "primary" | undefined | "default" | Selects the separator color style. |
DetailsDeclared typeNonNullable<"default" | "primary" | "muted" | null | undefined> | undefined Literal values
Default value details
Sourcepackages/ui/src/components/separator/Separator.vue | |||
size | "default" | "lg" | "sm" | undefined | "default" | Controls the preset thickness of the separator line. |
DetailsDeclared typeNonNullable<"default" | "lg" | "sm" | null | undefined> | undefined Literal values
Default value details
Sourcepackages/ui/src/components/separator/Separator.vue | |||
orientation | "horizontal" | "vertical" | undefined | "horizontal" | Selects horizontal or vertical orientation; text content is centered between line segments only horizontally. |
DetailsDeclared typeNonNullable<"vertical" | "horizontal" | null | undefined> | undefined Literal values
Default value details
Sourcepackages/ui/src/components/separator/Separator.vue | |||
decorative | boolean | undefined | true | When decorative, the element has no separator semantics; when false, it receives role="separator" and orientation semantics. |
DetailsDeclared typeboolean | undefined Literal values
Default value details
Sourcepackages/ui/src/components/separator/Separator.vue | |||
class | string | undefined | undefined | CSS classes added to the native separator or to the text-separator line segments. |
DetailsDeclared typestring | undefined Default value details
Sourcepackages/ui/src/components/separator/Separator.vue | |||
| Name | Signature or type | Description |
|---|---|---|
#default | {} | Optional separator content. When horizontal and non-empty, it appears between line segments; otherwise it is passed to the underlying Reka UI separator primitive. |
DetailsDeclared type{}Sourcepackages/ui/src/components/separator/Separator.vue | ||
Accessibility
- ARIA Attributes: When
decorativeistrue, no semantic role is set; whenfalse,role="separator"is automatically set