Progress 진행률 표시줄
작업이나 용량의 완료 진행률을 보여줍니다. 선형과 원형 두 가지 형태를 지원하며, 색상과 텍스트를 사용자 정의할 수 있습니다.
기본 사용법
기본 사용법
60%
100%
80%
40%
55%
70 점
75%
100%
30%
import { LhProgress } from '@lh-ui/react'
export default function Demo() {
return (
<>
<LhProgress percentage={60} />
<LhProgress percentage={80} status="warning" />
<LhProgress type="circle" percentage={75} />
</>
)
}
Progress Props
| Prop | 설명 | 타입 | 옵션 | 기본값 |
|---|---|---|---|---|
| percentage | 진행률 백분율, [0, 100]을 벗어나면 자동으로 제한됨 | number | — | 0 |
| type | 형태 | 'line' | 'circle' | — | 'line' |
| status | 상태, normal일 때 100에 도달하면 자동으로 success로 전환 | 'normal' | 'success' | 'warning' | 'exception' | — | 'normal' |
| color | 진행률 표시줄 색상: 문자열 또는 백분율에 따라 색상을 반환하는 함수 | string | ((percentage: number) => string) | — | — |
| strokeWidth | 선 너비 px(line은 높이, circle은 스트로크 너비) | number | — | 6 |
| width | 원형 모드 캔버스 너비 px | number | — | 126 |
| showText | 텍스트 표시 여부 | boolean | — | true |
| format | 사용자 정의 텍스트 내용(제한된 백분율을 받아 ReactNode 반환) | (percentage: number) => ReactNode | — | — |
| sx | 레이아웃 약식 표기 | SxProps | — | — |
Vue 버전과의 대응
percentage / type / status / color / strokeWidth / width / showText는 lh-ui-plus의
LhProgress props와 동일한 이름과 의미를 갖습니다. React에는 슬롯이 없으므로 plus의 format prop과
#text 범위 슬롯은 하나의 format 렌더 함수로 통합됩니다(제한된 백분율을 받아 ReactNode를 반환).
접근성
루트 요소는 role="progressbar"와 aria-valuemin / aria-valuemax / aria-valuenow를 가지며
WAI-ARIA progressbar 패턴을 따릅니다. aria-valuetext는 보이는 텍스트와 동기화됩니다——
기본값은 백분율이며, format을 전달하면 포맷된 텍스트가 읽혀집니다(format이 문자열이 아닌 값을
반환하면 반올림된 백분율 텍스트로 폴백).
스타일
import '@lh-ui/react/style/progress'