Skip to content
This repository was archived by the owner on Sep 20, 2024. It is now read-only.

Commit fd1d64e

Browse files
committed
docs(button): add button docs
1 parent 63370d3 commit fd1d64e

File tree

1 file changed

+90
-1
lines changed

1 file changed

+90
-1
lines changed

docs/components/button.md

Lines changed: 90 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,4 +110,93 @@ Theming props passed into the `CButton` component (e.g. `variant`, `colorScheme`
110110
### Button Props
111111
112112
`CButton` composes the `CBox` component, so you can pass all its props.
113-
These are props specific to the `CButton` component:
113+
These are props specific to the `CButton` component:
114+
115+
## Composition
116+
117+
All props you pass (`variant`, `colorScheme`, etc.) are converted to style
118+
props. This means you can override any style of the Button via props.
119+
120+
```vue
121+
<!--
122+
The size prop affects the height of the button.
123+
It can still be overriden by passing a custom height
124+
-->
125+
<c-button
126+
size="md"
127+
height="48px"
128+
width="200px"
129+
border="2px"
130+
border-color="green.500"
131+
>
132+
Button
133+
</c-button>
134+
```
135+
136+
---
137+
138+
## Custom Button
139+
140+
In the event that you need to make your own custom button, you can leverage the
141+
`CBox` component. It provides the `hover`, `focus`, `active` and `disabled` style
142+
props to style the button.
143+
144+
```vue
145+
<!-- Button from facebook.com -->
146+
<c-box
147+
as="button"
148+
height="24px"
149+
line-height="1.2"
150+
transition="all 0.2s cubic-bezier(.08,.52,.52,1)"
151+
border="1px"
152+
px="8px"
153+
border-radius="2px"
154+
font-size="14px"
155+
font-weight="semibold"
156+
bg="#f5f6f7"
157+
border-color="#ccd0d5"
158+
color="#4b4f56"
159+
:_hover="{ bg: '#ebedf0' }"
160+
:_active="{
161+
bg: '#dddfe2',
162+
transform: 'scale(0.98)',
163+
borderColor: '#bec3c9',
164+
}"
165+
:_focus="{
166+
boxShadow:
167+
'0 0 1px 2px rgba(88, 144, 255, .75), 0 1px 1px rgba(0, 0, 0, .15)",
168+
}"
169+
>
170+
Join Group
171+
</c-box>
172+
```
173+
## Props
174+
### Button Props
175+
| Name | Type | Description | Default |
176+
| :---: | :---: | :---: | :---: |
177+
|`colorScheme`|`"blue" | "cyan" | "gray" | "green" | "orange" | "pink" | "purple" | "red" | "teal" | "yellow" | "whiteAlpha" | "blackAlpha" | "linkedin" | "facebook" | "messenger" | "whatsapp" | "twitter" | "telegram"`| Theme color scheme |`"gray"`|
178+
|`iconSpacing`|`SystemProps["marginRight"]`| The space between the icon and the label | - |
179+
|`iconSpacing` | `SystemProps["marginRight"]` | The space between the button icon and label. | - |
180+
|`isActive` | `boolean` | If `true`, the button will be styled in its active state. | - |
181+
|`isDisabled` | `boolean` | If `true`, the button will be disabled. | - |
182+
|`isFullWidth` | `boolean` | If `true`, the button will take up the full width of its container.| - |
183+
|`isLoading` | `boolean` | If `true`, the button will show a spinner.| | - |
184+
|`leftIcon` | `string` | If added, the button will show an icon before the button's label. | - |
185+
|`loadingText` | `string` | The label to show in the button when `isLoading` is true If no text is passed, it only shows the spinner | - |
186+
|`rightIcon` | `string` | If added, the button will show an icon after the button's label. | - |
187+
|`size` | `"sm" | "md" | "lg" | "xs"` | |`"md"` |
188+
|`variant` | `"link" | "outline" | "solid" | "ghost" | "unstyled"` | | `"solid"` |
189+
190+
### Button Group Props
191+
192+
`CButtonGroup` composes the `CBox` component, so you can pass all its props.
193+
These are props specific to the `CButtonGroup` component:
194+
195+
| Name | Type | Description | Default |
196+
| :---: | :---: | :---: | :---: |
197+
| `colorScheme` | `"blue" | "cyan" | "gray" | "green" | "orange" | "pink" | "purple" | "red" | "teal" | "yellow" | "whiteAlpha" | "blackAlpha" | |"linkedin" | "facebook" | "messenger" | "whatsapp" | "twitter" | "telegram"` | Color Schemes for ButtonGroup are not implemented in the default theme. You can extend the theme to implement them. |-|
198+
| `isAttached` | `boolean` | If `true`, the borderRadius of button that are direct children will be altered to look flushed together |-|
199+
| `isDisabled` | `boolean` | If `true`, all wrapped button will be disabled | -|
200+
| `size` | `"sm" | "md" | "lg" | "xs"`| |-|
201+
| `spacing` | `SystemProps["marginRight"]` The spacing between the buttons | `'0.5rem'`|
202+
| `variant` | `"link" | "outline" | "solid" | "ghost" | "unstyled"` | |

0 commit comments

Comments
 (0)