Progress
Features
- Provides context for assistive technology to read the progress of a task.
Installation
Install the component from your command line.
$ npm add reka-uiAnatomy
Import all parts and piece them together.
<script setup>
import { ProgressIndicator, ProgressRoot } from 'reka-ui'
</script>
<template>
<ProgressRoot>
<ProgressIndicator />
</ProgressRoot>
</template>Accessibility
Adheres to the progressbar role requirements.
API Reference
Root
Contains all of the progress parts.
| Prop | Default | Type |
|---|---|---|
as | 'div' | AsTag | ComponentThe element or component this component should render as. Can be overwrite by |
asChild | booleanChange the default rendered element for the one passed as a child, merging their props and behavior. Read our Composition guide for more details. | |
getValueLabel | `${Math.round((value / max) * DEFAULT_MAX)}%` | ((value: number, max: number) => string)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. |
max | DEFAULT_MAX | numberThe maximum progress value. |
modelValue | number | nullThe progress value. Can be bind as |
| Emit | Payload |
|---|---|
update:max | [value: number]Event handler called when the max value changes |
update:modelValue | [value: string[]]Event handler called when the progress value changes |
| Slots (default) | Payload |
|---|---|
modelValue | number | null | undefinedCurrent input values |
| Methods | Type |
|---|---|
getValueLabel | (value: number, max: number) => stringA 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. |
| Data Attribute | Value |
|---|---|
[data-state] | "complete" | "indeterminate" | "loading" |
[data-value] | The current value |
[data-max] | The max value |
Indicator
Used to show the progress visually. It also makes progress accessible to assistive technologies.
| Prop | Default | Type |
|---|---|---|
as | 'div' | AsTag | ComponentThe element or component this component should render as. Can be overwrite by |
asChild | booleanChange the default rendered element for the one passed as a child, merging their props and behavior. Read our Composition guide for more details. |
| Data Attribute | Value |
|---|---|
[data-state] | "complete" | "indeterminate" | "loading" |
[data-value] | The current value |
[data-max] | The max value |
