MeterGroup
MeterGroup은 알려진 범위 안에서 스칼라 측정값을 보여주는 컴포넌트예요. 여러 항목의 비율을 한 줄의 바(bar)에 쌓아서, 전체에서 각 부분이 차지하는 크기를 직관적으로 나타낼 때 유용해요.
출처: 문서
본문
사용법 (Usage)
import { MeterGroup } from '@primereact/ui/metergroup';
<MeterGroup.Root>
<MeterGroup.Meters>
<MeterGroup.Meter />
</MeterGroup.Meters>
<MeterGroup.Labels>
<MeterGroup.Label>
<MeterGroup.Marker />
<MeterGroup.Text />
</MeterGroup.Label>
</MeterGroup.Labels>
</MeterGroup.Root>
예시 (Examples)
기본 (Basic)
다중 (Multiple)
각 MeterGroup.Meter는 value와 선택적인 color를 받아요. meter를 더 추가하면 한 줄의 바에 쌓여서 보여져요.
색상 (Color)
color는 모든 CSS 색상 값, 디자인 토큰(var(--p-violet-500)), hex, rgb, hsl 또는 이름 있는 색상을 받아요. 이 값은 요소의 --p-metergroup-color CSS 변수에 기록돼요. className이나 style로 직접 스타일링할 수도 있어요.
아이콘 (Icon)
전용 아이콘 부분은 없어요. MeterGroup.Label 안에 마커 옆으로 직접 <i>나 SVG를 넣으면 돼요.
라벨 (Label)
라벨은 기본적으로 가로로 렌더링돼요. MeterGroup.Labels에 orientation="vertical"을 설정하면 세로로 쌓아요.
세로 (Vertical)
MeterGroup.Root는 orientation="horizontal"(기본) 또는 orientation="vertical"을 받아요.
Min-Max
min과 max로 범위를 설정해요. 기본값은 0과 100이에요.
템플릿 (Template)
각 부분은 그냥 일반 요소라서, meter 주변에 카드, 요약, 버튼을 자유롭게 배치할 수 있어요.
관련 문서 (Related)
서브 컴포넌트 (Sub-Components)
MeterGroupRoot, MeterGroupMeters, MeterGroupMeter, MeterGroupLabels, MeterGroupLabel, MeterGroupMarker, MeterGroupText 컴포넌트 문서는 Primitive API에서 확인하세요.
훅 (Hooks)
useMeterGroup 훅 문서는 Headless API에서 확인하세요.
접근성 (Accessibility)
WAI-ARIA 준수 세부사항과 키보드 지원은 MeterGroup Primitive에서 확인하세요.
테마 (Theming)
CSS 클래스 (CSS Classes)
styled 모드에서 사용하는 클래스 이름 목록이에요.
| ClassName | Description |
|---|---|
| p-metergroup | Class name of the root element |
| p-metergroup-meters | Class name of the meters element |
| p-metergroup-meter | Class name of the meter element |
| p-metergroup-label-list | Class name of the label list element |
| p-metergroup-label | Class name of the label element |
| p-metergroup-label-marker | Class name of the label marker element |
| p-metergroup-label-text | Class name of the label text element |
디자인 토큰 (Design Tokens)
디자인 토큰 목록이에요.
| Token | CSS Variable | Description |
|---|---|---|
| metergroup.border.radius | --p-metergroup-border-radius | Border radius of root |
| metergroup.gap | --p-metergroup-gap | Gap of root |
| metergroup.meters.background | --p-metergroup-meters-background | Background of meters |
| metergroup.meters.size | --p-metergroup-meters-size | Size of meters |
| metergroup.label.gap | --p-metergroup-label-gap | Gap of label |
| metergroup.label.marker.size | --p-metergroup-label-marker-size | Size of label marker |
| metergroup.label.text.font.weight | --p-metergroup-label-text-font-weight | Font weight of label text |
| metergroup.label.text.font.size | --p-metergroup-label-text-font-size | Font size of label text |
| metergroup.label.icon.size | --p-metergroup-label-icon-size | Size of label icon |
| metergroup.label.list.vertical.gap | --p-metergroup-label-list-vertical-gap | Vertical gap of label list |
| metergroup.label.list.horizontal.gap | --p-metergroup-label-list-horizontal-gap | Horizontal gap of label list |
더 알아보기 (Learn more)
- MeterGroup 서브 컴포넌트의 세부 API를 Primitive 문서에서 살펴보세요.
- 여러 meter에
color를 지정해 한 줄의 바에 비율을 시각화해 보세요.