• Docs
  • Blog
    • 0.25.1

    • light

      dark

      system

      Switch mode
    • Cerberus

      Acheron

      Elysium

    Get Started
    Components
    Styling
    Theming

    Concepts

    OverviewCompositionTesting

    Layout

    Aspect RatioBleedBoxCenterContainerDividerFlexFloatGridLink OverlayScrollableStackWrap

    Components

    AccordionAdmonitionAvatarButtonCarouselCheckboxClipboardCollapsibleComboboxConfirm ModalCTAModalDate PickerDialogFieldFieldsetFile UploaderIcon ButtonInputLoading StatesMenuNotificationsNumber InputPin InputProgressPrompt ModalRadioRatingSelectSplit ButtonSwitchTableTabsTagTextTextareaToggleTooltip

    Utilities

    Client OnlyDownload TriggerEnvironmentFeature FlagsFocus TrapForFormat ByteFormat NumberFormat Relative TimeFrameHighlightJSON Tree ViewLocaleLocal StoragePortalPresenceShowsplitPropsTheme

    Progress Indicators

    Progress indicators are used to show the progress of a task.

    • npm
    • source
    • recipe
    • Ark
    import { ProgressBar, CircularProgress } from '@cerberus/react'

    Usage

    Progress Bar

    The ProgressBar component is used to display a linear progress indicator. It can be used in both determinate and indeterminate states.

    Rounded
    Block
    Copy
    import { ProgressBar, Tag } from '@cerberus/react'
    import { HStack, VStack } from 'styled-system/jsx'
    export function OverviewPreview() {
    return (
    <HStack
    gap="10"
    w="3/4"
    >
    <VStack gap="md" w="full">
    <ProgressBar
    id="rounded-example"
    label="rounded progress example"
    size="sm"
    now={75}
    />
    <Tag shape="pill">Rounded</Tag>
    </VStack>
    <VStack gap="md" w="full">
    <ProgressBar
    id="block-example"
    label="block progress example"
    size="sm"
    usage="block"
    now={75}
    />
    <Tag shape="pill">Block</Tag>
    </VStack>
    </HStack>
    )
    }

    Circular Progress

    The CircularProgress component is used to display a circular progress indicator. It will scale to the size of its container.

    25%
    50%
    75%
    100%
    Copy
    'use client'
    import { CircularProgress, Text } from '@cerberus/react'
    import { HStack } from 'styled-system/jsx'
    function NotStartedText() {
    return (
    <Text textAlign="center" textStyle="heading-2xs" px="md">
    Not Started
    </Text>
    )
    }
    function CircularPreview() {
    return (
    <HStack>
    <CircularProgress
    id="0"
    defaultValue={0}
    label={<NotStartedText />}
    hideValueText
    />
    <CircularProgress id="25" defaultValue={25} />
    <CircularProgress id="50" defaultValue={50} />
    <CircularProgress id="75" defaultValue={75} />
    <CircularProgress id="complete" label="complete" defaultValue={100} />
    </HStack>
    )
    }

    Sizes

    The CircularProgress component supports different sizes via the size prop.

    25%
    50%
    75%
    100%
    Copy
    function SizesPreview() {
    return (
    <HStack w="1/2">
    <CircularProgress id="25" defaultValue={25} size="xs" />
    <CircularProgress id="50" defaultValue={50} size="sm" />
    <CircularProgress id="75" defaultValue={75} size="md" />
    <CircularProgress
    id="complete"
    label="complete"
    defaultValue={100}
    size="lg"
    />
    </HStack>
    )
    }

    Hide Value Text

    The CircularProgress component allows you to hide the value text via the hideValueText prop.

    Copy
    function HideValueTextPreview() {
    return (
    <HStack justify="center" w="1/2">
    <CircularProgress
    defaultValue={0}
    label={<NotStartedText />}
    hideValueText
    />
    </HStack>
    )
    }

    Custom Label

    You can customize the label displayed below the value by passing a custom React node to the label prop.

    60%
    Copy
    function CustomLabelPreview() {
    return (
    <HStack justify="center" w="1/2">
    <CircularProgress
    defaultValue={60}
    label={
    <Text color="yellow" textStyle="heading-sm">
    Loading
    </Text>
    }
    />
    </HStack>
    )
    }

    Primitives

    You can utilize the primitive components or style props to customize the progress components.

    Progress Bar

    ComponentDescription
    ProgressBarRootThe container for the ProgressBar parts
    ProgressBarBarThe percentage bar of the amount

    Circular Progress

    ComponentDescription
    CircularProgressRootThe context provider for the CircularProgress parts
    CircularProgressInfoGroupThe container for the text parts
    CircularProgressLabelThe descriptive text below the value
    CircularProgressValueTextThe value of the progress, displayed in the center circle
    CircularProgressCircleThe container of the progress
    CircularProgressCircleTrackThe track of the progress
    CircularProgressCircleRangeThe range of the progress

    CSS Variables

    Both ProgressBar and CircularProgress components expose CSS variables for easy customization.

    Variable NameDescription
    --percentThe percent value for the root.
    --radiusThe border radius value.
    --circumferenceThe circumference value for the root.
    --offsetThe offset position of the element

    Data Attributes

    Both ProgressBar and CircularProgress components expose data attributes for styling based on state.

    Data AttributeValue.
    [data-scope]progress
    [data-part]The primitive layer (e.g. 'root')
    [data-max]The value of max
    [data-value]The value of the progress
    [data-state]The state of the progress (e.g. 'loading')
    [data-orientation]The orientation of the progress (e.g. 'horizontal', 'vertical')

    API

    ProgressBar

    NameDefaultDescription
    idThe id of the CircularProgress.
    labelA description of what the progress bar is for.
    sizemdThe size of the progress bar.
    usageroundedThe style of the progress bar.
    nowThe current progress value.
    indeterminatefalseIf the progress bar is in an indeterminate state.

    CircularProgress

    NameDefaultDescription
    hideValueTextfalseHides the value text in the center of the circle.
    labelA description of what the progress bar is for.
    sizemdThe size of the circular progress.
    usagefilledThe fill style of the center circle used for the bg.

    The CircularProgress component also accepts all the props of the CircularProgressRoot primitive props

    On this page

    • Edit this page on Github
    Cerberus Design System | Docs