Skip to content

Progress

A neo-brutalist style progress bar built on reka-ui's Progress primitive.

Demo

Preview

不确定状态

显示百分比标签

65%

Installation

pnpm dlx brutx-vue@latest add progress

Usage

vue
<script setup>
import { ref } from 'vue'
import { Progress } from 'brutx-ui-vue'

const progress = ref(45)
</script>

<template>
    <Progress v-model="progress" />
</template>

With Max Value

vue
<script setup>
import { ref } from 'vue'
import { Progress } from 'brutx-ui-vue'

const progress = ref(75)
</script>

<template>
    <Progress v-model="progress" :max="100" />
</template>

Indeterminate State

When the exact progress cannot be determined, set indeterminate to true. The progress bar will ignore modelValue and the indicator will cycle with a CSS animation along the track.

vue
<script setup>
import { Progress } from 'brutx-ui-vue'
</script>

<template>
    <Progress indeterminate />
</template>

Show Percentage Label

When showLabel is set to true, a percentage text is displayed in the center of the progress bar (calculated from modelValue and max, rounded to the nearest integer). The label is not shown in indeterminate state.

vue
<script setup>
import { ref } from 'vue'
import { Progress } from 'brutx-ui-vue'

const progress = ref(65)
</script>

<template>
    <Progress v-model="progress" show-label />
</template>

Variants

variant controls the fill color of the progress indicator.

VariantDescription
defaultPrimary color (bg-brutal-primary)
secondarySecondary color (bg-brutal-secondary)
accentAccent color (bg-brutal-accent)
successSuccess color (bg-brutal-success)
dangerDestructive color (bg-brutal-destructive)
vue
<script setup>
import { ref } from 'vue'
import { Progress } from 'brutx-ui-vue'

const value = ref(60)
</script>

<template>
    <div class="flex flex-col gap-4">
        <Progress v-model="value" variant="default" />
        <Progress v-model="value" variant="secondary" />
        <Progress v-model="value" variant="accent" />
        <Progress v-model="value" variant="success" />
        <Progress v-model="value" variant="danger" />
    </div>
</template>

Sizes

size controls the height of the progress bar.

SizeDescription
smSmall size (h-3)
defaultDefault size (h-6)
lgLarge size (h-8)
vue
<script setup>
import { ref } from 'vue'
import { Progress } from 'brutx-ui-vue'

const value = ref(50)
</script>

<template>
    <div class="flex flex-col gap-4">
        <Progress v-model="value" size="sm" />
        <Progress v-model="value" size="default" />
        <Progress v-model="value" size="lg" />
    </div>
</template>

Props

Progress

PropTypeDefaultDescription
modelValuenumber0Current progress value
maxnumber100Maximum value
size'sm' | 'default' | 'lg''default'Progress bar height preset
variant'default' | 'secondary' | 'accent' | 'success' | 'danger''default'Indicator color variant
indeterminatebooleanfalseWhether in indeterminate state (indicator cycles, ignores modelValue)
showLabelbooleanfalseWhether to show a percentage label in the center of the progress bar (not shown in indeterminate state)
classstringCustom CSS class

Accessibility

The component is built on reka-ui's ProgressRoot primitive and automatically includes the following accessibility attributes:

  • role="progressbar"
  • aria-valuemin="0"
  • aria-valuemax corresponds to the max value
  • aria-valuenow corresponds to the current modelValue (not set in indeterminate state)

Brute force builds.