Skip to content
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

📝Update button documentation for fullWidth #3093

Merged
merged 2 commits into from
Oct 12, 2023
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
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ Tooltip accessible for people using keyboard navigation, as the button is still
<Canvas of={ComponentStories.WithTooltip} />

### Full width
Use boolean prop `fullWidth`
When stretching a button beyond its intrinsic width, the `fullWidth` prop can be used to position icon at the edge.

<Canvas of={ComponentStories.FullWidth} />

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -286,7 +286,18 @@ WithTooltip.storyName = 'Disabled buttons and tooltip'

export const FullWidth: StoryFn<ButtonProps> = () => (
<>
<Button fullWidth>Primary</Button>
<Button fullWidth>
<Icon data={refresh} size={16}></Icon>
Fullwidth
</Button>
<Button fullWidth>
Fullwidth
<Icon data={refresh} size={16}></Icon>
</Button>
<Button>
<Icon data={refresh} size={16}></Icon>
not Fullwidth
</Button>
</>
)
FullWidth.storyName = 'Full width'
Expand Down
2 changes: 1 addition & 1 deletion packages/eds-core-react/src/components/Button/Button.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ export type ButtonProps = {
* @default 'button'
*/
type?: string
/** FullWidth (stretched) button */
/** Floats icon to the side if button is stretched beyond its intrinsic width */
fullWidth?: boolean
} & ButtonHTMLAttributes<HTMLButtonElement>

Expand Down