メインコンテンツへスキップ

Progress プログレスバー

タスクや容量の達成状況を示します。線形と円形の 2 つの形態をサポートし、色とテキストはカスタマイズ可能です。

基本的な使い方​

基本的な使い方
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円形モードのキャンバス幅 pxnumber—126
showTextテキストを表示するかboolean—true
formatカスタムテキスト内容(クランプ後のパーセンテージを受け取り、ReactNode を返す)(percentage: number) => ReactNode——
sxレイアウト省略記法SxProps——
Vue 版との対応

percentage / type / status / color / strokeWidth / width / showText は lh-ui-plus の LhProgress と同名同義。React にスロットはないため、plus の format prop と #text スロットは 1 つの format レンダー関数に統合されます(クランプ後のパーセンテージを受け取り、ReactNode を返す)。

アクセシビリティ

ルート要素は role="progressbar" および aria-valuemin / aria-valuemax / aria-valuenow を持ち、 WAI-ARIA の progressbar パターンに準拠します。aria-valuetext は可視テキストと同期します—— デフォルトではパーセンテージ、format を渡すとフォーマット後のテキストが読み上げられます (format が文字列以外を返す場合は、四捨五入されたパーセンテージ文にフォールバックします)。

スタイル​

import '@lh-ui/react/style/progress'