Skip to content

Commit 10e3227

Browse files
author
Kubit
committed
Include component prop to TagV2
1 parent f14a1a1 commit 10e3227

File tree

3 files changed

+20
-1
lines changed

3 files changed

+20
-1
lines changed

src/components/tagV2/stories/argtypes.ts

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,17 @@ export const argtypes = (
4141
category: CATEGORY_CONTROL.CONTENT,
4242
},
4343
},
44+
component: {
45+
description: 'Component',
46+
type: { name: 'string' },
47+
control: { type: 'text' },
48+
table: {
49+
type: {
50+
summary: 'string | React.ComponentType<any>',
51+
},
52+
category: CATEGORY_CONTROL.CUSTOMIZATION,
53+
},
54+
},
4455
dataTestId: {
4556
description: 'Test id',
4657
type: { name: 'string' },

src/components/tagV2/tagStandAlone.tsx

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,13 @@ const TagStandAloneComponent = (
1414
): JSX.Element => {
1515
const ariaProps = pickAriaProps(props);
1616
return (
17-
<TagContainerStyled ref={ref} data-testid={dataTestId} styles={props.styles} {...ariaProps}>
17+
<TagContainerStyled
18+
ref={ref}
19+
as={props.component}
20+
data-testid={dataTestId}
21+
styles={props.styles}
22+
{...ariaProps}
23+
>
1824
<ElementOrIcon customIconStyles={props.styles.icon} {...props.icon} />
1925
<Text
2026
component={TextComponentType.SPAN}

src/components/tagV2/types/tag.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,8 @@ export interface ITagStandAlone extends TagAriaAttributes {
2121
styles: TagPropsStylesType;
2222
icon?: IElementOrIcon;
2323
label?: TagLabelType;
24+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
25+
component?: string | React.ComponentType<any>;
2426
dataTestId?: string;
2527
}
2628

0 commit comments

Comments
 (0)