import { Meta, Story, Canvas } from '@storybook/addon-docs/blocks'; import WootButton from '../../app/javascript/dashboard/components/ui/WootButton.vue'; # Buttons Buttons can be used by `woot-button` component in `vue`. You can play with all the props here 👉 [woot-button](/story/components-button--primary). The button component is made on top of [foundation button](https://get.foundation/sites/docs/button.html) so the style of button can be used outside of vue with `button` class. Other than declred props the `woot-button` can be customised by providing custom classnames through `class-names` prop. {{ template: `Default`, }} - While naming button labels make sure to describe the action with some context. - For HTML forms use `` instead of `` - Provide title or tooltip if possible. ## Button sizes Size of the buttons can be set with `size` to `woot-button`. By default medium is the default size of a button. Other sizes are `tiny, small, medium, large`. {{ template: `
Tiny
Small
Default
Large
`, }}
Buttons can expanded to full width by setting the `is-expanded` prop. For with by screen size or to make it responsive try with the classnames on [Responsive Expanded buttons](https://get.foundation/sites/docs/button.html#responsive-expanded-buttons) with foundation. {{ template: `
This is buttons is very long
`, }}
## Button colors Chatwoot comes with predefined set of colors for buttons. The color of the button can be set with `color-scheme` to `woot-button`. Default color scheme is `primary`, other color-schemes are `secondary, success, alert, warning`. {{ template: `
Primary
Secondary
Success
Alert
Warning
`, }}
## Button style variations There are diffrent styles that comes with chatwoot buttons. This can set with `variants` prop for `woot-button`. By deault the filled will be the style, other variations are `smooth, hollow, clear, link` - Primary form actions like Save details, Create campaign etc should use default style. - The Cancel action has to use the smooth style. {{ template: `
Default
Smooth
Hollow
Success
Link
`, }}
## Button states The button can be disbaled with `is-disabled` which accepts a boolean value. The button can set to a loading state with `is-loading` which accepts a boolean value. These are states other than the default interaction states like hover, active, focused. {{ template: `
disabled :/
Loading...
`, }}
## Button with icon and text Chatwoot currently use [IonIcons version 2](https://ionic.io/ionicons/v2) which are font-icons. The button position is fixed on the left. The prop `icon` can be used to pass the **ion icon classname** to render the icon. {{ template: `
Stop
Hollow man
`, }}
#### Buttons with only icon The `woot-button` can be used as an icon only button by keeping the button text empty. {{ template: `
`, }}