Skip to content
satin

Activity timeline

Pro

A record’s history: who changed what and when, agent changes with Revert, runs folded into one row.

TMTara Mendes
Product designer · Expected €8–10k
Interview
Loading

    Installation

    Terminal
    npm i @uisatin/ui @uisatin/pro
    Import
    import '@uisatin/ui/styles.css'
    import '@uisatin/pro/styles.css'
    import { ActivityTimeline, type ActivityItem } from '@uisatin/pro/activity-timeline'

    Part of Satin Pro, the licensed edition: @uisatin/pro on top of @uisatin/ui at the same version, its stylesheet after Free's. Satin Pro isn't on npm yet.

    About 4.5 kB of JavaScript, minified and gzipped, on top of the @uisatin/uicomponents it uses (React aside).

    First time with Satin? Set it up once, styles and fonts included, with the installation guide.

    API Reference

    The ActivityTimeline component (Satin Pro, @uisatin/pro/activity-timeline) is a div with an ordered list under each day's name ("Today", "Yesterday", a date), newest first; screen readers know it as a group named "Activity". Each item is { id, actor: { name, kind, avatar }, verb, target, changes, at, revertible, label, reverted }; changes takes AgentSuggestionChange[] and draws them as AgentSuggestion does. Runs of collapseRuns entries by one actor fold into one row ("Agent made 4 changes"); expanded holds the open runs by any entry id. onRevert may return a promise: the button spins until it settles, then the entry shows "Reverted by you" and a toast offers Undo (onUndoRevert), so the app needs a <Toaster />. Parts: ActivityTimelineRoot, ActivityTimelineDay, ActivityTimelineList, ActivityTimelineEntry, ActivityTimelineRun, ActivityTimelineTime.

    PropTypeDefault
    items
    ActivityItem[]
    —
    groupBy
    "day""none"
    "day"
    collapseRuns
    numberfalse
    3
    onRevert
    (item: ActivityItem) => unknown
    —
    onUndoRevert
    (item: ActivityItem) => unknown
    —
    expanded
    string[]
    —
    defaultExpanded
    string[]
    []
    onExpandedChange
    (expanded: string[]) => void
    —
    loading
    boolean
    false
    empty
    ReactNode
    "No activity yet"

    Accessibility

    The timeline is a group named "Activity" (activity in SatinLabels), since it has no visible heading; pass aria-labelledby when a heading of yours names it. Each day is an ordered list named after the day ("Today"); without days it is one list. Times are <time> elements whose text for screen readers is the full date and time, not "5 min ago". A folded run is a button with aria-expanded and aria-controls, named by its summary ("Agent made 4 changes"). Revert is named after the change ("Revert salary range change", from the entry's label), or after the entry's sentence without one; while it runs the entry is aria-busy. Once reverted, focus moves to the entry, which says "Reverted by you", and the toast with Undo is read out like any toast. Avatars and the rail are hidden from screen readers: the sentence names the actor. New entries are not announced; when they arrive live, say so from your own status region.

    KeyAction
    TabMoves through the run buttons and Revert buttons, newest first.
    EnterorSpaceOn a run: opens or folds its entries. On Revert: reverts the change.
    F8Moves to the toast after a revert, to reach Undo (the Toaster's hotkey).