diff --git a/.changeset/warm-hotels-march.md b/.changeset/warm-hotels-march.md new file mode 100644 index 0000000..25c6cc9 --- /dev/null +++ b/.changeset/warm-hotels-march.md @@ -0,0 +1,5 @@ +--- +'@sopt-makers/ui': patch +--- + +Extend HTMLDivElement in Tag Component diff --git a/packages/ui/Tag/Tag.tsx b/packages/ui/Tag/Tag.tsx index 92383ff..79c9f48 100644 --- a/packages/ui/Tag/Tag.tsx +++ b/packages/ui/Tag/Tag.tsx @@ -1,27 +1,24 @@ -import * as S from "./style.css"; -import createTagStyle from "./utils"; +import { forwardRef, type HTMLAttributes } from 'react'; +import * as S from './style.css'; +import createTagStyle from './utils'; -interface TagProps { +export interface TagProps extends HTMLAttributes { children?: React.ReactNode; - size?: "sm" | "md" | "lg"; - shape?: "rect" | "pill"; - variant?: "default" | "primary" | "secondary"; - type?: "solid" | "line"; + size?: 'sm' | 'md' | 'lg'; + shape?: 'rect' | 'pill'; + variant?: 'default' | 'primary' | 'secondary'; + type?: 'solid' | 'line'; } -function Tag({ - children, - size = "sm", - shape = "rect", - variant = "default", - type = "solid", -}: TagProps) { +export const Tag = forwardRef((props, forwardedRef) => { + const { children, size = 'sm', shape = 'rect', variant = 'default', type = 'solid' } = props; const style = createTagStyle(type, variant, shape, size); + return ( -
+
{children}
); -} +}); -export default Tag; +Tag.displayName = 'Tag'; diff --git a/packages/ui/Tag/index.tsx b/packages/ui/Tag/index.tsx index 21bb058..9790fcb 100644 --- a/packages/ui/Tag/index.tsx +++ b/packages/ui/Tag/index.tsx @@ -1 +1 @@ -export { default } from "./Tag"; +export * from './Tag'; diff --git a/packages/ui/index.ts b/packages/ui/index.ts index c2d36b5..8046228 100644 --- a/packages/ui/index.ts +++ b/packages/ui/index.ts @@ -8,11 +8,11 @@ export type { DialogOptionType } from './Dialog'; export { ToastProvider, useToast, Toast } from './Toast'; export type { ToastOptionType } from './Toast'; export { TextField, TextArea, SearchField, SelectV2, Select, UserMention } from './Input'; -export { default as Tag } from './Tag'; export { default as Chip } from './Chip'; export { default as Callout } from './Callout'; export { default as Tab } from './Tab'; export * from './Skeleton'; export * from './FieldBox'; +export * from './Tag'; // test component export { default as Test } from './Test';