mirror of
https://github.com/carbon-design-system/carbon-components-svelte.git
synced 2025-09-14 18:01:06 +00:00
docs(progress-bar): improve docs
This commit is contained in:
parent
b6570f0b1b
commit
86e8aa8b00
1 changed files with 15 additions and 11 deletions
|
@ -3,66 +3,70 @@
|
||||||
import Preview from "../../components/Preview.svelte";
|
import Preview from "../../components/Preview.svelte";
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
`ProgressBar` provides a visual indicator of progress for operations such as file uploads or data processing. It supports determinate and indeterminate states, various sizes, and status indicators.
|
||||||
|
|
||||||
## Default
|
## Default
|
||||||
|
|
||||||
Without a specified `value` prop, the progress bar is indeterminate.
|
Create an indeterminate progress bar that continuously animates.
|
||||||
|
|
||||||
<ProgressBar helperText="Loading..." />
|
<ProgressBar helperText="Loading..." />
|
||||||
|
|
||||||
## Small size
|
## Small size
|
||||||
|
|
||||||
Specify `size="sm"` to use the small variant.
|
Use the small size variant for compact layouts.
|
||||||
|
|
||||||
<ProgressBar size="sm" helperText="Loading..." />
|
<ProgressBar size="sm" helperText="Loading..." />
|
||||||
|
|
||||||
## Percentage
|
## Percentage
|
||||||
|
|
||||||
Specify a `value` for the progress bar to be determinate.
|
Display progress as a percentage using the `value` prop.
|
||||||
|
|
||||||
<ProgressBar value={40} labelText="Upload status" helperText="40 MB of 100 MB" />
|
<ProgressBar value={40} labelText="Upload status" helperText="40 MB of 100 MB" />
|
||||||
|
|
||||||
## Finished status
|
## Finished status
|
||||||
|
|
||||||
Specify `status="finished"` for the progress bar.
|
Show completion status with a checkmark icon.
|
||||||
|
|
||||||
<ProgressBar value={100} status="finished" labelText="Upload file" helperText="Upload complete" />
|
<ProgressBar value={100} status="finished" labelText="Upload file" helperText="Upload complete" />
|
||||||
|
|
||||||
## Error status
|
## Error status
|
||||||
|
|
||||||
Specify `status="error"` for the progress bar.
|
Indicate errors with an error icon and red styling.
|
||||||
|
|
||||||
<ProgressBar value={0} status="error" labelText="Upload file" helperText="Invalid file format" />
|
<ProgressBar value={0} status="error" labelText="Upload file" helperText="Invalid file format" />
|
||||||
|
|
||||||
## Custom max value
|
## Custom max value
|
||||||
|
|
||||||
The default `max` value is `100`.
|
Set a custom maximum value for the progress bar.
|
||||||
|
|
||||||
<ProgressBar value={40} max={200} labelText="Upload status" helperText="40 MB of 200 MB" />
|
<ProgressBar value={40} max={200} labelText="Upload status" helperText="40 MB of 200 MB" />
|
||||||
|
|
||||||
## Hidden label
|
## Hidden label
|
||||||
|
|
||||||
It's recommended that you provide a `labelText` for accessibility.
|
Visually hide the label while maintaining accessibility.
|
||||||
|
|
||||||
Use `hideLabel` to visually hide the label text.
|
|
||||||
|
|
||||||
<ProgressBar hideLabel value={40} labelText="Upload status" helperText="40 MB of 100 MB" />
|
<ProgressBar hideLabel value={40} labelText="Upload status" helperText="40 MB of 100 MB" />
|
||||||
|
|
||||||
## Inline variant
|
## Inline variant
|
||||||
|
|
||||||
The inline variant visually hides the `helperText`.
|
Use the inline variant to display progress without helper text.
|
||||||
|
|
||||||
<ProgressBar kind="inline" value={40} labelText="Upload status" helperText="40 MB of 100 MB" />
|
<ProgressBar kind="inline" value={40} labelText="Upload status" helperText="40 MB of 100 MB" />
|
||||||
|
|
||||||
## Indented variant
|
## Indented variant
|
||||||
|
|
||||||
|
Use the indented variant for a more compact layout.
|
||||||
|
|
||||||
<ProgressBar kind="indented" value={40} labelText="Upload status" helperText="40 MB of 100 MB" />
|
<ProgressBar kind="indented" value={40} labelText="Upload status" helperText="40 MB of 100 MB" />
|
||||||
|
|
||||||
## Indented status variant
|
## Indented status variant
|
||||||
|
|
||||||
|
Combine the indented variant with status indicators.
|
||||||
|
|
||||||
<ProgressBar kind="indented" status="finished" value={40} labelText="Upload file" helperText="Upload complete" />
|
<ProgressBar kind="indented" status="finished" value={40} labelText="Upload file" helperText="Upload complete" />
|
||||||
|
|
||||||
## UX example
|
## UX example
|
||||||
|
|
||||||
This example shows how to animate the progress bar from 0 to 100% with start and end states.
|
Demonstrate a complete upload flow with start and end states.
|
||||||
|
|
||||||
<FileSource src="/framed/ProgressBar/ProgressBarUx" />
|
<FileSource src="/framed/ProgressBar/ProgressBarUx" />
|
Loading…
Add table
Add a link
Reference in a new issue