Skip to content

Commit

Permalink
chore: update button stories and docs
Browse files Browse the repository at this point in the history
  • Loading branch information
segunadebayo committed Apr 17, 2021
1 parent 2aef51b commit 03cfcf8
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 9 deletions.
9 changes: 5 additions & 4 deletions packages/button/stories/button.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -155,11 +155,11 @@ export const WithLoading = () => (
</Stack>
)

export const WithLoadingSpinnerPosition = () => (
export const WithLoadingSpinnerPlacement = () => (
<Stack direction="row" spacing={4} align="center">
<Button
isLoading
loadingText="Submitting..."
loadingText="Loading"
colorScheme="teal"
variant="outline"
spinnerPosition="start"
Expand All @@ -168,15 +168,16 @@ export const WithLoadingSpinnerPosition = () => (
</Button>
<Button
isLoading
loadingText="Continuing..."
loadingText="Loading"
colorScheme="teal"
variant="outline"
spinnerPosition="end"
spinnerPlacement="end"
>
Continue
</Button>
</Stack>
)

export const withDisabled = () => (
<HStack spacing="24px">
<Button isDisabled colorScheme="teal" variant="solid">
Expand Down
36 changes: 31 additions & 5 deletions website/pages/docs/form/button.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ You can also pass the `loadingText` prop to show a spinner and the loading text.
</Stack>
```

You can also change the spinner itself to use custom loaders as per your design
You can change the spinner element to use custom loaders as per your design
requirements. Pass the `spinner` prop and set it to a custom react element.

```jsx
Expand All @@ -150,6 +150,32 @@ requirements. Pass the `spinner` prop and set it to a custom react element.
</Button>
```

When a `loadingText` is present, you can change the placement of the spinner
element to either `start` or `end`. It is `start` by default.

```jsx
<Stack direction="row" spacing={4} align="center">
<Button
isLoading
loadingText="Loading"
colorScheme="teal"
variant="outline"
spinnerPosition="start"
>
Submit
</Button>
<Button
isLoading
loadingText="Loading"
colorScheme="teal"
variant="outline"
spinnerPlacement="end"
>
Continue
</Button>
</Stack>
```

### Social Buttons

We've included the colors for common social media platforms, and you can simply
Expand Down Expand Up @@ -262,14 +288,14 @@ props to style the button.

### Button Props

`Button` composes the `Box` component, so you can pass all its props.
These are props specific to the `Button` component:
`Button` composes the `Box` component, so you can pass all its props. These are
props specific to the `Button` component:

<PropsTable of="Button" />

### Button Group Props

`ButtonGroup` composes the `Box` component, so you can pass all its props.
These are props specific to the `ButtonGroup` component:
`ButtonGroup` composes the `Box` component, so you can pass all its props. These
are props specific to the `ButtonGroup` component:

<PropsTable of="ButtonGroup" />

0 comments on commit 03cfcf8

Please sign in to comment.