Timeline

Records with start and end dates, as bars on a schedule.

Roadmap
◆ Beta
PRJ-1Saved views for every layout
Saved views for every layout
PRJ-2SAML sign-in
SAML sign-in
PRJ-3Bulk edit in the grid
Bulk edit in the grid
PRJ-4Triage suggestions
Triage suggestions
PRJ-5Webhook retries
Webhook retries
PRJ-6Offline mode for mobile
No dates · Schedule

Installation

pnpm dlx shadcn@latest add checkfu/uicontext/timeline

Usage

import { type Item, type Property, Value } from "./ui/uicontext/components/kit/Property.ts"import { Timeline } from "./ui/uicontext/components/kit/Timeline.ts"
const Message = UiSchema.TaggedEnum({	RequestedEditProject: { request: Schema.String, item: Schema.String, key: Schema.String, value: Value },	RequestedRange: { from: Schema.String, to: Schema.String },})export const ProjectTimeline = (	h: Html.H<typeof Message.Type>,	projects: ReadonlyArray<Item>,	fields: ReadonlyArray<Property>,	range: { readonly from: string; readonly to: string },) =>	Timeline(h, {		props: { label: "Projects", records: projects, fields, view: { start: "start", end: "target" }, ...range, controls: true },		onEmit: {			RequestedEdit: (edit) => Message.RequestedEditProject(edit),			RequestedRange: (next) => Message.RequestedRange(next),			RequestedScale: () => undefined,			RequestedOpen: () => undefined,			RequestedCreate: () => undefined,			RequestedAction: () => undefined,			RequestedReorder: () => undefined,			RequestedView: () => undefined,			Selected: () => undefined,		},	})

API reference

Props

Timeline props
NameTypeDefaultDescription
labelrequiredstring—The view's accessible name, such as the collection's
agentIdstring—The id agents know this view by; the label by default
recordsrequiredItem[]—The records to show, in the order the app gives them
fieldsrequiredProperty[]—The fields the records share: their kinds, choices and formats
viewViewInput—How the records show: start and end are the date fields a bar runs between (the first and second date fields by default), with filter, sort and hidden
colorBystring—A select or person field whose glyph marks the bar's start ("status")
barstring[]—Fields shown on each bar after its title, compactly (an assignee's avatar, a rating)
fromrequiredstring—The first and last day shown, as ISO dates
torequiredstring—The last day the timeline shows, as an ISO date
scale"day" | "week" | "month"weekThe width of one column: a day, a week or a month; week by default
todaystring—Today, as an ISO date: a line marks it
milestonesTimelineMilestone[]—Dated markers drawn across every row, such as a release
dependenciesTimelineDependency[]—Lines between bars; one that's violated (to starts on or before from ends) is red
readOnlystring—Why nothing can be edited; set, every value shows read-only with this reason
outcomesOutcome[]—How each requested change settled: pending, accepted, or refused with a reason
localestring—The locale numbers and dates are formatted in; the browser's by default
controlsbooleantrueDraw Previous, Today, Next and the scale above the timeline; true by default. Previous and Next ask for the range before or after with RequestedRange, the scale with RequestedScale

Events

Timeline events
EventPayloadDescription
RequestedEdit{ request: string; item: string; key: string; value: Value }A value the person changed; answer through outcomes with the same request
RequestedOpen{ item: string }Open the record's page
RequestedCreate{ group?: string; title?: string; values?: Record<string, Value> }A new record, in the group it was added from ("" for the empty group)
RequestedAction{ action: string; items: string[] }One of the view's actions, on these records
RequestedReorder{ item: string; before: string | null }Move item before before, or last when it's null
RequestedView{ view: View }The person changed how the view shows records (its sort, grouping, widths); pass it back as view
Selected{ items: string[] }The selection changed
RequestedRange{ from: string; to: string }Asks to show other days, as ISO dates: Previous, Next, or Today when today is outside the range
RequestedScale{ scale: Scale }Asks for another column width: a day, a week or a month

Agent actions

What agents can do with Timeline
ActionDescription
MovedBarSet a bar's start and end, as ISO dates (YYYY-MM-DD); start on or before end
ActivatedBarOpen a row's item

Accessibility

  • Each bar is focusable and says its dates and what blocks it. A locked bar says why when it has focus or is tapped.

Source