# ProgressCircle
A circular visual indicator of completion progress.
## Import
```tsx
import { ProgressCircle } from '@coinbase/cds-web/visualizations/ProgressCircle'
```
## Examples
### Default
```jsx live
```
### Thin
```jsx live
```
### Semiheavy
```jsx live
```
### Heavy
```jsx live
```
### No Text
```jsx live
```
### Disabled
```jsx live
```
### Colors
```jsx live
```
### Fill Parent
The progress circle can be dynamically sized to fit its parent. If you drag the browser window smaller or larger then the ProgressCircle will resize accordingly.
```jsx live
```
### Content Node Customization
You can override the default content node to display a custom node. Note that the content node is clipped to the circle.
#### With Asset
You can provide an image, such as an asset, as the content node.
```jsx live
}
weight="thin"
/>
}
weight="thin"
/>
}
weight="thin"
/>
}
weight="thin"
/>
}
weight="thin"
/>
}
weight="thin"
/>
}
weight="thin"
/>
}
weight="thin"
/>
}
weight="thin"
/>
}
weight="thin"
/>
```
#### Custom Text Color
The progress circle's default content can be customized to display a custom text color.
```jsx live
}
/>
}
/>
```
### Custom Styles
The progress circle can be customized with styles and class names.
```jsx live
40%}
weight="semiheavy"
/>
}
/>
```
### Interactive Demo
This is for demo purposes. ProgressContainerWithButtons isn't designed for production usage.
```jsx 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 circle root. |
| `classNames` | `{ root?: string; svg?: string \| undefined; circle?: string \| undefined; progress?: string \| undefined; } \| undefined` | No | `-` | Custom class names for the progress circle. |
| `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. |
| `contentNode` | `null \| string \| number \| false \| true \| ReactElement> \| Iterable \| ReactPortal` | No | `-` | Optional component to override the default content rendered inside the circle. |
| `disableAnimateOnMount` | `boolean` | No | `false` | Disable animation on component mount |
| `disabled` | `boolean` | No | `false` | Toggle used to show a disabled progress visualization |
| `hideContent` | `boolean` | No | `-` | Toggle used to hide the content node rendered inside the circle. |
| `hideText` | `boolean` | No | `-` | - |
| `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 | `-` | - |
| `size` | `number` | No | `-` | Optional size in px for the visualization. This is useful if the visualization is used in an HStack. If this is omitted the visualization will fill the parent width or height. Since its a circular visualization it will fill the smaller of the parent width or height |
| `style` | `CSSProperties` | No | `-` | Custom styles for the progress circle root. |
| `styles` | `{ root?: CSSProperties; svg?: CSSProperties \| undefined; circle?: CSSProperties \| undefined; progress?: CSSProperties \| undefined; } \| undefined` | No | `-` | Custom styles for the progress circle. |
| `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 |