Skip to content

Commit 4620e37

Browse files
refactor: Timeline props
1 parent d31b3a5 commit 4620e37

3 files changed

Lines changed: 15 additions & 5 deletions

File tree

packages/@primereact/types/src/headless/timeline/useTimeline.types.ts

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,18 @@ import type { HeadlessInstance } from '@primereact/types/core';
1313
/**
1414
* Defines valid properties in useTimeline.
1515
*/
16-
export interface useTimelineProps {}
16+
export interface useTimelineProps {
17+
/**
18+
* Alignment of the content.
19+
* @default left
20+
*/
21+
align?: 'left' | 'right' | 'alternate' | 'top' | 'bottom' | undefined;
22+
/**
23+
* Specifies the orientation, valid values are 'horizontal' and 'vertical'.
24+
* @default vertical
25+
*/
26+
orientation?: 'horizontal' | 'vertical' | undefined;
27+
}
1728

1829
/**
1930
* Defines valid state in useTimeline.

packages/primereact/src/timeline/root/TimelineRoot.props.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,5 @@ import type { TimelineRootProps } from '@primereact/types/primitive/timeline';
33

44
export const defaultRootProps: TimelineRootProps = {
55
...HeadlessTimeline.defaultProps,
6-
as: 'div',
7-
align: 'left',
8-
orientation: 'vertical'
6+
as: 'div'
97
};

packages/primereact/src/timeline/root/TimelineRoot.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,10 @@ export const TimelineRoot = withComponent({
1515
return timeline;
1616
},
1717
render(instance) {
18-
const { id, props, ptmi, cx } = instance;
18+
const { id, props, ptmi, cx, rootProps: headlessRootProps } = instance;
1919

2020
const rootProps = mergeProps(
21+
headlessRootProps,
2122
{
2223
id,
2324
className: cx('root')

0 commit comments

Comments
 (0)