KTimeline
Vertical display timeline.
Install
bash
pnpm add @ikun-ui/timelinebash
yarn add @ikun-ui/timelinebash
npm install @ikun-ui/timelineBasic usage
Basic timeline.
Color
Set the color of circles.
Last node and Reversing
When the timeline is incomplete and ongoing, put a ghost node at last. Set pending as truthy value to enable displaying pending item. reverse={true} is used for reversing nodes.
Custom render pending content
You can customize the rendering of pending nodes through the pending slot and pendingDot slot.
TIP
- The
pendingDotslot provides style classcls, rendering node itemitemand rendering indexindex - The
pendingslot provides the style classcls, the content of the rendering node itemchildrenand the rendering indexindex
Right alternate
Right alternate timeline.
Alternate
Alternate timeline.
Label
Use label show time alone.
Custom render
You can customize the rendering of pending nodes through the label slot 、dot slot and children slot.
TIP
- The
dotslot provides style classcls, rendering node itemitemand rendering indexindex - The
childrenslot provides the style classcls, the content of the rendering node itemchildrenand the rendering indexindex - The
labelslot provides the style classcls, the content of the rendering node itemlabeland the rendering indexindex
Timeline Props
| Name | Type | Default | Description |
|---|---|---|---|
| mode | left | alternate| left | left | By sending alternate the timeline will distribute the nodes to the left and right. |
| reverse | boolean | false | Whether reverse nodes or not. |
| pending | string | boolean | false | Set the last ghost node's existence or its content. |
| items | KTimelineItem[] | [] | Each node of timeline |
| cls | string | '' | Additional class for component |
| attrs | any | {} | Additional attributes |
typescript
export interface KTimelineItem<L = string, C = string> {
/**
* Set the circle's color
*/
color?: string;
/**
* Customize node position
*/
position?: 'left' | 'right';
/**
* Set the label
*/
label?: L;
/**
* Set the content
*/
children: C;
/**
* Uniquely identifies
*/
uid: string | number;
}Timeline Slots
| Name | Description |
|---|---|
| dot | content of the dot. |
| pendingDot | content of the pending dot. it will only work if pending is true |
| children | content of the content. |
| pending | content of the pending. |
| label | content of the label. |