Skip to content
Merged
Show file tree
Hide file tree
Changes from 3 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
7 changes: 7 additions & 0 deletions .changeset/cuddly-rice-press.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
'@primer/react': patch
---

Update the `children` prop for `Button` to be optional

<!-- Changed components: Button, IconButton -->
47 changes: 24 additions & 23 deletions src/Button/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,29 +38,30 @@ export type ButtonBaseProps = {
} & SxProp &
React.ButtonHTMLAttributes<HTMLButtonElement>

export type ButtonProps = {
/**
* The icon for the IconButton
*/
icon?: React.ElementType | null | undefined
/**
* The leading icon comes before button content
*/
leadingIcon?: React.ElementType | null | undefined
/**
* The trailing icon comes after button content
*/
trailingIcon?: React.ElementType | null | undefined
/**
* Trailing action appears to the right of the trailing visual and is always locked to the end
*/
trailingAction?: React.ElementType | null | undefined
children: React.ReactNode
/**
* Content alignment for when visuals are present
*/
alignContent?: AlignContent
} & ButtonBaseProps
export type ButtonProps = React.PropsWithChildren<
{
/**
* The icon for the IconButton
*/
icon?: React.ElementType | null | undefined
/**
* The leading icon comes before button content
*/
leadingIcon?: React.ElementType | null | undefined
/**
* The trailing icon comes after button content
*/
trailingIcon?: React.ElementType | null | undefined
/**
* Trailing action appears to the right of the trailing visual and is always locked to the end
*/
trailingAction?: React.ElementType | null | undefined
/**
* Content alignment for when visuals are present
*/
alignContent?: AlignContent
} & ButtonBaseProps
>

export type IconButtonProps = ButtonA11yProps & {
icon: React.ElementType
Expand Down