You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
|`items`|[`TimelineItemsProps`](#timelineitemsprops)| Array of timeline items ||
55
+
|`positioning?`|`'alternating' \| 'left' \| 'right'`| How the items should be positioned relative to the timeline |`'alternating'`|
56
+
|`gap?`|`number`| The horizontal gap between timeline items | 50 (`px`) |
57
+
|`offset?`|`{ left?: number; right?: number } \| number`| Offset left or right items from the top (default offset when passing just a `number`: `right`) | 50 (`px`) |
58
+
|`minMarkerGap?`|`number`| The minimum gap markers will have between each other | 50 (`px`) |
59
+
|`defaultPointerOffset?`|`number`| The regular top offset pointers have to their item card | 40 (`px`) |
60
+
|`dateLocal?`|`Local`| Date locale ||
61
+
|`dateFormat?`|`string`| Specific date format according to date-fns [specification](https://date-fns.org/v2.29.3/docs/format). Ignored when passing a `string` as date |`'P'`|
62
+
|`customMarker?`|`ReactElement`| Custom maker element replacing the default ||
63
+
|`customPointer?`|`ReactElement`| Custom pointer element replacing the default ||
64
+
|`styleConfig?`|[`StyleConfig`](#styleconfig)| Style config object for customizing timeline by setting css custom properties ||
|`title?`|`string`| Optional title paragraph displayed bold |
75
+
|`date`|`Date \| string`| Date either being formatted according to provided format or passed as a `string`|
76
+
|`children?`|`ReactNode`| Pass custom content as `children` to the component |
77
+
|`dateFormat?`|`string`| Overwriting `dateFormat` property of parent `Timeline`|
78
+
|`dateLocale?`|`string`| Overwriting `dateLocale` property of parent `Timeline`|
79
+
|`customMarker?`|`ReactElement`| Overwriting `customMarker` property of parent `Timeline`|
80
+
|`customPointer?`|`ReactElement`| Overwriting `customPointer` property of parent `Timeline`|
81
+
82
+
### StyleConfig
83
+
84
+
The style can either be passed as a javascript object...
85
+
86
+
```ts
87
+
{
88
+
line?: {
89
+
width?: string;
90
+
color?:string;
91
+
};
92
+
marker?: {
93
+
size?: string;
94
+
color?:string;
95
+
radius?:string;
96
+
};
97
+
pointer?: {
98
+
height?: string;
99
+
width?:string;
100
+
};
101
+
card?: {
102
+
background?: string;
103
+
radius?:string;
104
+
offset?:string;
105
+
shadow?:string;
106
+
padding?:string;
107
+
};
108
+
};
109
+
```
110
+
111
+
...or the custom properties can be set directly in css
112
+
113
+
```css
114
+
.timeline {
115
+
--line-width: 0.2rem;
116
+
--line-color: black;
117
+
--marker-size: 1rem;
118
+
--marker-color: var(--line-color);
119
+
--marker-radius: 50%;
120
+
--pointer-height: 2rem;
121
+
--pointer-width: 1rem;
122
+
--card-background: whitesmoke;
123
+
--card-radius: 0.1rem;
124
+
--card-offset: 1rem;
125
+
--card-shadow: unset;
126
+
--card-padding: 1rem;
127
+
}
128
+
```
129
+
130
+
(These are the default values)
131
+
132
+
## Demo
15
133
16
-
- Articles
17
-
-[**Use Vite in Library Mode**](https://vitejs.dev/guide/build.html#library-mode)
18
-
- Tools
19
-
-[**Vite**](https://vitejs.dev/): Next Generation Frontend Tooling
20
-
-[**Vitest**](https://vitest.dev/): A blazing fast unit-test framework powered by Vite.
21
-
-[**Vite Plugin dts**](https://github.com/qmhc/vite-plugin-dts): A vite plugin for generating `.d.ts` files.
22
-
-[**Storybook**](https://storybook.js.org/): Storybook is an open source tool for building UI components and pages in isolation. It streamlines UI development, testing, and documentation.
23
-
-[**Storybook Builder Vite**](https://github.com/storybookjs/builder-vite): An experimental plugin to run and build Storybooks with Vite.
134
+
View a full demo of component as storybook: [Storybook](https://openscript-ch.github.io/react-alternating-timeline/) 📗
0 commit comments