18 lines
536 B
TypeScript
Executable File
18 lines
536 B
TypeScript
Executable File
type ProgressBarProps = {
|
|
value: number;
|
|
label?: string;
|
|
};
|
|
|
|
export default function ProgressBar({ value, label }: ProgressBarProps) {
|
|
const clamped = Math.max(0, Math.min(100, value));
|
|
|
|
return (
|
|
<div className="w-full">
|
|
{label ? <div className="mb-1 text-xs font-semibold text-muted-foreground">{label}</div> : null}
|
|
<div className="h-2.5 w-full rounded-full bg-secondary">
|
|
<div className="h-2.5 rounded-full bg-primary transition-all" style={{ width: `${clamped}%` }} />
|
|
</div>
|
|
</div>
|
|
);
|
|
}
|