Veil UI
Components

Separator

A visual divider between groups of content.

Installation

$ npx veil-ui@latest add separator

Usage

import { Separator } from "@/components/ui/separator";

<Separator />;

Examples

Horizontal

Veil UI

Copy-paste React components.

v0.1.0MIT

Vertical

Docs
Components
Changelog

With label

Or continue with

API reference

PropTypeDefaultDescription
orientation"horizontal" | "vertical""horizontal"Direction of the divider.
decorativebooleantrueHides the separator from assistive technology.

Accessibility

  • Decorative separators are exposed with role="none".
  • Set decorative={false} when the divider carries meaning, for example between two navigation groups. Screen readers then announce it as a separator.

Vue and plain HTML

This component also ships for Vue (Reka UI) and plain HTML. Install it with npx veil-ui add separator --framework vue or switch the framework in components.json.

<script setup lang="ts">
import { Separator } from "reka-ui";
import { computed } from "vue";

import { cn } from "@/lib/utils";

const props = withDefaults(
  defineProps<{
    class?: string;
    orientation?: "horizontal" | "vertical";
    decorative?: boolean;
  }>(),
  { orientation: "horizontal", decorative: true },
);

const classes = computed(() =>
  cn(
    "shrink-0 bg-border",
    "data-[orientation=horizontal]:h-px data-[orientation=horizontal]:w-full",
    "data-[orientation=vertical]:h-full data-[orientation=vertical]:w-px",
    props.class,
  ),
);
</script>

<template>
  <Separator
    data-slot="separator"
    :orientation="orientation"
    :decorative="decorative"
    :class="classes"
  />
</template>

On this page