Timeline
Events or steps along a line, top to bottom or side by side, for activity feeds, progress trackers and numbered steps.
- Order placed
- Packed
- Out for delivery
- Delivered
Usage
1 component covers an activity feed, a progress tracker and a list of steps. The parts:
Timeline- the ordered list.orientationlays the items top to bottom or side by side,sizescales them, andnumberednumbers the steps.TimelineItem- 1 event or step. Itsstatus(complete,current,pendingorerror) drives the indicator and the line after it. Leave it out for the events of an activity feed.TimelineIndicator- the marker on the line, and the line to the next item. Left empty, it draws a dot, a number, a check or a cross to match the status. Put an icon, anAvataror aSpinnerin it to replace them.TimelineContent- everything beside the marker: the text, and anything else the item needs, such as a button.TimelineTitle,TimelineDescriptionandTimelineTime- the title, a muted detail, and a<time>element.
The items are spaced evenly, whatever their dates. For a schedule or a Gantt chart, where position follows time, build a time grid instead.
Examples
Activity feed
Icons and avatars go inside the indicator, and variant tints it by the kind of event. A flex row puts the time on the end side of the title.
Progress
A status on each item turns the list into a tracker. A complete step fills the line to the next one, the current step gets a ring and aria-current="step", and pending steps stay muted.
Numbered steps
numbered puts the step number in each empty indicator, and a complete step swaps its number for a check. The content can hold the action for the current step.
Horizontal
orientation="horizontal" lays the items side by side. When they don't fit, the row scrolls with its scrollbar hidden, fades the edge that has more to show, and keeps the current step in view. Narrow your window to see it.
Stepper
Move the statuses along as the user goes through a flow: the line fills toward the next step and its check draws in. The timeline only shows the steps, so the flow's state and its buttons stay in your code.
Clickable steps
Render a title as a <button> with render, and give it before:absolute before:inset-0 so the whole item takes the click. Steps the user hasn't reached stay disabled, and each finished step shows the choice made there in its description. Wrap the list in a <nav> when the steps move the user around a flow.
Errors and running steps
status="error" draws a cross. For a step that's still running, put a Spinner in its indicator and size it with a text-* class.
Grouped by day
Give each day a heading and its own Timeline, and name the list with the heading through aria-labelledby.
RTL
Every Appica UI component supports right-to-left layouts out of the box. Set the dir attribute on a container (commonly your <html> element) so CSS logical properties resolve correctly, and wrap your tree in DirectionProvider so direction-aware behavior follows the same direction.
The markers move to the right edge, a horizontal timeline runs from right to left, and its lines fill in the reading direction. For setup details and caveats, see the RTL guide.
- تم الطلب
- تم التغليف
- تم الشحن
- خرج للتوصيل
- تم التسليم
API reference
Each part forwards every remaining prop to its element (ol, li, span, div, time). The tables below list the Appica additions and the most common props.
Timeline
The ordered list. Renders an <ol>.
The list exposes data-orientation. A horizontal list that overflows also exposes data-overflowing, plus data-overflow-start and data-overflow-end while there's more to scroll toward that edge.
TimelineItem
1 event or step. Renders an <li>.
The item exposes data-status.
TimelineIndicator
The marker, and the line to the next item. Renders a <span> for the marker inside a rail that holds the line.
The marker is 24px at the default size. Set --timeline-marker on the Timeline for a larger avatar, e.g. className="[--timeline-marker:--spacing(10)]". The line is data-slot="timeline-connector", so **:data-[slot=timeline-connector]:hidden on the list removes it.
TimelineContent
Everything beside the marker. Renders a <div>.
TimelineTitle
The item's title. Renders a <div>.
TimelineDescription
A muted detail under the title. Renders a <div>, so it can hold other blocks.
TimelineTime
When the event happened, or how long the step took. Renders a <time>.
Accessibility
Timelinerenders an ordered list, so screen readers announce how many items there are and where each one sits. Name it witharia-label, or witharia-labelledbypointing at a heading.- The current step carries
aria-current="step". - Indicators and lines are decorative and hidden from assistive tech. When a status matters, say it in the title or the description too ("Delivered", "Failed").
- Give
TimelineTimeadateTime, so the time is machine-readable. - A horizontal timeline that overflows becomes a focusable scroll region: Tab to it, then scroll with the arrow keys. It leaves the tab order again once everything fits, and drops its edge fades while focused so the focus ring stays whole.
- With reduced motion, the line fill, the check and the color changes switch without animating, and the jump to the current step is instant.