Progress
Lightweight wrapper around TxProgressBar for standard linear progress rows.
Usage
Progress States
Loading demo...
Progress Row
Loading demo...
Custom Text Formatting
<template>
<TuffProgress :percentage="42" :format="value => `Done ${value}%`" />
</template>
Indeterminate Progress
<template>
<TuffProgress indeterminate :percentage="60" :show-text="false" />
</template>
For unknown-duration work, prefer an indeterminate state instead of showing a fake percentage.
Best Practices
- Use
TuffProgressfor simple rows where the legacy public name and compact API are enough. - Use
TxProgressBardirectly for segments, tooltip, messages, loading/success/error booleans, flow effects, or custom text placement. - Keep
strokeWidthmodest; this wrapper is intended for row-level progress, not hero metrics. - Do not show stale percentages for unknown work. Use
indeterminateand hide text unless you can provide a trustworthy value. - Pair progress with a concise status label when the surrounding UI needs operational context.
API Reference
Props
| Prop | Type | Default | Description |
|---|---|---|---|
percentage | number | 0 | Determinate progress value forwarded to TxProgressBar. |
status | 'success' | 'error' | 'warning' | '' | '' | Visual status tone forwarded to TxProgressBar. |
strokeWidth | number | 6 | Bar height in pixels. |
showText | boolean | true | Shows outside progress text. |
indeterminate | boolean | false | Enables indeterminate progress mode. |
format | (percentage: number) => string | - | Custom formatter for displayed determinate text. |
Events
TuffProgress does not emit component events. Observe progress changes in the host task state and update props.
Slots
TuffProgress does not expose slots. Use format for text customization, or use TxProgressBar directly when the layout needs custom content.
Overview
TuffProgressrendersTxProgressBarand does not add its own wrapper DOM.percentage,status,indeterminate,showText, andformatare forwarded directly.strokeWidthis converted to a CSS height string such as"6px"and passed asheight.- Text placement is fixed to
outside. - The underlying bar uses
maskVariant="plain"; the track followsTxProgressBar's default styling (flat rimless track, gradient fill). - Determinate progress exposes
role="progressbar"andaria-valuenowthroughTxProgressBar. - Indeterminate progress omits
aria-valuenowand applies the progress-bar indeterminate class. - The install entry registers the component name
TuffProgress.
Technologies
- Source:
packages/tuffex/packages/components/src/progress/src/TxProgress.vueconfirms the wrapper rendersTxProgressBardirectly and mapsstrokeWidthtoheight. - Verified coverage: Coverage:
packages/tuffex/packages/components/src/progress/__tests__/progress.test.tscovers forwarded status, custom formatting,strokeWidth, hidden text, and indeterminate ARIA behavior. - Export:
packages/tuffex/packages/components/src/progress/index.tsregisters the public component nameTuffProgress.
查看源码
packages/tuffex/packages/components/src/progress/index.ts