2020-02-13 19:43:20 -03:00
|
|
|
---
|
|
|
|
|
name: Button
|
|
|
|
|
menu: Components
|
|
|
|
|
route: components/button
|
|
|
|
|
---
|
|
|
|
|
|
|
|
|
|
import { Playground, Props } from 'docz';
|
|
|
|
|
import Button from './';
|
|
|
|
|
|
|
|
|
|
# Button
|
|
|
|
|
|
|
|
|
|
Buttons are used to execute actions when users interacts with them.
|
|
|
|
|
|
2020-03-03 19:36:45 -03:00
|
|
|
## Import
|
|
|
|
|
|
|
|
|
|
```javascript
|
|
|
|
|
import { Button } from '@ohfi/ui';
|
|
|
|
|
```
|
|
|
|
|
|
2020-02-13 19:43:20 -03:00
|
|
|
## Properties
|
|
|
|
|
|
|
|
|
|
<Props of={Button} />
|
|
|
|
|
|
2020-03-02 13:37:00 -05:00
|
|
|
## Contained Buttons
|
2020-02-13 19:43:20 -03:00
|
|
|
|
|
|
|
|
<Playground>
|
|
|
|
|
<>
|
2020-03-02 13:37:00 -05:00
|
|
|
<Button variant="contained" className="m-1">
|
2020-02-13 19:43:20 -03:00
|
|
|
Default
|
|
|
|
|
</Button>
|
2020-03-02 13:37:00 -05:00
|
|
|
<Button variant="contained" color="primary" className="m-1">
|
2020-02-13 19:43:20 -03:00
|
|
|
Primary
|
|
|
|
|
</Button>
|
2020-03-02 13:37:00 -05:00
|
|
|
<Button variant="contained" color="secondary" className="m-1">
|
2020-02-13 19:43:20 -03:00
|
|
|
Secondary
|
|
|
|
|
</Button>
|
|
|
|
|
</>
|
|
|
|
|
</Playground>
|
|
|
|
|
|
2020-03-02 13:37:00 -05:00
|
|
|
## Outlined Buttons
|
2020-02-13 19:43:20 -03:00
|
|
|
|
|
|
|
|
<Playground>
|
|
|
|
|
<>
|
2020-03-02 13:37:00 -05:00
|
|
|
<Button variant="outlined" className="m-1">
|
2020-02-13 19:43:20 -03:00
|
|
|
Default
|
|
|
|
|
</Button>
|
2020-03-02 13:37:00 -05:00
|
|
|
<Button variant="outlined" color="primary" className="m-1">
|
2020-02-13 19:43:20 -03:00
|
|
|
Primary
|
|
|
|
|
</Button>
|
2020-03-02 13:37:00 -05:00
|
|
|
<Button variant="outlined" color="secondary" className="m-1">
|
2020-02-13 19:43:20 -03:00
|
|
|
Secondary
|
|
|
|
|
</Button>
|
|
|
|
|
</>
|
|
|
|
|
</Playground>
|
|
|
|
|
|
|
|
|
|
## Text Buttons
|
|
|
|
|
|
|
|
|
|
<Playground>
|
|
|
|
|
<>
|
2020-02-25 19:00:33 -03:00
|
|
|
<Button variant="text" className="m-1">
|
2020-02-13 19:43:20 -03:00
|
|
|
Default
|
|
|
|
|
</Button>
|
2020-02-25 19:00:33 -03:00
|
|
|
<Button variant="text" color="primary" className="m-1">
|
2020-02-13 19:43:20 -03:00
|
|
|
Primary
|
|
|
|
|
</Button>
|
2020-02-25 19:00:33 -03:00
|
|
|
<Button variant="text" color="secondary" className="m-1">
|
2020-02-13 19:43:20 -03:00
|
|
|
Secondary
|
|
|
|
|
</Button>
|
|
|
|
|
</>
|
|
|
|
|
</Playground>
|
|
|
|
|
|
|
|
|
|
## Sizes
|
|
|
|
|
|
|
|
|
|
<Playground>
|
|
|
|
|
<>
|
|
|
|
|
<div>
|
2020-03-02 13:37:00 -05:00
|
|
|
<Button variant="text" size="small" className="m-1">
|
2020-02-13 19:43:20 -03:00
|
|
|
Small
|
|
|
|
|
</Button>
|
2020-02-25 19:00:33 -03:00
|
|
|
<Button variant="contained" size="medium" className="m-1">
|
2020-02-13 19:43:20 -03:00
|
|
|
Medium
|
|
|
|
|
</Button>
|
2020-03-02 13:37:00 -05:00
|
|
|
<Button variant="outlined" size="large" className="m-1">
|
2020-02-13 19:43:20 -03:00
|
|
|
Large
|
|
|
|
|
</Button>
|
|
|
|
|
</div>
|
|
|
|
|
<div>
|
|
|
|
|
<Button
|
2020-03-02 13:37:00 -05:00
|
|
|
variant="text"
|
2020-02-13 19:43:20 -03:00
|
|
|
size="small"
|
|
|
|
|
color="primary"
|
2020-02-25 19:00:33 -03:00
|
|
|
className="m-1"
|
2020-02-13 19:43:20 -03:00
|
|
|
>
|
|
|
|
|
Small
|
|
|
|
|
</Button>
|
|
|
|
|
<Button
|
|
|
|
|
variant="contained"
|
|
|
|
|
size="medium"
|
|
|
|
|
color="primary"
|
2020-02-25 19:00:33 -03:00
|
|
|
className="m-1"
|
2020-02-13 19:43:20 -03:00
|
|
|
>
|
|
|
|
|
Medium
|
|
|
|
|
</Button>
|
|
|
|
|
<Button
|
2020-03-02 13:37:00 -05:00
|
|
|
variant="outlined"
|
2020-02-13 19:43:20 -03:00
|
|
|
size="large"
|
|
|
|
|
color="primary"
|
2020-02-25 19:00:33 -03:00
|
|
|
className="m-1"
|
2020-02-13 19:43:20 -03:00
|
|
|
>
|
2020-03-02 13:37:00 -05:00
|
|
|
large
|
2020-02-28 15:31:42 -03:00
|
|
|
</Button>
|
|
|
|
|
</div>
|
|
|
|
|
<div>
|
2020-03-02 13:37:00 -05:00
|
|
|
<Button
|
|
|
|
|
variant="text"
|
|
|
|
|
size="small"
|
|
|
|
|
color="secondary"
|
|
|
|
|
className="m-1"
|
|
|
|
|
>
|
|
|
|
|
Small
|
|
|
|
|
</Button>
|
|
|
|
|
<Button
|
|
|
|
|
variant="contained"
|
|
|
|
|
size="medium"
|
|
|
|
|
color="secondary"
|
|
|
|
|
className="m-1"
|
|
|
|
|
>
|
|
|
|
|
Medium
|
|
|
|
|
</Button>
|
|
|
|
|
<Button
|
|
|
|
|
variant="outlined"
|
|
|
|
|
size="large"
|
|
|
|
|
color="secondary"
|
|
|
|
|
className="m-1"
|
|
|
|
|
>
|
|
|
|
|
Large
|
|
|
|
|
</Button>
|
2020-02-13 19:43:20 -03:00
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
</>
|
|
|
|
|
|
|
|
|
|
</Playground>
|
|
|
|
|
|
|
|
|
|
## Buttons with icons
|
|
|
|
|
|
|
|
|
|
<Playground>
|
|
|
|
|
{() => {
|
|
|
|
|
return (
|
|
|
|
|
<div className="flex">
|
|
|
|
|
<Button
|
|
|
|
|
variant="contained"
|
|
|
|
|
color="primary"
|
2020-02-25 19:00:33 -03:00
|
|
|
className="m-1"
|
2020-02-13 19:43:20 -03:00
|
|
|
startIcon={
|
|
|
|
|
<svg
|
2020-03-02 13:37:00 -05:00
|
|
|
class="fill-current w-4 h-4"
|
2020-02-13 19:43:20 -03:00
|
|
|
xmlns="http://www.w3.org/2000/svg"
|
|
|
|
|
viewBox="0 0 20 20"
|
|
|
|
|
>
|
|
|
|
|
<path d="M13 8V2H7v6H2l8 8 8-8h-5zM0 18h20v2H0v-2z" />
|
|
|
|
|
</svg>
|
|
|
|
|
}
|
|
|
|
|
>
|
|
|
|
|
Download
|
|
|
|
|
</Button>
|
|
|
|
|
<Button
|
|
|
|
|
variant="contained"
|
|
|
|
|
color="primary"
|
2020-02-25 19:00:33 -03:00
|
|
|
className="m-1"
|
2020-02-13 19:43:20 -03:00
|
|
|
endIcon={
|
|
|
|
|
<svg
|
2020-03-02 13:37:00 -05:00
|
|
|
class="fill-current w-4 h-4"
|
2020-02-13 19:43:20 -03:00
|
|
|
xmlns="http://www.w3.org/2000/svg"
|
|
|
|
|
viewBox="0 0 20 20"
|
|
|
|
|
>
|
|
|
|
|
<path d="M13 8V2H7v6H2l8 8 8-8h-5zM0 18h20v2H0v-2z" />
|
|
|
|
|
</svg>
|
|
|
|
|
}
|
|
|
|
|
>
|
|
|
|
|
Download
|
|
|
|
|
</Button>
|
|
|
|
|
</div>
|
|
|
|
|
)
|
|
|
|
|
}}
|
|
|
|
|
|
|
|
|
|
</Playground>
|
2020-03-03 19:36:45 -03:00
|
|
|
|
|
|
|
|
## Icon Buttons
|
|
|
|
|
|
|
|
|
|
Icon buttons are generally used in toolbars.
|
|
|
|
|
|
|
|
|
|
```javascript
|
|
|
|
|
import { IconButton } from '@ohfi/ui';
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
<Playground>
|
|
|
|
|
<IconButton className="mr-2">
|
|
|
|
|
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"><path d="M23.822 20.88l-6.353-6.354c.93-1.465 1.467-3.2 1.467-5.059.001-5.219-4.247-9.467-9.468-9.467s-9.468 4.248-9.468 9.468c0 5.221 4.247 9.469 9.468 9.469 1.768 0 3.421-.487 4.839-1.333l6.396 6.396 3.119-3.12zm-20.294-11.412c0-3.273 2.665-5.938 5.939-5.938 3.275 0 5.94 2.664 5.94 5.938 0 3.275-2.665 5.939-5.94 5.939-3.274 0-5.939-2.664-5.939-5.939z"/></svg>
|
|
|
|
|
</IconButton>
|
|
|
|
|
<IconButton className="mr-2" variant="text">
|
|
|
|
|
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"><path d="M24 12l-6-5v4h-5v-5h4l-5-6-5 6h4v5h-5v-4l-6 5 6 5v-4h5v5h-4l5 6 5-6h-4v-5h5v4z"/></svg>
|
|
|
|
|
</IconButton>
|
|
|
|
|
<IconButton className="mr-2" variant="outlined" >
|
|
|
|
|
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"><path d="M12.026 14.116c-3.475 1.673-7.504 3.619-8.484 4.09-1.848.889-3.542-1.445-3.542-1.445l8.761-4.226 3.265 1.581zm7.93 6.884c-.686 0-1.393-.154-2.064-.479-1.943-.941-2.953-3.001-2.498-4.854.26-1.057-.296-1.201-1.145-1.612l-14.189-6.866s1.7-2.329 3.546-1.436c1.134.549 5.689 2.747 9.614 4.651l.985-.474c.85-.409 1.406-.552 1.149-1.609-.451-1.855.564-3.913 2.51-4.848.669-.321 1.373-.473 2.054-.473 2.311 0 4.045 1.696 4.045 3.801 0 1.582-.986 3.156-2.613 3.973-1.625.816-2.765.18-4.38.965l-.504.245.552.27c1.613.789 2.754.156 4.377.976 1.624.819 2.605 2.392 2.605 3.97 0 2.108-1.739 3.8-4.044 3.8zm-2.555-12.815c.489 1.022 1.876 1.378 3.092.793 1.217-.584 1.809-1.893 1.321-2.916-.489-1.022-1.876-1.379-3.093-.794s-1.808 1.894-1.32 2.917zm-3.643 3.625c0-.414-.335-.75-.75-.75-.414 0-.75.336-.75.75s.336.75.75.75.75-.336.75-.75zm6.777 3.213c-1.215-.588-2.604-.236-3.095.786-.491 1.022.098 2.332 1.313 2.919 1.215.588 2.603.235 3.094-.787.492-1.021-.097-2.33-1.312-2.918z"/></svg>
|
|
|
|
|
</IconButton>
|
|
|
|
|
<IconButton className="mr-2" color="primary">
|
|
|
|
|
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"><path d="M23.822 20.88l-6.353-6.354c.93-1.465 1.467-3.2 1.467-5.059.001-5.219-4.247-9.467-9.468-9.467s-9.468 4.248-9.468 9.468c0 5.221 4.247 9.469 9.468 9.469 1.768 0 3.421-.487 4.839-1.333l6.396 6.396 3.119-3.12zm-20.294-11.412c0-3.273 2.665-5.938 5.939-5.938 3.275 0 5.94 2.664 5.94 5.938 0 3.275-2.665 5.939-5.94 5.939-3.274 0-5.939-2.664-5.939-5.939z"/></svg>
|
|
|
|
|
</IconButton>
|
|
|
|
|
<IconButton className="mr-2" variant="text" color="primary">
|
|
|
|
|
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"><path d="M24 12l-6-5v4h-5v-5h4l-5-6-5 6h4v5h-5v-4l-6 5 6 5v-4h5v5h-4l5 6 5-6h-4v-5h5v4z"/></svg>
|
|
|
|
|
</IconButton>
|
|
|
|
|
<IconButton className="mr-2" variant="outlined" color="primary">
|
|
|
|
|
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"><path d="M12.026 14.116c-3.475 1.673-7.504 3.619-8.484 4.09-1.848.889-3.542-1.445-3.542-1.445l8.761-4.226 3.265 1.581zm7.93 6.884c-.686 0-1.393-.154-2.064-.479-1.943-.941-2.953-3.001-2.498-4.854.26-1.057-.296-1.201-1.145-1.612l-14.189-6.866s1.7-2.329 3.546-1.436c1.134.549 5.689 2.747 9.614 4.651l.985-.474c.85-.409 1.406-.552 1.149-1.609-.451-1.855.564-3.913 2.51-4.848.669-.321 1.373-.473 2.054-.473 2.311 0 4.045 1.696 4.045 3.801 0 1.582-.986 3.156-2.613 3.973-1.625.816-2.765.18-4.38.965l-.504.245.552.27c1.613.789 2.754.156 4.377.976 1.624.819 2.605 2.392 2.605 3.97 0 2.108-1.739 3.8-4.044 3.8zm-2.555-12.815c.489 1.022 1.876 1.378 3.092.793 1.217-.584 1.809-1.893 1.321-2.916-.489-1.022-1.876-1.379-3.093-.794s-1.808 1.894-1.32 2.917zm-3.643 3.625c0-.414-.335-.75-.75-.75-.414 0-.75.336-.75.75s.336.75.75.75.75-.336.75-.75zm6.777 3.213c-1.215-.588-2.604-.236-3.095.786-.491 1.022.098 2.332 1.313 2.919 1.215.588 2.603.235 3.094-.787.492-1.021-.097-2.33-1.312-2.918z"/></svg>
|
|
|
|
|
</IconButton>
|
|
|
|
|
<IconButton className="mr-2" color="secondary">
|
|
|
|
|
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"><path d="M23.822 20.88l-6.353-6.354c.93-1.465 1.467-3.2 1.467-5.059.001-5.219-4.247-9.467-9.468-9.467s-9.468 4.248-9.468 9.468c0 5.221 4.247 9.469 9.468 9.469 1.768 0 3.421-.487 4.839-1.333l6.396 6.396 3.119-3.12zm-20.294-11.412c0-3.273 2.665-5.938 5.939-5.938 3.275 0 5.94 2.664 5.94 5.938 0 3.275-2.665 5.939-5.94 5.939-3.274 0-5.939-2.664-5.939-5.939z"/></svg>
|
|
|
|
|
</IconButton>
|
|
|
|
|
<IconButton className="mr-2" variant="text" color="secondary">
|
|
|
|
|
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"><path d="M24 12l-6-5v4h-5v-5h4l-5-6-5 6h4v5h-5v-4l-6 5 6 5v-4h5v5h-4l5 6 5-6h-4v-5h5v4z"/></svg>
|
|
|
|
|
</IconButton>
|
|
|
|
|
<IconButton className="mr-2" variant="outlined" color="secondary">
|
|
|
|
|
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"><path d="M12.026 14.116c-3.475 1.673-7.504 3.619-8.484 4.09-1.848.889-3.542-1.445-3.542-1.445l8.761-4.226 3.265 1.581zm7.93 6.884c-.686 0-1.393-.154-2.064-.479-1.943-.941-2.953-3.001-2.498-4.854.26-1.057-.296-1.201-1.145-1.612l-14.189-6.866s1.7-2.329 3.546-1.436c1.134.549 5.689 2.747 9.614 4.651l.985-.474c.85-.409 1.406-.552 1.149-1.609-.451-1.855.564-3.913 2.51-4.848.669-.321 1.373-.473 2.054-.473 2.311 0 4.045 1.696 4.045 3.801 0 1.582-.986 3.156-2.613 3.973-1.625.816-2.765.18-4.38.965l-.504.245.552.27c1.613.789 2.754.156 4.377.976 1.624.819 2.605 2.392 2.605 3.97 0 2.108-1.739 3.8-4.044 3.8zm-2.555-12.815c.489 1.022 1.876 1.378 3.092.793 1.217-.584 1.809-1.893 1.321-2.916-.489-1.022-1.876-1.379-3.093-.794s-1.808 1.894-1.32 2.917zm-3.643 3.625c0-.414-.335-.75-.75-.75-.414 0-.75.336-.75.75s.336.75.75.75.75-.336.75-.75zm6.777 3.213c-1.215-.588-2.604-.236-3.095.786-.491 1.022.098 2.332 1.313 2.919 1.215.588 2.603.235 3.094-.787.492-1.021-.097-2.33-1.312-2.918z"/></svg>
|
|
|
|
|
</IconButton>
|
|
|
|
|
<IconButton className="mr-2" color="white">
|
|
|
|
|
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"><path d="M23.822 20.88l-6.353-6.354c.93-1.465 1.467-3.2 1.467-5.059.001-5.219-4.247-9.467-9.468-9.467s-9.468 4.248-9.468 9.468c0 5.221 4.247 9.469 9.468 9.469 1.768 0 3.421-.487 4.839-1.333l6.396 6.396 3.119-3.12zm-20.294-11.412c0-3.273 2.665-5.938 5.939-5.938 3.275 0 5.94 2.664 5.94 5.938 0 3.275-2.665 5.939-5.94 5.939-3.274 0-5.939-2.664-5.939-5.939z"/></svg>
|
|
|
|
|
</IconButton>
|
|
|
|
|
<IconButton className="mr-2" variant="text" color="white">
|
|
|
|
|
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"><path d="M24 12l-6-5v4h-5v-5h4l-5-6-5 6h4v5h-5v-4l-6 5 6 5v-4h5v5h-4l5 6 5-6h-4v-5h5v4z"/></svg>
|
|
|
|
|
</IconButton>
|
|
|
|
|
<IconButton className="mr-2" variant="outlined" color="white">
|
|
|
|
|
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"><path d="M12.026 14.116c-3.475 1.673-7.504 3.619-8.484 4.09-1.848.889-3.542-1.445-3.542-1.445l8.761-4.226 3.265 1.581zm7.93 6.884c-.686 0-1.393-.154-2.064-.479-1.943-.941-2.953-3.001-2.498-4.854.26-1.057-.296-1.201-1.145-1.612l-14.189-6.866s1.7-2.329 3.546-1.436c1.134.549 5.689 2.747 9.614 4.651l.985-.474c.85-.409 1.406-.552 1.149-1.609-.451-1.855.564-3.913 2.51-4.848.669-.321 1.373-.473 2.054-.473 2.311 0 4.045 1.696 4.045 3.801 0 1.582-.986 3.156-2.613 3.973-1.625.816-2.765.18-4.38.965l-.504.245.552.27c1.613.789 2.754.156 4.377.976 1.624.819 2.605 2.392 2.605 3.97 0 2.108-1.739 3.8-4.044 3.8zm-2.555-12.815c.489 1.022 1.876 1.378 3.092.793 1.217-.584 1.809-1.893 1.321-2.916-.489-1.022-1.876-1.379-3.093-.794s-1.808 1.894-1.32 2.917zm-3.643 3.625c0-.414-.335-.75-.75-.75-.414 0-.75.336-.75.75s.336.75.75.75.75-.336.75-.75zm6.777 3.213c-1.215-.588-2.604-.236-3.095.786-.491 1.022.098 2.332 1.313 2.919 1.215.588 2.603.235 3.094-.787.492-1.021-.097-2.33-1.312-2.918z"/></svg>
|
|
|
|
|
</IconButton>
|
|
|
|
|
</Playground>
|