ProgressBar — 진행 상태를 보여 주는 컴포넌트
ProgressBar는 진행 중인 작업의 완료 정도를 시각적으로 알려 주는 컴포넌트예요. 단순한 진행률 표시부터 여러 단계로 나뉜 진행, 값이 정해지지 않은 indeterminate 모드까지 다양하게 쓸 수 있어요.
출처: 문서
본문
ProgressBar는 프로세스 상태 표시기(process status indicator)예요.
사용법 (Usage)
import { ProgressBar } from '@primereact/ui/progressbar';
<ProgressBar.Root>
<ProgressBar.Track>
<ProgressBar.Indicator>
<ProgressBar.Label>
<ProgressBar.Value />
</ProgressBar.Label>
</ProgressBar.Indicator>
</ProgressBar.Track>
</ProgressBar.Root>
예시
기본 (Basic)
진행 중인 프로세스의 완료 비율을 반영해서 보여 줘요.
동적 (Dynamic)
값은 반응형(reactive)이어서, 값을 동적으로 바꾸면 바 역시 함께 변해요.
포맷터 (Formatter)
표시 값을 원하는 형식으로 바꿔 주는 커스텀 포맷터 함수예요.
템플릿 (Template)
진행 값이 표시될 자리에 ProgressBar.Value를 놓고, formatter prop을 커스터마이즈하면 원하는 형식으로 표시할 수 있어요.
불확정 (Indeterminate)
추적할 값이 없는 진행에는 mode 속성을 indeterminate로 설정해요.
단계로 표시 (As Steps)
여러 단계로 나뉜 진행을 보여 주고 싶을 때는 스텝(Steps)을 사용해요.
관련 자료
하위 컴포넌트 (Sub-Components)
ProgressBarRoot, ProgressBarTrack, ProgressBarIndicator, ProgressBarLabel, ProgressBarValue 컴포넌트 문서는 Primitive API에서 확인할 수 있어요.
훅 (Hooks)
useProgressBar 훅 문서는 Headless API에서 확인할 수 있어요.
접근성 (Accessibility)
WAI-ARIA 준수 사항과 키보드 지원에 대한 자세한 내용은 ProgressBar Primitive에서 볼 수 있어요.
테마 (Theming)
CSS 클래스 (CSS Classes)
styled 모드에서 사용하는 클래스 이름 목록이에요.
| ClassName | Description |
|---|---|
| p-progressbar | Class name of the root element |
| p-progressbar-value | Class name of the value element |
| p-progressbar-label | Class name of the label element |
디자인 토큰 (Design Tokens)
디자인 토큰 목록이에요.
| Token | CSS Variable | Description |
|---|---|---|
| progressbar.background | --p-progressbar-background | Background of root |
| progressbar.border.radius | --p-progressbar-border-radius | Border radius of root |
| progressbar.height | --p-progressbar-height | Height of root |
| progressbar.value.background | --p-progressbar-value-background | Background of value |
| progressbar.label.color | --p-progressbar-label-color | Color of label |
| progressbar.label.font.size | --p-progressbar-label-font-size | Font size of label |
| progressbar.label.font.weight | --p-progressbar-label-font-weight | Font weight of label |