生态产品多个设计器现已发布候选版本

查看生态总览
Skip to content

Timeline ​

Data display component. This page is the API reference, generated from the source code. Usage guidance and live examples are on the Chinese page.

Anatomy ​

Parts in bold are required.

data-scope="timeline": root · item · label · indicator · connector · content · title · description · time

API reference ​

Descriptions of individual props, events and slots are written in Chinese and appear on the Chinese page.

Artifacts ​

LayerValue
Custom element<xh-timeline>
Vue componentsXhTimelineConnector XhTimelineContent XhTimelineDescription XhTimelineIndicator XhTimelineItem XhTimelineLabel XhTimelineRoot XhTimelineTime XhTimelineTitle
State machineNone: connect computes attributes from props directly
Skin@xihan-ui/styles/timeline.css

Props ​

PropTypeRequired
orientationOrientation
placementTimelinePlacement
sizeSize

React adapter props ​

Only the props each component declares itself: DOM attributes inherited from ComponentPropsWithRef are left out, and root props already listed in the Props table are not repeated. The Vue counterpart is the slot table above.

React componentPropTypeRequired
XhTimelineItemtoneTone

connect API ​

getXxxProps() returns the host attributes of the matching part.

MemberType
getRootProps() => T['element']
getItemProps() => T['element']
getLabelProps() => T['element']
getIndicatorProps(props: TimelineItemProps) => T['element']
getConnectorProps() => T['element']
getContentProps() => T['element']
getTitleProps() => T['element']
getDescriptionProps() => T['element']
getTimeProps() => T['element']

Accessibility ​

Keyboard ​

Specification: W3C APG. Each row is a stable behavior id that the conformance tests cover; the conditions and effects are described on the Chinese page.

No keyboard interaction: the component takes no focus, or focus behavior comes entirely from native elements.

ARIA ​

These attributes are produced by connect.

PartAttributeValue
rootrole'list'
itemrole'listitem'
indicatoraria-hidden'true'
connectoraria-hidden'true'

Style reference ​

Skin ​

@xihan-ui/styles/timeline.css is written against [data-scope="timeline"][data-part="root"] part selectors; the published build uses the mount class .xh-scope-timeline in place of data-scope (same specificity) and sits in the xihan.components layer. Put overrides in xihan.overrides; the part selectors work as usual.

Data attributes ​

Produced by connect; valueless attributes are omitted while their condition does not hold.

PartAttributeValue
rootdata-orientationprops.orientation
rootdata-placementprops.placement
rootdata-sizeprops.size
itemdata-orientationprops.orientation
itemdata-placementprops.placement
labeldata-orientationprops.orientation
labeldata-placementprops.placement
indicatordata-toneitem.tone
connectordata-orientationprops.orientation

CSS variables ​

The public override slots, generated from what the standalone skin actually consumes.

VariablePartCSS propertyStateDefault from
--xh-timeline-connector-bgconnectorbackgrounddefault--xh-border-default
--xh-timeline-connector-min-lengthconnector
item
min-block-size
min-inline-size
@media (min-width: 768px)
default
has(> [data-scope='timeline'][data-part='label'])
orientation=horizontal
--xh-space-4
--xh-timeline-connector-radiusconnectorborder-radiusdefault--xh-shape-pill
--xh-timeline-connector-thicknessconnector
item
block-size
inline-size
@media (min-width: 768px)
default
has(> [data-scope='timeline'][data-part='label'])
orientation=horizontal
--xh-stroke-thin
--xh-timeline-content-gapcontentgapdefault--xh-space-1
--xh-timeline-content-pbcontent
item
padding-block-end@media (min-width: 768px)
nth-child(even)
orientation=horizontal
placement=alternate
placement=start
--xh-space-4
--xh-timeline-content-ptcontent
item
padding-block-start@media (min-width: 768px)
has(> [data-scope='timeline'][data-part='label'])
orientation=horizontal
--xh-space-4
--xh-timeline-description-fgdescriptioncolordefault--xh-fg-muted
--xh-timeline-description-font-sizedescriptionfont-sizedefault--xh-text-secondary-size
--xh-timeline-fgrootcolordefault--xh-fg-default
--xh-timeline-gutteritemcolumn-gapdefault--xh-_timeline-gutter
--xh-timeline-indicator-bgindicatorbackgrounddefault--xh-_tone-soft
--xh-timeline-indicator-fgindicatorcolordefault--xh-_tone-on
--xh-timeline-indicator-font-sizeindicatorfont-sizedefault--xh-_timeline-caption-font-size
--xh-timeline-indicator-radiusindicatorborder-radiusdefault--xh-shape-circle
--xh-timeline-indicator-sizeindicator
item
block-size
inline-size
margin-block-start
default--xh-_timeline-dot-size
--xh-timeline-item-gapcontent
item
padding-block-end
padding-inline-end
@media (min-width: 768px)
default
has(> [data-scope='timeline'][data-part='label'])
orientation=horizontal
--xh-_timeline-item-gap
--xh-timeline-label-fglabelcolordefault--xh-fg-subtle
--xh-timeline-label-font-sizelabelfont-sizedefault--xh-_timeline-caption-font-size
--xh-timeline-time-fgtimecolordefault--xh-fg-subtle
--xh-timeline-time-font-sizetimefont-sizedefault--xh-_timeline-caption-font-size
--xh-timeline-title-fgtitlecolordefault--xh-fg-default
--xh-timeline-title-font-sizeindicator
item
label
root
title
font-size
line-height
margin-block-start
default--xh-_timeline-title-font-size
--xh-timeline-title-font-weighttitlefont-weightdefault--xh-text-label-weight

Released under The MIT License