Skip to content

Separator

Neo-brutalist visual separator supporting horizontal and vertical orientations.

Demo

Preview

水平分隔线

上方内容

下方内容

垂直分隔线

左侧
中间
右侧

变体

尺寸

文字分隔线

章节标题
主色标题

Installation

pnpm dlx brutx-vue@latest add separator

Usage

vue
<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):

vue
<template>
    <Separator orientation="horizontal" />
</template>

Vertical:

vue
<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.

vue
<template>
    <Separator>Section Title</Separator>
</template>

Text separators also support variant and size:

vue
<template>
    <Separator variant="primary" size="lg">Primary Title</Separator>
</template>

Note: In text separator mode, the class attribute is applied to the separators on both sides rather than the outer container. This is consistent with the behavior in normal mode where class is applied to the separator element.

Variants

VariantDescription
defaultForeground color (bg-brutal-fg)
primaryPrimary color (bg-brutal-primary)
mutedMuted color (bg-brutal-muted)
vue
<template>
    <div class="space-y-2">
        <Separator variant="default" />
        <Separator variant="primary" />
        <Separator variant="muted" />
    </div>
</template>

Sizes

SizeThickness
sm2px
defaultvar(--brutal-border-width, 3px)
lg5px
vue
<template>
    <div class="space-y-2">
        <Separator size="sm" />
        <Separator size="default" />
        <Separator size="lg" />
    </div>
</template>

Props

PropTypeDefaultDescription
variant'default' | 'primary' | 'muted''default'Color variant
size'sm' | 'default' | 'lg''default'Controls thickness
orientation'horizontal' | 'vertical''horizontal'Orientation
decorativebooleantrueWhether it is decorative (no semantic role)
classstringCustom style class

Slots

SlotScopeDescription
defaultText separator content; only renders as a centered text separator when orientation="horizontal" and the slot has content

Accessibility

  • ARIA Attributes: When decorative is true, no semantic role is set; when false, role="separator" is automatically set

Brute force builds.