Skip to content

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.

separator-horizontal.html
<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>

Vertical

Between items in a row. It takes the height of the row.



separator-vertical.html
<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>

With a label

A word in the middle, for choices like signing in with GitHub or with email.

or
separator-label.html
<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>

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:

Terminal
npx @vinish/ui add separator
React
import { Separator } from "@/components/vin/separator";
Vue
import Separator from "@/components/vin/separator.vue";
Svelte
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.

PropValuesDefaultIn HTML
orientationhorizontalverticalhorizontalvin-separator--vertical
decorative
Purely visual: hidden from screen readers.
booleanfalse<div class="vin-separator" aria-hidden="true"> instead of <hr>
label
A word in the middle of the line, like "or".
string—<div class="vin-separator vin-separator--label">or</div>

Parts

React, Vue, SvelteHTML 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.