Separator
A thin line that separates content, across or up and down. Same markup and props in every style: switch the style in the header to see it change.
Horizontal
Between the parts of a card. A separator inside a card runs edge to edge.
VinUI
Components in eight styles.
Copy the HTML or the React version. Both read the same theme.
<div class="vin-card" style="width: 100%; max-width: 340px">
<div class="vin-card__header">
<h3 class="vin-card__title">VinUI</h3>
<p class="vin-card__desc">Components in eight styles.</p>
</div>
<hr class="vin-separator">
<div class="vin-card__body">
<p>Copy the HTML or the React version. Both read the same theme.</p>
</div>
</div>VinUI
Components in eight styles.
Copy the HTML or the React version. Both read the same theme.
import { Card, CardHeader, CardTitle, CardDescription, CardBody } from "@/components/vin/card";
import { Separator } from "@/components/vin/separator";
export function SeparatorHorizontal() {
return (
<Card style={{ width: "100%", maxWidth: 340 }}>
<CardHeader>
<CardTitle>VinUI</CardTitle>
<CardDescription>Components in eight styles.</CardDescription>
</CardHeader>
<Separator />
<CardBody>
<p>Copy the HTML or the React version. Both read the same theme.</p>
</CardBody>
</Card>
);
}The Vue version renders the same markup as the HTML tab, so it looks and works the same.
<script setup lang="ts">
import Card, { CardHeader, CardTitle, CardDescription, CardBody } from "@/components/vin/card.vue";
import Separator from "@/components/vin/separator.vue";
</script>
<template>
<Card style="width: 100%; max-width: 340px">
<CardHeader>
<CardTitle>VinUI</CardTitle>
<CardDescription>Components in eight styles.</CardDescription>
</CardHeader>
<Separator />
<CardBody>
<p>Copy the HTML or the React version. Both read the same theme.</p>
</CardBody>
</Card>
</template>The Svelte version renders the same markup as the HTML tab, so it looks and works the same.
<script lang="ts">
import Card from "$lib/components/vin/card.svelte";
import CardHeader from "$lib/components/vin/card-header.svelte";
import CardTitle from "$lib/components/vin/card-title.svelte";
import CardDescription from "$lib/components/vin/card-description.svelte";
import CardBody from "$lib/components/vin/card-body.svelte";
import Separator from "$lib/components/vin/separator.svelte";
</script>
<Card style="width: 100%; max-width: 340px">
<CardHeader>
<CardTitle>VinUI</CardTitle>
<CardDescription>Components in eight styles.</CardDescription>
</CardHeader>
<Separator />
<CardBody>
<p>Copy the HTML or the Svelte version. Both read the same theme.</p>
</CardBody>
</Card>Vertical
Between items in a row. It takes the height of the row.
<div style="display: flex; align-items: center; gap: 4px">
<button type="button" class="vin-btn vin-btn--ghost vin-btn--sm">Docs</button>
<hr class="vin-separator vin-separator--vertical" aria-orientation="vertical">
<button type="button" class="vin-btn vin-btn--ghost vin-btn--sm">Components</button>
<hr class="vin-separator vin-separator--vertical" aria-orientation="vertical">
<button type="button" class="vin-btn vin-btn--ghost vin-btn--sm">Blog</button>
</div>import { Button } from "@/components/vin/button";
import { Separator } from "@/components/vin/separator";
export function SeparatorVertical() {
return (
<div style={{ display: "flex", alignItems: "center", gap: 4 }}>
<Button variant="ghost" size="sm">Docs</Button>
<Separator orientation="vertical" />
<Button variant="ghost" size="sm">Components</Button>
<Separator orientation="vertical" />
<Button variant="ghost" size="sm">Blog</Button>
</div>
);
}The Vue version renders the same markup as the HTML tab, so it looks and works the same.
<script setup lang="ts">
import Button from "@/components/vin/button.vue";
import Separator from "@/components/vin/separator.vue";
</script>
<template>
<div style="display: flex; align-items: center; gap: 4px">
<Button variant="ghost" size="sm">Docs</Button>
<Separator orientation="vertical" />
<Button variant="ghost" size="sm">Components</Button>
<Separator orientation="vertical" />
<Button variant="ghost" size="sm">Blog</Button>
</div>
</template>The Svelte version renders the same markup as the HTML tab, so it looks and works the same.
<script lang="ts">
import Button from "$lib/components/vin/button.svelte";
import Separator from "$lib/components/vin/separator.svelte";
</script>
<div style="display: flex; align-items: center; gap: 4px">
<Button variant="ghost" size="sm">Docs</Button>
<Separator orientation="vertical" />
<Button variant="ghost" size="sm">Components</Button>
<Separator orientation="vertical" />
<Button variant="ghost" size="sm">Blog</Button>
</div>With a label
A word in the middle, for choices like signing in with GitHub or with email.
<div style="display: grid; gap: 16px; width: 100%; max-width: 320px">
<button type="button" class="vin-btn vin-btn--outline">Continue with GitHub</button>
<div class="vin-separator vin-separator--label">or</div>
<div class="vin-field">
<label class="vin-label" for="sep-email">Email</label>
<input id="sep-email" class="vin-input" type="email" placeholder="you@example.com">
</div>
<button type="button" class="vin-btn">Continue with email</button>
</div>import { Button } from "@/components/vin/button";
import { Field } from "@/components/vin/input";
import { Separator } from "@/components/vin/separator";
export function SeparatorLabel() {
return (
<div style={{ display: "grid", gap: 16, width: "100%", maxWidth: 320 }}>
<Button variant="outline">Continue with GitHub</Button>
<Separator label="or" />
<Field label="Email" type="email" placeholder="you@example.com" />
<Button>Continue with email</Button>
</div>
);
}The Vue version renders the same markup as the HTML tab, so it looks and works the same.
<script setup lang="ts">
import Button from "@/components/vin/button.vue";
import Separator from "@/components/vin/separator.vue";
import Field from "@/components/vin/input.vue";
</script>
<template>
<div style="display: grid; gap: 16px; width: 100%; max-width: 320px">
<Button variant="outline">Continue with GitHub</Button>
<Separator label="or" />
<Field label="Email" type="email" placeholder="you@example.com" />
<Button>Continue with email</Button>
</div>
</template>The Svelte version renders the same markup as the HTML tab, so it looks and works the same.
<script lang="ts">
import Button from "$lib/components/vin/button.svelte";
import Field from "$lib/components/vin/input-field.svelte";
import Separator from "$lib/components/vin/separator.svelte";
</script>
<div style="display: grid; gap: 16px; width: 100%; max-width: 320px">
<Button variant="outline">Continue with GitHub</Button>
<Separator label="or" />
<Field label="Email" type="email" placeholder="you@example.com" />
<Button>Continue with email</Button>
</div>Installation
React, Vue and Svelte: add the component to your project with the CLI. It reads your framework from vin.json and also copies any component this one needs. Then import it:
npx @vinish/ui add separatorimport { Separator } from "@/components/vin/separator";import Separator from "@/components/vin/separator.vue";import Separator from "$lib/components/vin/separator.svelte";The import paths assume the default folders: @/components/vin (React and Vue, with the usual @ → src alias) and $lib/components/vin (SvelteKit). Use your own if you chose another folder in init. How the Vue and Svelte versions pass values and content is in Frameworks.
Plain HTML: the classes come with the style's stylesheet. It needs no JavaScript.
API
From spec/separator.json, which every framework version is tested against.
| Prop | Values | Default | In HTML |
|---|---|---|---|
orientation | horizontalvertical | horizontal | vin-separator--vertical |
decorativePurely visual: hidden from screen readers. | boolean | false | <div class="vin-separator" aria-hidden="true"> instead of <hr> |
labelA word in the middle of the line, like "or". | string | — | <div class="vin-separator vin-separator--label">or</div> |
Parts
| React, Vue, Svelte | HTML classes |
|---|---|
<Separator> | .vin-separator.vin-separator--vertical.vin-separator--label |
Accessibility
- An <hr> is a separator to screen readers, and aria-orientation says when it is vertical.
- A separator that is only decoration should be hidden (decorative), so it isn't read between every item.
- The labelled version is plain text between two lines, so the word ("or") is read.
Customize
Saved in this browser. Style and accent are in the header.