Progress
Show how much of a task has completed.
Demos
Size
State
Value
Usage
vue
<script setup lang="ts">
import { Accordion } from '~/components/ui/accordion'
const items = [
{ value: 'source', label: 'Do I own the source?', content: 'Yes. Copy and adapt the files.' },
]
</script>
<template>
<Accordion :items="items" />
</template>
Values and orientation
Bind the value with v-model. Set it to null for indeterminate progress. The preview exposes a value control and orientation under Options and states.
vue
import type { UiConfig } from './ui.types'
const uiConfig: UiConfig = {
defaults: { size: 'md' },
components: {
button: { color: 'primary', variant: 'solid' },
input: { variant: 'outline' },
},
}
export default uiConfig
Vertical progress fills from the bottom and keeps the selected thickness. Width and height changes transition over 200ms; reduced motion disables the transition and indeterminate pulse.
Installation
Complete the shared installation. Copy Progress.vue and index.ts into app/components/ui/progress/.
app/components/ui/progress/Progress.vue
<script setup lang="ts">
import { Progress as Primitive } from 'akaza-ui'
import { computed, useAttrs } from 'vue'
import { cn } from '../../../utils/ui'
import uiConfig from '../ui.config'
import {
progressVariants,
resolveProgressVariants,
type ProgressProps,
type ProgressSlots,
} from './index'
defineOptions({ inheritAttrs: false })
// Preserve Akaza defaults when optional props, including Boolean aliases, are omitted.
const props = withDefaults(defineProps<ProgressProps>(), {
min: undefined,
max: undefined,
orientation: undefined,
ariaLabel: undefined,
getValueLabel: undefined,
ui: undefined,
modelValue: undefined,
})
defineSlots<ProgressSlots>()
const attrs = useAttrs()
const styles = computed(() => progressVariants(resolveProgressVariants(props, uiConfig)))
const mergedUi = computed(() => {
const overrides = props.ui as Record<string, string | undefined> | undefined
return Object.fromEntries(
Object.entries(styles.value).map(([part, style]) => [
part,
cn(style(), overrides?.[part], part === 'root' ? props.class : undefined),
]),
)
})
const primitiveProps = computed(() => {
const { class: _class, ui: _ui, size: _size, ...native } = props
return native
})
</script>
<template>
<component :is="Primitive" v-bind="{ ...primitiveProps, ...attrs }" :ui="mergedUi">
<template v-for="(_, name) in $slots" #[name]="scope"
><slot :name="name as keyof ProgressSlots" v-bind="scope ?? {}"
/></template>
</component>
</template>
API
Variants and defaults
| Prop | Values | Default |
|---|---|---|
size | xs, sm, md, lg, xl | sm |
Props
| Prop | Type | Default | Description |
|---|---|---|---|
modelValue | number | null | null | Current progress value. null = indeterminate. |
min | number | 0 | Minimum value. |
max | number | 100 | Maximum value. |
orientation | "horizontal" | "vertical" | "horizontal" | Orientation of the progress bar. |
ariaLabel | string | — | Accessible label when no visible label is present. |
getValueLabel | (value: number | null, max: number) => string | — | Custom function to generate the aria-valuetext. |
ui | ProgressUi | — | CSS class overrides. |
Slots
| Slot | Scoped props | Description |
|---|---|---|
indicator | { value, percentage, max, min, state } | The filled indicator element. state is "indeterminate" when value is null. |