Label
50%<script lang="ts">
import { Progress, Slider } from '@skeletonlabs/skeleton-svelte';
let value = $state(50);
</script>
<div class="flex flex-col gap-8 items-center">
<Progress {value} class="items-center w-fit">
<Progress.Label>Label</Progress.Label>
<Progress.Circle>
<Progress.CircleTrack />
<Progress.CircleRange />
</Progress.Circle>
<Progress.ValueText />
</Progress>
<Slider class="w-full" value={[value]} onValueChange={(e) => (value = e.value[0])} step={10}>
<Slider.Control>
<Slider.Track>
<Slider.Range />
</Slider.Track>
<Slider.Thumb index={0}>
<Slider.HiddenInput />
</Slider.Thumb>
</Slider.Control>
</Slider>
</div>
Label
50%import { Progress, Slider } from '@skeletonlabs/skeleton-react';
import { useState } from 'react';
export default function Default() {
const [value, setValue] = useState(50);
return (
<div className="flex flex-col gap-8 items-center">
<Progress value={value} className="items-center w-fit">
<Progress.Label>Label</Progress.Label>
<Progress.Circle>
<Progress.CircleTrack />
<Progress.CircleRange />
</Progress.Circle>
<Progress.ValueText />
</Progress>
<Slider className="w-full" value={[value]} onValueChange={(e) => setValue(e.value[0])} step={10}>
<Slider.Control>
<Slider.Track>
<Slider.Range />
</Slider.Track>
<Slider.Thumb index={0}>
<Slider.HiddenInput />
</Slider.Thumb>
</Slider.Control>
</Slider>
</div>
);
}
Size
Use different sizes for context-appropriate indicators.
<script lang="ts">
import { Progress } from '@skeletonlabs/skeleton-svelte';
</script>
<div class="flex gap-4 justify-evenly items-center w-full">
<Progress value={75} class="w-fit">
<Progress.Circle style="--size: 48px; --thickness: 6px;">
<Progress.CircleTrack />
<Progress.CircleRange />
</Progress.Circle>
</Progress>
<Progress value={75} class="w-fit">
<Progress.Circle>
<Progress.CircleTrack />
<Progress.CircleRange />
</Progress.Circle>
</Progress>
<Progress value={75} class="w-fit">
<Progress.Circle style="--size: 125px; --thickness: 12px;">
<Progress.CircleTrack />
<Progress.CircleRange />
</Progress.Circle>
</Progress>
</div>
import { Progress } from '@skeletonlabs/skeleton-react';
import type { CSSProperties } from 'react';
export default function Size() {
return (
<div className="flex gap-4 justify-evenly items-center w-full">
<Progress value={75} className="w-fit">
<Progress.Circle style={{ '--size': '48px', '--thickness': '6px' } as CSSProperties}>
<Progress.CircleTrack />
<Progress.CircleRange />
</Progress.Circle>
</Progress>
<Progress value={75} className="w-fit">
<Progress.Circle>
<Progress.CircleTrack />
<Progress.CircleRange />
</Progress.Circle>
</Progress>
<Progress value={75} className="w-fit">
<Progress.Circle style={{ '--size': '125px', '--thickness': '12px' } as CSSProperties}>
<Progress.CircleTrack />
<Progress.CircleRange />
</Progress.Circle>
</Progress>
</div>
);
}
Color
Change the track and indicator colour using utility classes or custom CSS variables to match your design system.
<script lang="ts">
import { Progress } from '@skeletonlabs/skeleton-svelte';
</script>
<div class="flex gap-4 justify-evenly items-center w-full">
<Progress value={40} class="w-fit">
<Progress.Circle>
<Progress.CircleTrack class="stroke-primary-500/30" />
<Progress.CircleRange class="stroke-primary-500" />
</Progress.Circle>
</Progress>
<Progress value={40} class="w-fit">
<Progress.Circle>
<Progress.CircleTrack class="stroke-secondary-500/30" />
<Progress.CircleRange class="stroke-secondary-500" />
</Progress.Circle>
</Progress>
<Progress value={40} class="w-fit">
<Progress.Circle>
<Progress.CircleTrack class="stroke-tertiary-500/30" />
<Progress.CircleRange class="stroke-tertiary-500" />
</Progress.Circle>
</Progress>
</div>
import { Progress } from '@skeletonlabs/skeleton-react';
export default function Color() {
return (
<div className="flex gap-4 justify-evenly items-center w-full">
<Progress value={40} className="w-fit">
<Progress.Circle>
<Progress.CircleTrack className="stroke-primary-500/30" />
<Progress.CircleRange className="stroke-primary-500" />
</Progress.Circle>
</Progress>
<Progress value={40} className="w-fit">
<Progress.Circle>
<Progress.CircleTrack className="stroke-secondary-500/30" />
<Progress.CircleRange className="stroke-secondary-500" />
</Progress.Circle>
</Progress>
<Progress value={40} className="w-fit">
<Progress.Circle>
<Progress.CircleTrack className="stroke-tertiary-500/30" />
<Progress.CircleRange className="stroke-tertiary-500" />
</Progress.Circle>
</Progress>
</div>
);
}
Centered Content
Place content in the center of the circular progress if needed (for example, a numeric value).
50%
<script lang="ts">
import { Progress } from '@skeletonlabs/skeleton-svelte';
</script>
<Progress class="w-fit relative">
<div class="absolute inset-0 flex items-center justify-center">
<Progress.ValueText />
</div>
<Progress.Circle>
<Progress.CircleTrack />
<Progress.CircleRange />
</Progress.Circle>
</Progress>
50%
import { Progress } from '@skeletonlabs/skeleton-react';
export default function CenteredContent() {
return (
<Progress className="w-fit relative">
<div className="absolute inset-0 flex items-center justify-center">
<Progress.ValueText />
</div>
<Progress.Circle>
<Progress.CircleTrack />
<Progress.CircleRange />
</Progress.Circle>
</Progress>
);
}
Indeterminate
Set the value to null to make the progress indeterminate.
<script lang="ts">
import { Progress } from '@skeletonlabs/skeleton-svelte';
</script>
<Progress class="items-center w-fit" value={null}>
<Progress.Circle>
<Progress.CircleTrack />
<Progress.CircleRange />
</Progress.Circle>
<Progress.ValueText />
</Progress>
import { Progress } from '@skeletonlabs/skeleton-react';
export default function Default() {
return (
<Progress className="items-center w-fit" value={null}>
<Progress.Circle>
<Progress.CircleTrack />
<Progress.CircleRange />
</Progress.Circle>
<Progress.ValueText />
</Progress>
);
}
Format
Use the format prop to customize the output of the ValueText component. Options include percentage (default), decimal (0.0 - 1.0), or using the Intl API to provide custom formatting.
50%
0.5
€0.50
<script lang="ts">
import { Progress } from '@skeletonlabs/skeleton-svelte';
</script>
<div class="flex gap-4 justify-evenly items-center w-full">
<Progress class="items-center w-fit" formatOptions={{ style: 'percent' }}>
<Progress.Circle>
<Progress.CircleTrack />
<Progress.CircleRange />
</Progress.Circle>
<Progress.ValueText />
</Progress>
<Progress class="items-center w-fit" formatOptions={{ style: 'decimal' }}>
<Progress.Circle>
<Progress.CircleTrack />
<Progress.CircleRange />
</Progress.Circle>
<Progress.ValueText />
</Progress>
<Progress class="items-center w-fit" formatOptions={{ style: 'currency', currency: 'EUR' }}>
<Progress.Circle>
<Progress.CircleTrack />
<Progress.CircleRange />
</Progress.Circle>
<Progress.ValueText />
</Progress>
</div>
50%
0.5
€0.50
import { Progress } from '@skeletonlabs/skeleton-react';
export default function Format() {
return (
<div className="flex gap-4 justify-evenly items-center w-full">
<Progress className="items-center w-fit" formatOptions={{ style: 'percent' }}>
<Progress.Circle>
<Progress.CircleTrack />
<Progress.CircleRange />
</Progress.Circle>
<Progress.ValueText />
</Progress>
<Progress className="items-center w-fit" formatOptions={{ style: 'decimal' }}>
<Progress.Circle>
<Progress.CircleTrack />
<Progress.CircleRange />
</Progress.Circle>
<Progress.ValueText />
</Progress>
<Progress className="items-center w-fit" formatOptions={{ style: 'currency', currency: 'EUR' }}>
<Progress.Circle>
<Progress.CircleTrack />
<Progress.CircleRange />
</Progress.Circle>
<Progress.ValueText />
</Progress>
</div>
);
}
Custom Value Text
Provide a custom renderer for the ValueText if you need to show a different layout or label.
50 of 100
<script lang="ts">
import { Progress } from '@skeletonlabs/skeleton-svelte';
</script>
<Progress class="items-center w-fit">
<Progress.Circle>
<Progress.CircleTrack />
<Progress.CircleRange />
</Progress.Circle>
<Progress.ValueText>
<Progress.Context>
{#snippet children(progress)}
{progress().value} of {progress().max}
{/snippet}
</Progress.Context>
</Progress.ValueText>
</Progress>
50 of 100
import { Progress } from '@skeletonlabs/skeleton-react';
export default function CustomValueText() {
return (
<Progress className="items-center w-fit">
<Progress.Circle>
<Progress.CircleTrack />
<Progress.CircleRange />
</Progress.Circle>
<Progress.ValueText>
<Progress.Context>{(progress) => `${progress.value} of ${progress.max}`}</Progress.Context>
</Progress.ValueText>
</Progress>
);
}
API Reference
Root
| Property | Default | Type |
|---|---|---|
ids | - | Partial<{ root: string; track: string; label: string; circle: string; }> | undefined The ids of the elements in the progress bar. Useful for composition. |
value | - | number | null | undefinedThe controlled value of the progress bar. |
defaultValue | 50 | number | null | undefinedThe initial value of the progress bar when rendered. Use when you don't need to control the value of the progress bar. |
min | 0 | number | undefinedThe minimum allowed value of the progress bar. |
max | 100 | number | undefinedThe maximum allowed value of the progress bar. |
translations | - | IntlTranslations | undefinedThe localized messages to use. |
onValueChange | - | ((details: ValueChangeDetails) => void) | undefinedCallback fired when the value changes. |
formatOptions | { style: "percent" } | NumberFormatOptions | undefinedThe options to use for formatting the value. |
locale | "en-US" | string | undefinedThe locale to use for formatting the value. |
dir | "ltr" | "ltr" | "rtl" | undefinedThe document's text/writing direction. |
getRootNode | - | (() => ShadowRoot | Node | Document) | undefinedA root node to correctly resolve document in custom environments. E.x.: Iframes, Electron. |
orientation | "horizontal" | "horizontal" | "vertical" | undefinedThe orientation of the element. |
element | - | ((attributes: HTMLAttributes<"div">) => Element) | undefinedRender the element yourself |
RootProvider
| Property | Default | Type |
|---|---|---|
value | - | ProgressApi<PropTypes> |
element | - | ((attributes: HTMLAttributes<"div">) => Element) | undefinedRender the element yourself |
RootContext
| Property | Default | Type |
|---|---|---|
children | - | (progress: ProgressApi<PropTypes>) => ReactNode |
Label
| Property | Default | Type |
|---|---|---|
element | - | ((attributes: HTMLAttributes<"div">) => Element) | undefinedRender the element yourself |
ValueText
| Property | Default | Type |
|---|---|---|
element | - | ((attributes: HTMLAttributes<"span">) => Element) | undefinedRender the element yourself |
Track
| Property | Default | Type |
|---|---|---|
element | - | ((attributes: HTMLAttributes<"div">) => Element) | undefinedRender the element yourself |
Range
| Property | Default | Type |
|---|---|---|
element | - | ((attributes: HTMLAttributes<"div">) => Element) | undefinedRender the element yourself |
Circle
| Property | Default | Type |
|---|---|---|
element | - | ((attributes: HTMLAttributes<"svg">) => Element) | undefinedRender the element yourself |
CircleTrack
| Property | Default | Type |
|---|---|---|
element | - | ((attributes: HTMLAttributes<"circle">) => Element) | undefinedRender the element yourself |
CircleRange
| Property | Default | Type |
|---|---|---|
element | - | ((attributes: HTMLAttributes<"circle">) => Element) | undefinedRender the element yourself |