Raccourci clavier : Ctrl + K
Commencer

Séparateur

VSeparator affiche un trait horizontal ou vertical sans marges.

Utilisation

vue

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

<template>
  <VSeparator />
</template>

Exemples

Orientation

Les séparateurs verticaux s’étirent dans les dispositions flex ou grid. Dans le flux normal, définissez leur hauteur.

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>

Libellé et icône

Renseignez label, icon ou le slot par défaut, et placez-les avec contentPosition. Le libellé devient aussi le nom accessible du séparateur.

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>

Variantes, taille et couleur

variant trace le trait plein, en tirets ou en pointillés, et size règle son épaisseur. color ne colore que le trait ; le libellé garde la couleur de texte atténuée.

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

PropTypeDéfaut
orientationSeparatorOrientation'horizontal' | 'vertical''horizontal'
Trait horizontal ou vertical. Un trait vertical nécessite une hauteur ou une disposition flex/grid qui l’étire.
variantSeparatorVariant'solid' | 'dashed' | 'dotted''solid'
Tracé du trait : plein, en tirets ou en pointillés.
sizeSeparatorSize'sm' | 'md' | 'lg''sm'
L’épaisseur du trait : 1px, 2px ou 4px. Un trait plus épais marque une rupture plus forte et rend les pointillés lisibles.
colorstringaucune
Une couleur CSS pour le trait. Le libellé et l’icône gardent la couleur de texte atténuée.
labelstringaucune
Texte visible qui interrompt le trait, utilisé aussi comme nom accessible.
iconIconSourceaucune
Une icône qui interrompt le trait, avant le libellé.
contentPositionSeparatorContentPosition'start' | 'center' | 'end''center'
Position du libellé et de l’icône le long du trait.

Slots

SlotType
default{}
Contenu riche qui interrompt le trait, à la place du libellé. Nommez-le avec aria-label quand ses mots comptent.

Types

Types utilisés dans les tables d’API. Importez les types exportés depuis 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

Variables CSS

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