progress-ring
A ring that fills to value of max, with what's in the middle from the default slot (the percentage if empty).
This one has no events: it shows what it's given.
Source: progress-ring.zb, and its registry item.
Install
npx shadcn@latest add https://zubra-js.github.io/zubra-ui/r/progress-ring.jsonpnpm dlx shadcn@latest add https://zubra-js.github.io/zubra-ui/r/progress-ring.jsonyarn dlx shadcn@latest add https://zubra-js.github.io/zubra-ui/r/progress-ring.jsonbunx --bun shadcn@latest add https://zubra-js.github.io/zubra-ui/r/progress-ring.json
npx shadcn@latest add https://zubra-js.github.io/zubra-ui/r/element/progress-ring.jsonpnpm dlx shadcn@latest add https://zubra-js.github.io/zubra-ui/r/element/progress-ring.jsonyarn dlx shadcn@latest add https://zubra-js.github.io/zubra-ui/r/element/progress-ring.jsonbunx --bun shadcn@latest add https://zubra-js.github.io/zubra-ui/r/element/progress-ring.json
npx shadcn@latest add https://zubra-js.github.io/zubra-ui/r/src/progress-ring.jsonpnpm dlx shadcn@latest add https://zubra-js.github.io/zubra-ui/r/src/progress-ring.jsonyarn dlx shadcn@latest add https://zubra-js.github.io/zubra-ui/r/src/progress-ring.jsonbunx --bun shadcn@latest add https://zubra-js.github.io/zubra-ui/r/src/progress-ring.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-ring.js"></script>The compiled install writes src/components/zubra/progress-ring.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-ring label="Storage used"></progress-ring>
<script type="module">
import './components/zubra/progress-ring.js';
const element = document.querySelector('progress-ring');
element.value = 68;
element.max = 100;
</script>import './components/zubra/progress-ring.js';
const value = 68;
const max = 100;
export function ProgressRingExample() {
return (
<progress-ring label="Storage used" value={value} max={max}></progress-ring>
);
}<script setup>
import './components/zubra/progress-ring.js';
const value = 68;
const max = 100;
</script>
<template>
<progress-ring label="Storage used" :value.prop="value" :max.prop="max"></progress-ring>
</template>
<!-- vite.config.js: vue({ template: { compilerOptions: { isCustomElement: (tag) => tag.includes('-') } } }) --><script>
import './components/zubra/progress-ring.js';
const value = 68;
const max = 100;
</script>
<progress-ring label="Storage used" {value} {max}></progress-ring>import { Component, CUSTOM_ELEMENTS_SCHEMA } from '@angular/core';
import './components/zubra/progress-ring.js';
@Component({
selector: 'app-progress-ring-example',
schemas: [CUSTOM_ELEMENTS_SCHEMA],
template: `
<progress-ring label="Storage used" [value]="value" [max]="max"></progress-ring>
`,
})
export class ProgressRingExample {
value = 68;
max = 100;
}API
| Property | Type | Default |
|---|---|---|
value | number | 0 |
max | number | 100 |
label | string | "Progress" |
| Slot | For |
|---|---|
(default) | The middle. |
Size
1.0 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.1 KB.