Tag
Tag 컴포넌트는 콘텐츠를 분류하는 데 쓰는 작은 라벨이에요. 상태나 카테고리를 시각적으로 구분하고 싶을 때 붙이는 배지라고 생각하면 이해하기 쉬워요.
출처: 문서
본문
사용법 (Usage)
import { Tag } from '@primereact/ui/tag';
<Tag />
예시 (Examples)
기본 (Basic)
아이템을 분류하거나 표시하기 위한 작은 라벨이에요.
심각도 (Severity)
severity 속성을 사용해서 태그의 심각도를 정의할 수 있어요.
알약 모양 (Pill)
rounded 속성을 사용해서 태그를 알약 모양으로 표시할 수 있어요.
아이콘 (Icon)
아이콘을 라벨의 왼쪽이나 오른쪽에 배치할 수 있어요.
템플릿 (Template)
컴포넌트의 children은 템플릿을 위한 콘텐츠로 전달돼요.
버튼으로 사용 (As button)
as="button"을 사용하면 태그를 버튼처럼 표시할 수 있어요.
관련 문서 (Related)
서브 컴포넌트 (Sub-Components)
서브 컴포넌트 문서는 Primitive API에서 확인하세요.
훅 (Hooks)
훅 문서는 Headless API에서 확인하세요.
접근성 (Accessibility)
WAI-ARIA 준수 세부사항과 키보드 지원은 Tag Primitive에서 확인하세요.
테마 (Theming)
CSS 클래스 (CSS Classes)
styled 모드에서 사용하는 클래스 이름 목록이에요.
| ClassName | Description |
|---|---|
| p-tag | Class name of the root element |
디자인 토큰 (Design Tokens)
디자인 토큰 목록이에요.
| Token | CSS Variable | Description |
|---|---|---|
| tag.font.size | --p-tag-font-size | Font size of root |
| tag.font.weight | --p-tag-font-weight | Font weight of root |
| tag.padding | --p-tag-padding | Padding of root |
| tag.gap | --p-tag-gap | Gap of root |
| tag.border.radius | --p-tag-border-radius | Border radius of root |
| tag.rounded.border.radius | --p-tag-rounded-border-radius | Rounded border radius of root |
| tag.icon.size | --p-tag-icon-size | Size of icon |
| tag.primary.background | --p-tag-primary-background | Background of primary |
| tag.primary.color | --p-tag-primary-color | Color of primary |
| tag.secondary.background | --p-tag-secondary-background | Background of secondary |
| tag.secondary.color | --p-tag-secondary-color | Color of secondary |
| tag.success.background | --p-tag-success-background | Background of success |
| tag.success.color | --p-tag-success-color | Color of success |
| tag.info.background | --p-tag-info-background | Background of info |
| tag.info.color | --p-tag-info-color | Color of info |
| tag.warn.background | --p-tag-warn-background | Background of warn |
| tag.warn.color | --p-tag-warn-color | Color of warn |
| tag.danger.background | --p-tag-danger-background | Background of danger |
| tag.danger.color | --p-tag-danger-color | Color of danger |
| tag.contrast.background | --p-tag-contrast-background | Background of contrast |
| tag.contrast.color | --p-tag-contrast-color | Color of contrast |
더 알아보기 (Learn more)
- Tag 서브 컴포넌트의 세부 API를 Primitive 문서에서 살펴보세요.
severity와rounded속성을 조합해 상태별 태그 스타일을 정리해 보세요.