Skip to content

ProgressBar: Add more progress bar examples #6269

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
55 changes: 55 additions & 0 deletions packages/react/src/ProgressBar/ProgressBar.examples.stories.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
import type {Meta} from '@storybook/react-vite'
import {ProgressBar, Stack} from '..'
import {DotFillIcon} from '@primer/octicons-react'

export default {
title: 'Components/ProgressBar/Examples',
component: ProgressBar,
} as Meta<typeof ProgressBar>

export const WithVisibleTextValue = () => {
return (
<>
<ProgressBar progress={50} aria-label="Loading example" />
<p style={{color: 'var(--fgColor-muted)', font: 'var(--text-body-shorthand-medium)'}}>50% completed</p>
Copy link
Preview

Copilot AI Jul 2, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[nitpick] Consider using the Primer React Text component instead of a raw

with inline styles to maintain consistent typography and theming.

Copilot uses AI. Check for mistakes.

</>
)
}

export const MultipleSegments = () => {
return (
<>
<ProgressBar progress={50}>
<ProgressBar.Item
progress={30}
style={{backgroundColor: 'var(--bgColor-success-emphasis)'}}
Copy link
Preview

Copilot AI Jul 2, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[nitpick] Use the sx prop or the ProgressBar.Item bg prop with theme tokens instead of applying inline style with CSS variables, ensuring consistency with the design system theming.

Copilot uses AI. Check for mistakes.

aria-labelledby="done"
/>
<ProgressBar.Item
progress={15}
style={{backgroundColor: 'var(--bgColor-accent-emphasis)'}}
aria-labelledby="in-progress"
/>
<ProgressBar.Item
progress={5}
style={{backgroundColor: 'var(--bgColor-danger-emphasis)'}}
aria-labelledby="closed"
/>
</ProgressBar>
<Stack direction="horizontal" wrap="wrap" marginTop={2}>
<Stack direction="horizontal" gap="condensed" align="center" id="done">
<DotFillIcon fill="var(--bgColor-success-emphasis)" />
Done
</Stack>
<Stack direction="horizontal" gap="condensed" align="center" id="in-progress">
<DotFillIcon fill="var(--bgColor-accent-emphasis)" />
In progress
</Stack>
<Stack direction="horizontal" gap="condensed" align="center" id="closed">
<DotFillIcon fill="var(--bgColor-danger-emphasis)" />
Closed
</Stack>
</Stack>
</>
)
}
Loading