Keyboard shortcut: Ctrl + K
Get started

Separator

VSeparator renders a horizontal or vertical rule without margins.

Usage

vue

<script setup lang="ts">
import { VSeparator } from 'vectis-ui'
</script>

<template>
  <VSeparator />
</template>

Examples

Orientation

Vertical separators stretch in flex or grid layouts. In normal flow, set their height explicitly.

vue

Project settings


Who can open this project, and what they may change.

Draft
Edited 2 days ago
3 comments

In ordinary flow, a height has to be given: here 3rem.

<script setup lang="ts">
import { VSeparator, VTypography } from 'vectis-ui'
</script>

<template>
  <div class="stack">
    <div class="card">
      <VTypography variant="heading-4">Project settings</VTypography>
      <VSeparator />
      <VTypography variant="body-sm" tone="muted">
        Who can open this project, and what they may change.
      </VTypography>
    </div>

    <div class="meta">
      <VTypography as="span" variant="body-sm">Draft</VTypography>
      <VSeparator orientation="vertical" />
      <VTypography as="span" variant="body-sm">Edited 2 days ago</VTypography>
      <VSeparator orientation="vertical" />
      <VTypography as="span" variant="body-sm">3 comments</VTypography>
    </div>

    <!-- Outside flex or grid layouts, vertical separators need an explicit height. -->
    <div class="flow">
      <VSeparator orientation="vertical" class="standing" />
      <VTypography variant="body-sm" tone="muted">
        In ordinary flow, a height has to be given: here 3rem.
      </VTypography>
    </div>
  </div>
</template>

<style scoped>
.stack {
  display: grid;
  gap: var(--vectis-space-6);
  max-inline-size: 30rem;
}
.card {
  display: grid;
  gap: var(--vectis-space-3);
  padding: var(--vectis-space-4);
  border: 1px solid var(--vectis-color-border);
  border-radius: var(--vectis-radius-surface);
}
.meta {
  display: flex;
  align-items: center;
  gap: var(--vectis-space-3);
}
.flow {
  display: flex;
  align-items: center;
  gap: var(--vectis-space-3);
}
.standing {
  block-size: 3rem;
}
</style>

Label and icon

Set label, icon or the default slot, and place them with contentPosition. The label also becomes the separator’s accessible name.

vue
<script setup lang="ts">
import { VSeparator } from 'vectis-ui'
import { star } from 'vectis-ui/icons'
</script>

<template>
  <div class="stack">
    <VSeparator label="or" />
    <VSeparator :icon="star" content-position="start" />
    <VSeparator :icon="star" label="Featured" content-position="end" />
  </div>
</template>

<style scoped>
.stack {
  display: grid;
  gap: var(--vectis-space-6);
  max-inline-size: 22rem;
}
</style>

Variants, size and colour

variant strokes the rule solid, dashed or dotted, and size sets its thickness. color paints the strokes only; the label keeps the muted text colour.

vue




<script setup lang="ts">
import { VSeparator } from 'vectis-ui'
</script>

<template>
  <div class="stack">
    <VSeparator />
    <VSeparator variant="dashed" />
    <VSeparator variant="dotted" size="md" />
    <VSeparator size="lg" color="oklch(0.6 0.2 260)" />
    <VSeparator variant="dashed" size="md" color="oklch(0.6 0.2 260)" label="End of list" />
  </div>
</template>

<style scoped>
.stack {
  display: grid;
  gap: var(--vectis-space-6);
  max-inline-size: 22rem;
}
</style>

API

Props

PropTypeDefault
orientationSeparatorOrientation'horizontal' | 'vertical''horizontal'
Horizontal or vertical rule. A vertical rule needs a height or a flex/grid layout that stretches it.
variantSeparatorVariant'solid' | 'dashed' | 'dotted''solid'
How the rule is stroked: solid, dashed or dotted.
sizeSeparatorSize'sm' | 'md' | 'lg''sm'
The thickness of the rule: 1px, 2px or 4px. A thicker rule marks a stronger break and makes dots legible.
colorstringnone
A CSS colour for the rule. The label and icon keep the muted text colour.
labelstringnone
Visible text breaking the rule, also used as the accessible name.
iconIconSourcenone
An icon breaking the rule, before the label.
contentPositionSeparatorContentPosition'start' | 'center' | 'end''center'
Where the label and icon sit along the rule.

Slots

SlotType
default{}
Rich content breaking the rule, in place of the label. Name it with aria-label when its words matter.

Types

Types used in the API tables. Import exported types from vectis-ui.

export interface BuiltinIcon {
  name: string
  paths: readonly [string] | readonly [string, string]
}
export type IconRender =
  | { path: string; viewBox?: string }
  | { component: Component; props?: Record<string, unknown> }
  | { src: string }
  | { text: string; class?: string }
  | { class: string }
export type IconSource = string | BuiltinIcon | IconRender

CSS variables

TokenValue
--vectis-control-size-separator-sm1px
--vectis-control-size-separator-md2px
--vectis-control-size-separator-lg4px