|
| 1 | +--- |
| 2 | +title: Qwik UI | Progress |
| 3 | +--- |
| 4 | + |
| 5 | +import { statusByComponent } from '~/_state/component-statuses'; |
| 6 | +import { FeatureList } from '~/components/feature-list/feature-list'; |
| 7 | +import { Note } from '~/components/note/note'; |
| 8 | + |
| 9 | +<StatusBanner status={statusByComponent.headless.Progress} /> |
| 10 | + |
| 11 | +# Progress |
| 12 | + |
| 13 | +Displays a progress bar related to a task. |
| 14 | + |
| 15 | +<Showcase name="hero" /> |
| 16 | + |
| 17 | +Qwik UI's Progress implementation follows the [WAI-Aria](https://www.w3.org/WAI/ARIA/apg/patterns/meter) design pattern, along with some additional API's that enhance the flexibility, types, and performance. |
| 18 | + |
| 19 | +<FeatureList |
| 20 | + features={['Provides context for assistive technology to read the progress of a task.']} |
| 21 | +/> |
| 22 | + |
| 23 | +<div class="mb-6 flex flex-col gap-2"> |
| 24 | +[View Source Code ↗️](https://github.com/qwikifiers/qwik-ui/tree/main/packages/kit-headless/src/components/progress) |
| 25 | + |
| 26 | +[Report an issue 🚨](https://github.com/qwikifiers/qwik-ui/issues) |
| 27 | + |
| 28 | +[Edit This Page 🗒️](<https://github.com/qwikifiers/qwik-ui/edit/main/apps/website/src/routes/docs/headless/(components)/progress/index.mdx>) |
| 29 | + |
| 30 | +</div> |
| 31 | + |
| 32 | +## Building blocks |
| 33 | + |
| 34 | +```tsx |
| 35 | +import { component$ } from '@builder.io/qwik'; |
| 36 | +import { Progress, ProgressIndicator } from '@qwik-ui/headless'; |
| 37 | + |
| 38 | +export default component$(() => { |
| 39 | + const progress = 30; |
| 40 | + |
| 41 | + return ( |
| 42 | + <Progress value={progress} class="progress"> |
| 43 | + <ProgressIndicator |
| 44 | + class="progress-indicator" |
| 45 | + style={{ |
| 46 | + transform: `translateX(-${100 - progress}%)`, |
| 47 | + }} |
| 48 | + /> |
| 49 | + </Progress> |
| 50 | + ); |
| 51 | +}); |
| 52 | +``` |
| 53 | + |
| 54 | +## Accessibility |
| 55 | + |
| 56 | +Adheres to the [progressbar role requirements](https://www.w3.org/WAI/ARIA/apg/patterns/meter/). |
| 57 | + |
| 58 | +## API |
| 59 | + |
| 60 | +### Root |
| 61 | + |
| 62 | +Contains all of the progress parts. |
| 63 | + |
| 64 | +<APITable |
| 65 | + propDescriptors={[ |
| 66 | + { |
| 67 | + name: 'class', |
| 68 | + type: 'string', |
| 69 | + description: 'CSS classes to apply to the Progress.', |
| 70 | + }, |
| 71 | + { |
| 72 | + name: 'value', |
| 73 | + type: 'number', |
| 74 | + description: 'The progress value.', |
| 75 | + }, |
| 76 | + { |
| 77 | + name: 'max', |
| 78 | + type: 'number', |
| 79 | + description: 'The maximum progress value', |
| 80 | + }, |
| 81 | + { |
| 82 | + name: 'getValueLabel', |
| 83 | + type: 'function', |
| 84 | + description: |
| 85 | + 'A function to get the accessible label text representing the current value in a human-readable format. If not provided, the value label will be read as the numeric value as a percentage of the max value.', |
| 86 | + }, |
| 87 | + ]} |
| 88 | +/> |
0 commit comments