Components
Timeline
An ordered sequence of events with status icons and connectors.
Installation
$ npx veil-ui@latest add timelineUsage
import { Timeline } from "@/components/ui/timeline";
<Timeline
items={[
{ title: "Order placed", time: "09:12" },
{ title: "Out for delivery", time: "Tomorrow" },
]}
/>;Examples
Basic
Order placed
We received your order and reserved the items.
Preparing shipment
Your package is being packed.
Out for delivery
Simple
- 1
Draft created
- 2
Review requested
- 3
Published
API reference
The package exports timeline along with its composable parts. It forwards standard attributes to its root element; see the examples above for the component-specific props.
Accessibility
- Content uses semantic HTML — lists are lists, tables are tables and metadata uses a definition list.
- Interactive elements are real buttons or links with visible focus states.
- Images require meaningful
alttext; icons used decoratively arearia-hidden.
Vue and plain HTML
This component also ships for Vue (Reka UI) and plain HTML. Install it with npx veil-ui add timeline --framework vue or switch the framework in components.json.
<script setup lang="ts">
import { cn } from "@/lib/utils";
import type { TimelineItem } from "./types";
const props = defineProps<{
items: TimelineItem[];
class?: string;
}>();
const statusClass: Record<NonNullable<TimelineItem["status"]>, string> = {
default: "bg-primary text-primary-foreground",
success: "bg-emerald-600 text-white",
warning: "bg-amber-500 text-white",
destructive: "bg-red-600 text-white",
};
</script>
<template>
<ol data-slot="timeline" :class="cn('relative grid gap-6', props.class)">
<li v-for="(item, index) in items" :key="index" class="relative flex gap-4">
<div class="flex flex-col items-center">
<span
:class="
cn(
'flex size-7 shrink-0 items-center justify-center rounded-full text-xs font-medium',
statusClass[item.status ?? 'default'],
)
"
>
<component
:is="item.icon"
v-if="item.icon"
class="size-3.5"
aria-hidden="true"
/>
<template v-else>{{ index + 1 }}</template>
</span>
<span
v-if="index !== items.length - 1"
class="mt-1 w-px flex-1 bg-border"
aria-hidden="true"
/>
</div>
<div class="pb-2">
<div class="flex flex-wrap items-baseline gap-x-2">
<h3 class="text-sm font-medium">{{ item.title }}</h3>
<time v-if="item.time" class="text-xs text-muted-foreground">
{{ item.time }}
</time>
</div>
<p v-if="item.description" class="mt-1 text-sm text-muted-foreground">
{{ item.description }}
</p>
</div>
</li>
</ol>
</template>