Timeline
vig-timeline
import { Timeline, TimelineContent } from '@vigdx/ui/timeline';Basic
items and an ng-template vigTimelineContent ; bind the same items to vigTimelineContentOf so let-event is typed. The context also has index , first , last and side . Put dates in <time datetime> elements.
Ordered
· Payment received.
Processing
· Packed at the warehouse.
Shipped
· Handed to the carrier.
Delivered
· Left at the front door.
Alignment and opposite content
align puts the content after the axis ( end , default), before it ( start ) or on alternating sides ( alternate ); sides are logical, so RTL mirrors them. A vigTimelineOpposite template fills the other side, e.g. with the date. The timeline measures its own width: below 32rem a two-sided timeline collapses to one side, the opposite content above the content. Being a size container, it fills its parent's width ( w-full ) instead of growing with its content: give it a width inside a flex row or an inline-block.
Ordered
Payment received.
Processing
Packed at the warehouse.
Shipped
Handed to the carrier.
Delivered
Left at the front door.
Horizontal
orientation="horizontal" shares the width between the events; the sides line up across events (a CSS subgrid). Below 32rem it turns vertical, so it never scrolls sideways.
Ordered
Processing
Shipped
Delivered
Custom markers
vigTimelineMarker template replaces the default dot, e.g. with an icon; it is centered on the axis, a track --vig-timeline-marker-size wide (1.5em; set it to your markers' width so wide ones do not crowd the content), and kept visible to screen readers, so give a marker that carries meaning a text alternative.
Ordered
Payment received.
Processing
Packed at the warehouse.
Shipped
Handed to the carrier.
Delivered
Left at the front door.
Styling hooks
Internal elements carry a stable data-part and the component's data-scope; both are public API, so removing one is a breaking change. Select a part by both, e.g. [data-scope="timeline"][data-part="root"] { … }: the pair stays within this component when kit components nest, and also reaches parts in overlay panels, which render outside the host. State is exposed through aria-* and, where listed, a data-state; literal values are checked by the API gate, values computed from the component's state follow its documented types. Other data-* attributes listed below (such as data-opening while an overlay animates) are API too. See Customizing.
Scope: [data-scope="timeline"]
| Part | Element | data-state |
|---|---|---|
root | <ol role="list"> . | — |
item | <li> event. | — |
opposite | vigTimelineOpposite content, across the axis. | — |
separator | — | |
marker | vigTimelineMarker . | — |
connector | — | |
content | vigTimelineContent content. | — |
Accessibility
- An ordered list: screen readers announce the number of events and each one's position. Opposite content comes first in each item, then the content, whatever side they are drawn on.
- The default dot and the connectors are decorative and hidden from screen readers. They are borders in theme tokens (
--color-primary,--color-border-strong), which forced-colors mode paints in CanvasText. - The timeline has no keyboard behaviour of its own; links and buttons in the content are reached with Tab.
API
Timeline
vig-timelineEvents in order along an axis, each with a marker and a content template, and optionally opposite content such as its date.
Example :<vig-timeline [items]="events">
<ng-template vigTimelineContent [vigTimelineContentOf]="events" let-event>
<h3>{{ event.title }}</h3>
</ng-template>
<ng-template vigTimelineOpposite [vigTimelineOppositeOf]="events" let-event>
<time [attr.datetime]="event.iso">{{ event.date }}</time>
</ng-template>
</vig-timeline>An ordered list (<ol>): screen readers announce the count and each
event's position. Markers and connectors are drawn with borders in theme
tokens, which forced-colors mode repaints in system colors. Sides are
logical, so the timeline mirrors under RTL. The timeline is a size
container: below 32rem of its own width, two-sided layouts (alternate,
or opposite content) collapse to one side with the opposite content above
the content, and a horizontal timeline turns vertical. As a size
container it does not size to its content: it fills the width of its
parent (w-full), so give it a width in a shrink-to-fit parent (a flex
row, an inline-block). The axis is --vig-timeline-marker-size wide
(1.5em), so markers of any width stay centered on one line; set it to the
width of custom markers.
| Name | Type | Default | Description |
|---|---|---|---|
align | TimelineAlign | 'end' | Side of the axis the content takes: |
items | readonly T[] | [] | The events, in order. |
orientation | TimelineOrientation | 'vertical' |
|
TimelineContent
ng-template[vigTimelineContent]Content of each event of vig-timeline. Bind the items to
vigTimelineContentOf to type let-event:
<ng-template vigTimelineContent [vigTimelineContentOf]="events" let-event>
{{ event.title }}
</ng-template>| Name | Type | Default | Description |
|---|---|---|---|
vigTimelineContentOf | readonly T[] | null | undefined | undefined | Type-only: the items the template renders, so |
TimelineOpposite
ng-template[vigTimelineOpposite]Content on the other side of the axis, such as the date of each event.
Bind the items to vigTimelineOppositeOf to type let-event.
| Name | Type | Default | Description |
|---|---|---|---|
vigTimelineOppositeOf | readonly T[] | null | undefined | undefined | Type-only: the items the template renders, so |
TimelineMarker
ng-template[vigTimelineMarker]Custom marker on the axis (an icon, an avatar) in place of the default
dot. Bind the items to vigTimelineMarkerOf to type let-event.
| Name | Type | Default | Description |
|---|---|---|---|
vigTimelineMarkerOf | readonly T[] | null | undefined | undefined | Type-only: the items the template renders, so |