vael-ui v0.5.7

Layout & structure

Layout

Separator

A thin line, with an optional label, that divides content into groups. Use it between sections, or with a label such as “or” between two choices.

Install

import { Separator } from 'vael-ui'

Playground

LeftRight
Usage
<script setup lang="ts">
import { Separator } from 'vael-ui'
</script>

<template>
  <Separator />
</template>

Props

NameTypeDefaultDescription
orientation'horizontal' | 'vertical''horizontal'Draws a horizontal or vertical line.
uiPartial<Record<'root' | 'line' | 'text', UiPartValue>>Class and style overrides for each part.
motionSeparatorMotionHow it moves: its appearance, like the lines drawing out from a label ({ initial: { line: { scale: '0 1' } } }). false turns its own animation off.

Events

No events.

Slots

NameTypeDescription
defaultanyOptional label centered in the line, e.g. "OR". Plain divider without it.

Exposed

NameTypeDescription
elHTMLElement | nullRoot element.
partsRecord<string, HTMLElement | HTMLElement[] | null>Its elements by part name, for your own animation; a repeated part is an array.

Motion New

Separator's motion: values or hooks for its parts (SeparatorPart). false turns it off.

<Separator
  :motion="{ initial: { root: { opacity: 0, y: 4 } } }"
/>
NameTypeDescription
initialexitrootlinetextSets where each part comes in from and leaves to: any CSS property, plus x, y and blur. A plain number is px, or degrees for rotate.
enterleave(parts, context) => animationAnimates the parts with GSAP, motion or element.animate(). Return the animation and the component waits for it, and stops it if interrupted.
springdurationeasing{ damping, response } | number | stringTimes all of it: a spring, or a duration in ms with an easing. Never both.
falsebooleanTurns its motion off, for an animation of your own on its exposed elements.

Accessibility

It has no keyboard interaction of its own.

  • The root has role="separator", plus aria-orientation="vertical" when vertical. It is not focusable.
  • With a label, the two lines are aria-hidden, and the label names the separator through aria-labelledby.