progress-bar
How far along something is: an upload, a setup checklist, a quota. A labelled progressbar with its value as a percentage, or (without value, or with indeterminate) a moving bar that says something is happening (still, for visitors who asked for less motion).
This one has no events: it shows what it's given.
Source: progress-bar.zb, and its registry item.
Install
npx shadcn@latest add https://zubra-js.github.io/zubra-ui/r/progress-bar.jsonpnpm dlx shadcn@latest add https://zubra-js.github.io/zubra-ui/r/progress-bar.jsonyarn dlx shadcn@latest add https://zubra-js.github.io/zubra-ui/r/progress-bar.jsonbunx --bun shadcn@latest add https://zubra-js.github.io/zubra-ui/r/progress-bar.json
npx shadcn@latest add https://zubra-js.github.io/zubra-ui/r/element/progress-bar.jsonpnpm dlx shadcn@latest add https://zubra-js.github.io/zubra-ui/r/element/progress-bar.jsonyarn dlx shadcn@latest add https://zubra-js.github.io/zubra-ui/r/element/progress-bar.jsonbunx --bun shadcn@latest add https://zubra-js.github.io/zubra-ui/r/element/progress-bar.json
npx shadcn@latest add https://zubra-js.github.io/zubra-ui/r/src/progress-bar.jsonpnpm dlx shadcn@latest add https://zubra-js.github.io/zubra-ui/r/src/progress-bar.jsonyarn dlx shadcn@latest add https://zubra-js.github.io/zubra-ui/r/src/progress-bar.jsonbunx --bun shadcn@latest add https://zubra-js.github.io/zubra-ui/r/src/progress-bar.json
<link rel="stylesheet" href="https://zubra-js.github.io/zubra-ui/themes/default.css">
<script type="module" src="https://zubra-js.github.io/zubra-ui/cdn/progress-bar.js"></script>The compiled install writes src/components/zubra/progress-bar.js and the theme, and adds @zubra/runtime to your dependencies. The one-file install writes the same path as a plain custom element that needs nothing installed (or download it and load it with a <script type="module">); it's smaller on a page with one to three components, the shared runtime with more.
Usage
<progress-bar label="Uploading photos"></progress-bar>
<script type="module">
import './components/zubra/progress-bar.js';
const element = document.querySelector('progress-bar');
element.value = 64;
</script>import './components/zubra/progress-bar.js';
const value = 64;
export function ProgressBarExample() {
return (
<progress-bar label="Uploading photos" value={value}></progress-bar>
);
}<script setup>
import './components/zubra/progress-bar.js';
const value = 64;
</script>
<template>
<progress-bar label="Uploading photos" :value.prop="value"></progress-bar>
</template>
<!-- vite.config.js: vue({ template: { compilerOptions: { isCustomElement: (tag) => tag.includes('-') } } }) --><script>
import './components/zubra/progress-bar.js';
const value = 64;
</script>
<progress-bar label="Uploading photos" {value}></progress-bar>import { Component, CUSTOM_ELEMENTS_SCHEMA } from '@angular/core';
import './components/zubra/progress-bar.js';
@Component({
selector: 'app-progress-bar-example',
schemas: [CUSTOM_ELEMENTS_SCHEMA],
template: `
<progress-bar label="Uploading photos" [value]="value"></progress-bar>
`,
})
export class ProgressBarExample {
value = 64;
}API
| Property | Type | Default |
|---|---|---|
value | unknown | null |
max | number | 100 |
label | string | "Progress" |
indeterminate | boolean | false |
showValueattribute show-value | boolean | true |
Size
1.1 KB gzipped for the component, plus the runtime, which every Zubra component on a page shares (up to 22.1 KB, all of it). On its own, with the parts of the runtime it uses, it's 17.3 KB.