import { Progress } from '@skeletonlabs/skeleton-svelte';
<Progress value={50} max={100}>50%</Progress>
Colors
Set the color using the meterBg
prop.
import { Progress } from '@skeletonlabs/skeleton-svelte';
<div class="flex w-full flex-col gap-8">
<Progress value={50} max={100} meterBg="bg-primary-500" />
<Progress value={50} max={100} meterBg="bg-secondary-500" />
<Progress value={50} max={100} meterBg="bg-tertiary-500" />
Height
Set the height using the height
prop.
import { Progress } from '@skeletonlabs/skeleton-svelte';
<div class="flex w-full flex-col gap-8">
<Progress value={50} max={100} height="h-1" />
<Progress value={50} max={100} />
<Progress value={50} max={100} height="h-4" />
Indeterminate
An indeterminate animation will be shown when the value is set to null
.
import { Progress } from '@skeletonlabs/skeleton-svelte';
<Progress value={null} />
Custom Animations
A custom indeterminate animation can be set by providing an animation class to the meterAnimate
prop.
import { Progress } from '@skeletonlabs/skeleton-svelte';
<Progress value={null} meterAnimate="my-custom-animation" />
Note: The `:global` modifier is used to apply the
animation to the progress bar because Svelte styles
:global(.my-custom-animation) {
animation: my-custom-animation 2s ease-in-out infinite;
@keyframes my-custom-animation {
Native Alternative
A native progress element is available cross browser, but does not support indeterminate animations.
<progress class="progress" value="50" max="100"></progress>