Skip to content

Commit

Permalink
📝Update button documentation for fullWidth (#3093)
Browse files Browse the repository at this point in the history
* 📝Update button documentation for fullWidth

* slightly reword description
  • Loading branch information
oddvernes authored Oct 12, 2023
1 parent d1b768b commit 2ee706d
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 3 deletions.
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
13 changes: 12 additions & 1 deletion packages/eds-core-react/src/components/Button/Button.stories.tsx
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

0 comments on commit 2ee706d

Please sign in to comment.