@simon_he/timeline-ui
v0.1.5
Published
Fixed-layout Vue 3 timeline component for AI agent transcripts. Host-owned content, CSS variable theming, TypeScript.
Maintainers
Readme
Timeline UI renders the stable skeleton of an agent turn: one group header, a vertical rail, rows, disclosure and detail shells. The host supplies every string, icon, panel and state transition.
TimelineGroup
├─ group header icon / summary / chevron
└─ reveal
└─ rail 1px vertical line
└─ TimelineRow icon / label / primary / chevron
└─ details loading | host panel | errorDesign principles
- Fixed group shell, replaceable row skin. The group header, rail and reveal
are fixed. The default row is text/icon based, and a host can replace a whole
row through the
rowslot when its card needs richer content. - No product coupling. No i18n, store, desktop API, MCP, markdown, diff or
data-fetching dependency.
vueis the only peer dependency. - Data in, events out. The host builds the view model, owns detail fetching and controls expansion when it wants to. The library never fetches or mutates host data.
- Small public surface.
TimelineGroupis the only public component. Row and detail primitives are internal implementation details.
Install
pnpm add @simon_he/timeline-ui vue
# or: npm install @simon_he/timeline-ui vueimport { TimelineGroup, type TimelineGroupVM } from '@simon_he/timeline-ui'
import '@simon_he/timeline-ui/style.css'The style import is required. The JavaScript bundle has no CSS side effect
because the library build extracts the stylesheet into style.css.
Quick start
<script setup lang="ts">
import { markRaw } from 'vue'
import { TimelineGroup, type TimelineGroupVM } from '@simon_he/timeline-ui'
import '@simon_he/timeline-ui/style.css'
import BookIcon from './BookIcon.vue'
const group: TimelineGroupVM = {
summary: '1 tool',
items: [
{
id: 'read-1',
kind: 'tool',
status: 'complete',
label: 'Read file',
primary: 'src/App.vue',
icon: markRaw(BookIcon),
detail: {
status: 'loading',
},
},
],
}
</script>
<template>
<TimelineGroup :group="group" :expanded="true" />
</template>A detail starts in loading. When the host panel is ready, replace the whole
detail object with a ready one. Start that transition from detail-toggle.
The shell paints immediately, before the panel is available.
API at a glance
| Prop | Type | Default | Meaning |
| --- | --- | --- | --- |
| group | TimelineGroupVM | required | Complete group view model |
| expanded | boolean \| undefined | undefined | Controlled group state; omit for internal state |
| expandedItemIds | readonly string[] \| undefined | undefined | Controlled open row ids; omit for internal state |
| lazyDetails | boolean | true | Do not mount a detail before its first open |
| keepDetailsMounted | boolean | true | Keep a detail shell mounted after its first open |
| unmountCollapsed | boolean | false | Unmount a large collapsed group's rail after the close transition |
| lazyUnmountThreshold | number | 32 | Item count at which unmountCollapsed starts applying |
| staggerEnter | boolean | false | Stagger newly added rail items with a per-index enter delay, capped at index 8 |
| Event | Payload | Meaning |
| --- | --- | --- |
| update:expanded | (expanded: boolean) | Group header was toggled |
| update:expandedItemIds | (itemIds: string[]) | A row was toggled |
| detail-toggle | (itemId: string, expanded: boolean) | A row toggled; start loading here |
| detail-retry | (itemId: string) | The detail shell retry button was pressed |
| activate | (itemId: string) | An activatable row without details was pressed |
Slots:
summaryreceives{ group: TimelineGroupVM }and renders inside the group header button; it accepts phrasing content only.group-extrareceives{ group }and renders below the header, outside the button. Use it for a collapsed thinking excerpt or similar status line.rowreceives{ item, expanded, toggle, index }and replaces the whole default row, including its header and detail. The host owns that row's content and interactions; calltoggleto request an expansion change.labelandprimaryreceive{ item }and replace the default text inside a default row, for example to add search highlighting.
TimelineItemVM.data is an opaque host payload. The library never reads it;
the row slot is the supported way to turn it into a richer row.
<TimelineGroup :group="group" :expanded="true">
<template #row="{ item, expanded, toggle }">
<HostToolRow
v-if="item.kind === 'tool'"
:data="item.data"
:expanded="expanded"
@toggle="toggle"
/>
<button v-else type="button" @click="toggle">{{ item.label }}</button>
</template>
</TimelineGroup>The package exports TimelineGroup plus its public view-model and event types.
TimelineRow, TimelineDetails, TimelineChevron and the fallback icon are
internal. Deep imports are blocked by the package exports map.
Theming
All public knobs are CSS variables on .timeline-ui.
<TimelineGroup
:group="group"
:style="{
'--timeline-ui-row-padding-y': '7px',
'--timeline-ui-rail-color': '#c7d0da',
}"
/>
<TimelineGroup :group="group" data-tone="dark" />The library CSS is authored in @layer timeline-ui, so unlayered host CSS wins.
Prefer tokens for normal customization. The full token list, dark values and
live controls are in Docs: Theming.
Capping a long group
A group is unbounded: a host may append hundreds of rows to one group. Set
--timeline-ui-group-max-height to keep the rail from pushing the rest of the
page away; the rail then scrolls inside its own container. The default none
keeps the unconstrained layout, and the header, summary and group-extra
content stay outside the scroll area.
<TimelineGroup
:group="group"
:expanded="true"
:style="{ '--timeline-ui-group-max-height': '420px' }"
/>Documentation
The live Docs cover concepts, host boundaries, accessibility, browser support, the full type reference, slots, examples and every token:
Open the Lab to inspect group, row, details and token states live. The Docs and
Lab are deployed from src/playground.
Development
Requires Node 20+ and pnpm 10.
pnpm install
pnpm dev # Lab and Docs at http://localhost:4173
pnpm typecheck # source, tests and configs
pnpm test # Vitest + Vue Test Utils
pnpm build # library -> dist/ (JS, CSS, rolled-up d.ts)
pnpm build:demo # Lab and Docs -> dist-demo/
pnpm preview # preview the demo buildThe Lab uses the public TimelineGroup entry, not a deep internal import. Its
streaming player, stream-diffs panels and markstream-vue markdown are
development dependencies only. They are not exported from the library entry or
included in the published package.
Read CONTRIBUTING.md before opening a PR. Release steps live in RELEASING.md. Report vulnerabilities through SECURITY.md.
License
MIT. Copyright 2026 Simon He. See LICENSE and THIRD_PARTY_NOTICES.md.
The Lab and Docs use Gentleface animated icons (MIT, copyright 2026 Alexander
Kiselev, original designer eric8810) and an original generated DSH big fat
fish anime girl demo image. The deployed demo exposes the full notices at
third-party-notices.html.
