vael-ui v0.5.7

Data display

Layout

Timeline

An ordered list of steps joined by a line, where each step can hold any content. Use it for a history, an order’s progress or a changelog.

Install

import { Timeline } from 'vael-ui'

Playground

  1. Mon

    Design

  2. Tue

    Build

  3. Wed

    Review

  4. Thu

    Ship

import { Timeline } from 'vael-ui'

<Timeline
  :items="steps"
  orientation="vertical"
  :motion="true"
  :current="current"
>
  <template #opposite="{ item }">{{ item.date }}</template>
  <template #item="{ item }">{{ item.label }}</template>
</Timeline>

Props

NameTypeDefaultDescription
itemsRequiredreadonly T[]Entries to show; any shape, rendered through the #item slot.
orientation'horizontal' | 'vertical''vertical'Lays the entries out in a row or a column.
motionTimelineMotiontruefalse turns off the connector fill and items coming and going. An object animates items your way: values for item or a step's own parts (marker, connector, previousConnector, content, opposite), stagger, or enter / leave hooks that get them all.
pulsebooleanfalseAdds a looping pulse ring to the active marker.
itemKey((item: T, index: number) => string | number)(item, index) => indexStable key for each item. Pass it when items can be reordered or removed.
completed((item: T, index: number) => boolean)Whether an item is done, which fills its dot and connector. Takes priority over current.
active((item: T, index: number) => boolean)Whether an item is the current one, which rings its marker (and pulses it with pulse). Independent of completed; takes priority over current.
currentnumberIndex of the current item: earlier items read as completed, this one as active. Not a v-model; Timeline never changes it. completed/active override it when given.
uiPartial<Record<'root' | 'item' | 'opposite' | 'marker' | 'connector' | 'content', UiPartValue>>Class and style overrides for each part.

Events

No events.

Slots

NameTypeDescription
opposite{ item: T; index: number; completed: boolean; active: boolean; }Content on the other side of the line from #item, such as a date. Without it, Timeline reserves no column.
marker{ item: T; index: number; completed: boolean; active: boolean; }Custom marker content, replacing the default dot.
item{ item: T; index: number; completed: boolean; active: boolean; isLast: boolean; }Content for each item; defaults to the item itself as text.

Exposed

NameTypeDescription
elHTMLElement | nullRoot element.
stepElsHTMLElement[] | nullItem (<li>) elements, in order.
markerElsHTMLElement[] | nullMarker elements, in order.
connectorElsHTMLElement[] | nullConnector elements, one fewer than items (the last item has none).

Motion New

Timeline's steps: values or hooks for item and its parts (connector is missing on the last step, previousConnector on the first, opposite without the slot), stagger and leaving.

<Timeline
  :motion="{ initial: { item: { opacity: 0, y: 8 } }, stagger: 0.04 }"
/>
NameTypeDescription
initialexititemmarkerconnectorpreviousConnectorcontentoppositeSets 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.
staggerleavingappearnumber | 'pop' | 'hold' | booleanItems coming in together start stagger seconds apart. A leaving item lifts out so the rest close the gap ('pop'), or keeps its space until it's gone ('hold'). appear: true also brings in the items already there when it mounts.
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.

  • Timeline renders an <ol> with one <li> per item, so screen readers announce a list and its length.
  • The marker, including your #marker slot, and the connector are aria-hidden.
  • active sets aria-current="step" on its item. completed sets only a data- attribute, so put that state in the item text when it matters.
  • A timeline that overflows with nothing focusable inside becomes a Tab stop, so you can scroll it with the keyboard.