import { Tag } from 'sud-ui';속성별로 태그를 지정할 때 사용합니다.
분류할 때 사용합니다.
import { Tag } from "sud-ui";
export default function App() {
return (
<div>
<Tag>default</Tag>
</div>
)
}import { Tag } from "sud-ui";
export default function App() {
return (
<div>
<Tag background="blue-7" color="gold-3">
blue / gold
</Tag>
<Tag background="volcano-7" color="forest-2">
volcano / forest
</Tag>
</div>
)
}import { Tag, toast } from "sud-ui";
export default function App() {
return (
<Tag
closeable
onClose={() => {
toast.success("closed");
}}
>
closeable
</Tag>
)
}import { Tag, Card, Radio } from "sud-ui";
import { useState } from "react";
export default function App() {
const [shape, setShape] = useState("rounded");
const shapeOptions = [
{ label: "rounded", value: "rounded" },
{ label: "square", value: "square" },
{ label: "circle", value: "circle" },
{ label: "capsule", value: "capsule" }
];
return (
<div>
<Card style={{ width: "100%" }} shadow="none" colorType="sub">
<div className="flex justify-center">
<Radio.Group
direction="horizontal"
options={shapeOptions}
value={shape}
onChange={setShape}
/>
</div>
</Card>
<Tag shape={shape}>Shape Tag</Tag>
</div>
)
}import { Tag, Card, Radio } from "sud-ui";
import { useState } from "react";
export default function App() {
const [size, setSize] = useState("sm");
const sizeOptions = [
{ label: "sm", value: "sm" },
{ label: "md", value: "md" },
{ label: "lg", value: "lg" }
];
return (
<div>
<Card style={{ width: "100%" }} shadow="none" colorType="sub">
<div className="flex justify-center">
<Radio.Group
direction="horizontal"
options={sizeOptions}
value={size}
onChange={setSize}
/>
</div>
</Card>
<Tag size={size}>Size Tag</Tag>
</div>
)
}import { Tag } from "sud-ui";
export default function App() {
return (
<div>
<Tag colorType="sky">sky</Tag>
<Tag colorType="blue">blue</Tag>
<Tag colorType="forest">forest</Tag>
<Tag colorType="gold">gold</Tag>
<Tag colorType="red">red</Tag>
</div>
)
}import { Tag } from "sud-ui";
export default function App() {
return (
<div>
<Tag borderType="dashed" borderWeight="2" borderColor="blue-3">
dashed
</Tag>
<Tag borderType="dotted" borderWeight="3" borderColor="cool-gray-5">
dotted
</Tag>
</div>
)
}import { Tag } from "sud-ui";
import { LogoAdobeIllustrator, LogoAdobePhotoshop } from "sud-icons";
export default function App() {
return (
<div>
<Tag icon={<LogoAdobeIllustrator />}>My Illustrator Skill Lv.5</Tag>
<Tag icon={<LogoAdobePhotoshop />} iconPosition="right">
My Photoshop Skill Lv.4
</Tag>
</div>
)
}import { Tag, Card, Radio } from "sud-ui";
import { useState } from "react";
export default function App() {
const [shadow, setShadow] = useState("none");
const shadowOptions = [
{ label: "none", value: "none" },
{ label: "sm", value: "sm" },
{ label: "md", value: "md" },
{ label: "lg", value: "lg" }
];
return (
<div>
<Card style={{ width: "100%" }} shadow="none" colorType="sub">
<div className="flex justify-center">
<Radio.Group
direction="horizontal"
options={shadowOptions}
value={shadow}
onChange={setShadow}
/>
</div>
</Card>
<Tag shadow={shadow}>Shadow Tag</Tag>
</div>
)
}속성 이름 | 설명 | 타입 | 기본값 |
|---|
| children | 태그 내용 | ReactNode | - |
| colorType | 태그 색상 타입 | default | red | rose | coral | orange | volcano | apricot | yellow | gold | amber | green | lime | mint | blue | sky | cerulean | indigo | cobalt | navy | purple | plum | orchid | forest | sage | warm-gray | cool-gray | neutral | default |
| background | 태그 배경색(palette값 또는 HEX code) | string | - |
| color | 태그 텍스트 색상(palette값 또는 HEX code) | string | - |
| borderColor | 태그 테두리 색상(palette값 또는 HEX code) | string | - |
| borderType | 태그 테두리 스타일 | solid | dashed | dotted | double | groove | ridge | inset | outset | none | solid |
| borderWeight | 태그 테두리 두께 | string | number | 1 |
| className | 추가 클래스명 | string | - |
| closeable | 닫기 버튼 표시 여부 | boolean | false |
| onClose | 닫기 버튼 클릭 시 호출되는 콜백 | () => void | - |
| icon | 태그 아이콘 | ReactNode | - |
| iconPosition | 아이콘 위치 | left | right | - |
| shape | 태그 모양 | square | circle | rounded | capsule | rounded |
| shadow | 태그 그림자 | none | sm | md | lg | none |
| border | 태그 테두리 표시 여부 | boolean | true |
| size | 태그 크기 | sm | md | lg | sm |
| style | 추가 스타일 | CSSProperties | {} |