Separator
A line between pieces of content.
Plain HTML
<script setup lang="ts">
import { Separator } from '@/components/ui/separator';
</script>
<template>
<div>
<p>An open-source UI library.</p>
<Separator style="margin-block: var(--dui-space-4)" />
<div class="row">
<span>Blog</span>
<Separator orientation="vertical" />
<span>Docs</span>
<Separator orientation="vertical" />
<span>Source</span>
</div>
</div>
</template>
<style scoped>
p {
margin: 0;
color: var(--dui-color-muted-foreground);
font-size: var(--dui-text-sm);
}
.row {
display: flex;
align-items: center;
gap: var(--dui-space-2);
height: 1.25rem;
font-size: var(--dui-text-sm);
}
</style>
Installation
npx distill-ui add separator- Set up the tokens once, if you haven't: see manual installation.
- Copy these files into your project:
<script setup lang="ts">
const { orientation = 'horizontal', decorative = true } = defineProps<{
orientation?: 'horizontal' | 'vertical';
/** Purely visual by default. Set to false when the line separates meaningful sections. */
decorative?: boolean;
}>();
</script>
<template>
<div
class="separator"
:role="decorative ? 'none' : 'separator'"
:aria-orientation="decorative ? undefined : orientation"
:data-orientation="orientation"
></div>
</template>
<!--
Options you can set from a parent or on the separator itself:
--dui-separator-color
-->
<style scoped>
.separator {
flex-shrink: 0;
background: var(--dui-separator-color, var(--dui-color-border));
&[data-orientation='horizontal'] {
width: 100%;
height: 1px;
}
&[data-orientation='vertical'] {
width: 1px;
align-self: stretch;
}
}
</style>
export { default as Root, default as Separator } from './Separator.vue';
Customizing
Set any of these on the component or on a parent element. See Customizing for how they work.
| Custom property | Default |
|---|---|
--dui-separator-color | var(--dui-color-border) |