Skip to content
Merged
Show file tree
Hide file tree
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
5 changes: 5 additions & 0 deletions .changeset/yellow-trainers-arrive.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@primer/react": minor
---

Allow button count prop to accept a number or a string, to allow for human format, like 3.2k
4 changes: 4 additions & 0 deletions packages/react/src/Button/Button.features.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,10 @@ export const TrailingCounter = () => {

export const TrailingCounterWithNoText = () => <Button aria-label="Comments" leadingVisual={CommentIcon} count={3} />

export const TrailingCounterWithHumanFormat = () => (
<Button aria-label="Comments" leadingVisual={CommentIcon} count="3.2k" />
)

export const TrailingCounterAllVariants = () => {
const [count, setCount] = useState(0)
const onClick = () => {
Expand Down
2 changes: 1 addition & 1 deletion packages/react/src/Button/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ export type ButtonProps = {

children?: React.ReactNode

count?: number
count?: number | string
} & ButtonBaseProps

export type IconButtonProps = ButtonA11yProps & {
Expand Down
Loading