Skip to content

Commit

Permalink
πŸ“ Improved documentation on Button (#2742)
Browse files Browse the repository at this point in the history
πŸ“ Improved documentation on Button and Tooltip
  • Loading branch information
denektenina authored Jan 25, 2023
1 parent 3e95ac5 commit 0b74658
Show file tree
Hide file tree
Showing 4 changed files with 188 additions and 166 deletions.
40 changes: 23 additions & 17 deletions packages/eds-core-react/src/components/Button/Button.docs.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -41,16 +41,22 @@ import { Button } from '@equinor/eds-core-react'
<Button as={Link} to="/about">About</Button>
```

## Accessibility
The `aria-disabled` attribute makes it possible to semantically disable the `Button` without hiding it from assistive technologies, such as screen readers.
In EDS, the `Button` will be visually styled as disabled, but it is up to the developer to actually disable the button.

<Story id="inputs-button-button--accessibility" />

## Examples

### Basic
The `Button` come with four variants; `contained`, `outlined`, `ghost` and `ghost_icon`.
The `Button` come with five variants; `contained`, `contained_icon`, `outlined`, `ghost` and `ghost_icon`.

<Story id="inputs-button-button--basic" />

### Icon button
The `ghost_icon` & `contained_icon`variant is meant for standalone icon buttons using the `<Icon>` component.
Make sure to defined `aria-label` with descriptive text of `Button` interaction.
Make sure to define `aria-label` with descriptive text of `Button` interaction.

<Story id="inputs-button-button--icon-button" />

Expand All @@ -68,32 +74,32 @@ Use variants to differentiate the hierarchy.

<Story id="inputs-button-button--hierarchy" />

### File upload
Example of how to do file upload button. Please note this demo only works in Storybook Canvas (isolated example only).
### Compact
Compact mode is toggled using [EdsProvider](?path=/docs/edsprovider--introduction).

<Story id="inputs-button-button--file-upload" />
Note that compact mode should come with the possibility to switch to normal mode for accessibility reasons.

<Story id="inputs-button-button--compact" />

### Progress button
Use the `Progress` component if you need progress indication on a button.

<Story id="inputs-button-button--progress-button" />

### All
Example All button combinations.
### Disabled buttons and tooltip
Due to inconsistent browser support for mouse events on disabled buttons, `Tooltip`
should not be used in combination with `disabled` on `Button`. Instead use `aria-disabled`
and disable the `onClick` in the code. This has the added benefit of making the
Tooltip accessible for people using keyboard navigation, as the button is still focusable.

<Story id="inputs-button-button--all" />

### Accessibility
The `aria-disabled` attribute makes it possible to semantically disable the `Button` without hiding it from assistive technologies, such as screen readers.
In EDS, the `Button` is visually styled as disabled, but it is up to the developer to actually disable the button.

<Story id="inputs-button-button--accessibility" />
<Story id="inputs-button-button--with-tooltip" />

### Full width
Use boolean prop `fullWidth`

<Story id="inputs-button-button--full-width" />

### Compact
Compact `Button` using `EdsProvider`.
### All
All button combinations.

<Story id="inputs-button-button--compact" />
<Story id="inputs-button-button--all" />
Loading

0 comments on commit 0b74658

Please sign in to comment.