Skip to content

Commit

Permalink
[docs] Revise and expand Joy UI Button doc (#35737)
Browse files Browse the repository at this point in the history
  • Loading branch information
samuelsycamore authored Jan 9, 2023
1 parent e75eb4b commit 401c104
Show file tree
Hide file tree
Showing 15 changed files with 206 additions and 80 deletions.
4 changes: 2 additions & 2 deletions docs/data/base/components/button/button.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,14 @@ waiAria: https://www.w3.org/WAI/ARIA/apg/patterns/button/

<p class="description">Buttons let users take actions and make choices with a single tap.</p>

{{"component": "modules/components/ComponentLinkHeader.js", "design": false}}

## Introduction

The Unstyled Button component replaces the native HTML `<button>` element, and offers expanded options for styling and accessibility.

{{"demo": "UnstyledButtonIntroduction.tsx", "defaultCodeOpen": false, "bg": "gradient"}}

{{"component": "modules/components/ComponentLinkHeader.js", "design": false}}

## Component

### Usage
Expand Down
13 changes: 13 additions & 0 deletions docs/data/joy/components/button/BasicButtons.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import * as React from 'react';
import Button from '@mui/joy/Button';
import Box from '@mui/joy/Box';

export default function BasicButtons() {
return (
<Box sx={{ display: 'flex', gap: 2, flexWrap: 'wrap' }}>
<Button>Button</Button>
<Button disabled>Disabled</Button>
<Button loading>Loading</Button>
</Box>
);
}
13 changes: 13 additions & 0 deletions docs/data/joy/components/button/BasicButtons.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import * as React from 'react';
import Button from '@mui/joy/Button';
import Box from '@mui/joy/Box';

export default function BasicButtons() {
return (
<Box sx={{ display: 'flex', gap: 2, flexWrap: 'wrap' }}>
<Button>Button</Button>
<Button disabled>Disabled</Button>
<Button loading>Loading</Button>
</Box>
);
}
3 changes: 3 additions & 0 deletions docs/data/joy/components/button/BasicButtons.tsx.preview
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
<Button>Button</Button>
<Button disabled>Disabled</Button>
<Button loading>Loading</Button>
2 changes: 1 addition & 1 deletion docs/data/joy/components/button/ButtonDisabled.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import * as React from 'react';
import Box from '@mui/joy/Box';
import Button from '@mui/joy/Button';

export default function ButtonVariants() {
export default function DisabledButtons() {
return (
<Box sx={{ display: 'flex', gap: 2, flexWrap: 'wrap' }}>
<Button disabled variant="solid">
Expand Down
2 changes: 1 addition & 1 deletion docs/data/joy/components/button/ButtonDisabled.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import * as React from 'react';
import Box from '@mui/joy/Box';
import Button from '@mui/joy/Button';

export default function ButtonVariants() {
export default function DisabledButtons() {
return (
<Box sx={{ display: 'flex', gap: 2, flexWrap: 'wrap' }}>
<Button disabled variant="solid">
Expand Down
23 changes: 14 additions & 9 deletions docs/data/joy/components/button/ButtonLoading.js
Original file line number Diff line number Diff line change
@@ -1,17 +1,22 @@
import * as React from 'react';
import Stack from '@mui/joy/Stack';
import SendIcon from '@mui/icons-material/Send';
import Box from '@mui/joy/Box';
import Button from '@mui/joy/Button';

export default function ButtonLoading() {
export default function LoadingButtons() {
return (
<Stack spacing={2} direction="row">
<Button loading endDecorator={<SendIcon />} variant="solid">
Send
<Box sx={{ display: 'flex', gap: 2, flexWrap: 'wrap' }}>
<Button loading variant="solid">
Solid
</Button>
<Button loading loadingIndicator="Loading…" variant="outlined">
Fetch data
<Button loading variant="soft">
Soft
</Button>
</Stack>
<Button loading variant="outlined">
Outlined
</Button>
<Button loading variant="plain">
Plain
</Button>
</Box>
);
}
23 changes: 14 additions & 9 deletions docs/data/joy/components/button/ButtonLoading.tsx
Original file line number Diff line number Diff line change
@@ -1,17 +1,22 @@
import * as React from 'react';
import Stack from '@mui/joy/Stack';
import SendIcon from '@mui/icons-material/Send';
import Box from '@mui/joy/Box';
import Button from '@mui/joy/Button';

export default function ButtonLoading() {
export default function LoadingButtons() {
return (
<Stack spacing={2} direction="row">
<Button loading endDecorator={<SendIcon />} variant="solid">
Send
<Box sx={{ display: 'flex', gap: 2, flexWrap: 'wrap' }}>
<Button loading variant="solid">
Solid
</Button>
<Button loading loadingIndicator="Loading…" variant="outlined">
Fetch data
<Button loading variant="soft">
Soft
</Button>
</Stack>
<Button loading variant="outlined">
Outlined
</Button>
<Button loading variant="plain">
Plain
</Button>
</Box>
);
}
14 changes: 10 additions & 4 deletions docs/data/joy/components/button/ButtonLoading.tsx.preview
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
<Button loading endDecorator={<SendIcon />} variant="solid">
Send
<Button loading variant="solid">
Solid
</Button>
<Button loading loadingIndicator="Loading…" variant="outlined">
Fetch data
<Button loading variant="soft">
Soft
</Button>
<Button loading variant="outlined">
Outlined
</Button>
<Button loading variant="plain">
Plain
</Button>
17 changes: 17 additions & 0 deletions docs/data/joy/components/button/ButtonLoadingIndicator.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import * as React from 'react';
import Stack from '@mui/joy/Stack';
import SendIcon from '@mui/icons-material/Send';
import Button from '@mui/joy/Button';

export default function ButtonLoading() {
return (
<Stack spacing={2} direction="row">
<Button loading endDecorator={<SendIcon />} variant="solid">
Send
</Button>
<Button loading loadingIndicator="Loading…" variant="outlined">
Fetch data
</Button>
</Stack>
);
}
17 changes: 17 additions & 0 deletions docs/data/joy/components/button/ButtonLoadingIndicator.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import * as React from 'react';
import Stack from '@mui/joy/Stack';
import SendIcon from '@mui/icons-material/Send';
import Button from '@mui/joy/Button';

export default function ButtonLoading() {
return (
<Stack spacing={2} direction="row">
<Button loading endDecorator={<SendIcon />} variant="solid">
Send
</Button>
<Button loading loadingIndicator="Loading…" variant="outlined">
Fetch data
</Button>
</Stack>
);
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<Button loading endDecorator={<SendIcon />} variant="solid">
Send
</Button>
<Button loading loadingIndicator="Loading…" variant="outlined">
Fetch data
</Button>
12 changes: 12 additions & 0 deletions docs/data/joy/components/button/ButtonsSimple.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import * as React from 'react';
import Button from '@mui/joy/Button';
import Box from '@mui/joy/Box';

export default function UnstyledButtonsSimple() {
return (
<Box>
<Button>Button</Button>
<Button disabled>Disabled</Button>
</Box>
);
}
2 changes: 2 additions & 0 deletions docs/data/joy/components/button/ButtonsSimple.tsx.preview
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
<Button>Button</Button>
<Button disabled>Disabled</Button>
Loading

0 comments on commit 401c104

Please sign in to comment.