# ProgressBar A visual indicator of completion progress. ## Import ```tsx import { ProgressBar } from '@coinbase/cds-web/visualizations/ProgressBar' ``` ## Examples #### Default ```tsx live ``` #### Weights ```tsx live ``` #### Disabled ```tsx live ``` #### Colors ```tsx live ``` #### Custom Styles You can customize the appearance of the progress bar using the `styles` prop. The `root` style controls the container, and `progress` controls the fill bar. ```tsx live ``` #### Interactive Demo This is for demo purposes. ProgressContainerWithButtons isn't designed for production usage. ```tsx live {({ calculateProgress }) => ( )} ``` ### Animation Callbacks You can use the `onAnimationStart` and `onAnimationEnd` callbacks to track the progress of the animation. ```jsx live function Example() { const [animationStatus, setAnimationStatus] = React.useState('Ready'); const handleAnimationStart = useCallback(() => { setAnimationStatus('Animating...'); }, []); const handleAnimationEnd = useCallback(() => { setAnimationStatus('Animation Ended'); }, []); return ( {({ calculateProgress }) => ( Animation Status: {animationStatus} )} ); } ``` ## Props | Prop | Type | Required | Default | Description | | --- | --- | --- | --- | --- | | `progress` | `number` | Yes | `-` | Number between 0-1 representing the progress percentage | | `className` | `string` | No | `-` | Custom class name for the progress bar root. | | `classNames` | `{ root?: string; progress?: string \| undefined; } \| undefined` | No | `-` | Custom class names for the progress bar. | | `color` | `currentColor \| fg \| fgMuted \| fgInverse \| fgPrimary \| fgWarning \| fgPositive \| fgNegative \| bg \| bgAlternate \| bgInverse \| bgOverlay \| bgElevation1 \| bgElevation2 \| bgPrimary \| bgPrimaryWash \| bgSecondary \| bgTertiary \| bgSecondaryWash \| bgNegative \| bgNegativeWash \| bgPositive \| bgPositiveWash \| bgWarning \| bgWarningWash \| bgLine \| bgLineHeavy \| bgLineInverse \| bgLinePrimary \| bgLinePrimarySubtle \| accentSubtleRed \| accentBoldRed \| accentSubtleGreen \| accentBoldGreen \| accentSubtleBlue \| accentBoldBlue \| accentSubtlePurple \| accentBoldPurple \| accentSubtleYellow \| accentBoldYellow \| accentSubtleGray \| accentBoldGray \| transparent` | No | `primary` | Custom progress color. | | `disableAnimateOnMount` | `boolean` | No | `false` | Disable animation on component mount | | `disabled` | `boolean` | No | `false` | Toggle used to show a disabled progress visualization | | `key` | `Key \| null` | No | `-` | - | | `onAnimationEnd` | `(() => void)` | No | `-` | Callback fired when the progress animation ends. | | `onAnimationStart` | `(() => void)` | No | `-` | Callback fired when the progress animation starts. | | `ref` | `RefObject \| ((instance: HTMLDivElement \| null) => void) \| null` | No | `-` | - | | `style` | `CSSProperties` | No | `-` | Custom styles for the progress bar root. | | `styles` | `{ root?: CSSProperties; progress?: CSSProperties \| undefined; } \| undefined` | No | `-` | Custom styles for the progress bar. | | `testID` | `string` | No | `-` | Used to locate this element in unit and end-to-end tests. Under the hood, testID translates to data-testid on Web. On Mobile, testID stays the same - testID | | `weight` | `normal \| heavy \| thin \| semiheavy` | No | `normal` | Toggle used to change thickness of progress visualization |