'use client'
import { Progress } from '@saas-ui/react'
export const ProgressBasic = () => {
return (
<Progress.Root maxW="240px" value={50}>
<Progress.Track>
<Progress.Range />
</Progress.Track>
</Progress.Root>
)
}
import { Progress } from '@saas-ui/react/progress'
<Progress.Root>
<Progress.Label />
<Progress.ValueText />
<Progress.Bar />
</Progress.Root>
Use the size
prop to change the size of the progress bar.
'use client'
import { Stack } from '@chakra-ui/react'
import { Progress } from '@saas-ui/react'
export const ProgressWithSizes = () => {
return (
<Stack gap="4" maxW="240px">
<Progress.Root size="xs">
<Progress.Track>
<Progress.Range />
</Progress.Track>
</Progress.Root>
<Progress.Root size="sm">
<Progress.Track>
<Progress.Range />
</Progress.Track>
</Progress.Root>
<Progress.Root size="md">
<Progress.Track>
<Progress.Range />
</Progress.Track>
</Progress.Root>
<Progress.Root size="lg">
<Progress.Track>
<Progress.Range />
</Progress.Track>
</Progress.Root>
</Stack>
)
}
Use the variant
prop to change the visual style of the progress bar.
'use client'
import { Stack } from '@chakra-ui/react'
import { Progress } from '@saas-ui/react'
export const ProgressWithVariants = () => {
return (
<Stack gap="4" maxW="200px">
<Progress.Root variant="subtle">
<Progress.Track>
<Progress.Range />
</Progress.Track>
</Progress.Root>
<Progress.Root variant="outline">
<Progress.Track>
<Progress.Range />
</Progress.Track>
</Progress.Root>
</Stack>
)
}
Use the colorPalette
prop to change the color of the progress bar.
gray
red
green
blue
teal
pink
purple
cyan
orange
yellow
'use client'
import { Stack, Text } from '@chakra-ui/react'
import { Progress } from '@saas-ui/react'
import { colorPalettes } from '../lib/color-palettes'
export const ProgressWithColors = () => {
return (
<Stack gap="2" align="flex-start">
{colorPalettes.map((colorPalette) => (
<Stack
align="center"
key={colorPalette}
direction="row"
gap="10"
px="4"
>
<Text minW="8ch">{colorPalette}</Text>
<Progress.Root
width="120px"
defaultValue={40}
colorPalette={colorPalette}
variant="outline"
>
<Progress.Track>
<Progress.Range />
</Progress.Track>
</Progress.Root>
<Progress.Root
width="120px"
defaultValue={40}
colorPalette={colorPalette}
variant="subtle"
>
<Progress.Track>
<Progress.Range />
</Progress.Track>
</Progress.Root>
</Stack>
))}
</Stack>
)
}
Compose the ProgressLabel
and ProgressValueText
components to create an
inline label for the progress bar.
'use client'
import { HStack } from '@chakra-ui/react'
import { Progress } from '@saas-ui/react'
export const ProgressWithInlineLabel = () => {
return (
<Progress.Root defaultValue={40} maxW="sm">
<HStack gap="5">
<Progress.Label>Usage</Progress.Label>
<Progress.Track flex="1">
<Progress.Range />
</Progress.Track>
<Progress.ValueText>40%</Progress.ValueText>
</HStack>
</Progress.Root>
)
}
Use the info
prop to add a tooltip to the progress bar.
'use client'
import { InfoTip, Progress } from '@saas-ui/react'
export const ProgressWithLabelInfo = () => {
return (
<Progress.Root maxW="240px">
<Progress.Label mb="2">
Uploading <InfoTip>Uploading document to the server</InfoTip>
</Progress.Label>
<Progress.Track>
<Progress.Range />
</Progress.Track>
</Progress.Root>
)
}
Set the value to null
to show an indeterminate progress bar.
'use client'
import { Progress } from '@saas-ui/react'
export const ProgressIndeterminate = () => {
return (
<Progress.Root maxW="240px" value={null}>
<Progress.Track>
<Progress.Range />
</Progress.Track>
</Progress.Root>
)
}
Set the striped
prop to true
to add stripes to the progress bar.
'use client'
import { Progress } from '@saas-ui/react'
export const ProgressWithStripes = () => {
return (
<Progress.Root maxW="240px" striped>
<Progress.Track>
<Progress.Range />
</Progress.Track>
</Progress.Root>
)
}
Set the animated
prop to true
to animate the stripes.
'use client'
import { Progress } from '@saas-ui/react'
export const ProgressWithAnimatedStripes = () => {
return (
<Progress.Root maxW="240px" striped animated>
<Progress.Track>
<Progress.Range />
</Progress.Track>
</Progress.Root>
)
}
Prop | Default | Type |
---|---|---|
max | '100' | number The maximum allowed value of the progress bar. |
min | '0' | number The minimum allowed value of the progress bar. |
orientation | '\'horizontal\'' | Orientation The orientation of the element. |
value | '50' | number The current value of the progress bar. |
colorPalette | 'gray' | 'gray' | 'red' | 'orange' | 'yellow' | 'green' | 'teal' | 'blue' | 'cyan' | 'purple' | 'pink' | 'accent' The color palette of the component |
variant | 'outline' | 'outline' | 'subtle' The variant of the component |
shape | 'rounded' | 'square' | 'rounded' | 'pill' The shape of the component |
size | 'md' | 'xs' | 'sm' | 'md' | 'lg' The size of the component |
asChild | boolean Use the provided child element as the default rendered element, combining their props and behavior. For more details, read our Composition guide. | |
ids | Partial<{ root: string; track: string; label: string; circle: string }> The ids of the elements in the progress bar. Useful for composition. | |
translations | IntlTranslations The localized messages to use. | |
striped | 'true' | 'false' The striped of the component | |
animated | 'true' | 'false' The animated of the component | |
as | React.ElementType The underlying element to render. | |
unstyled | boolean Whether to remove the component's style. |