Skip to content

Commit 8d7d62f

Browse files
committed
feat: add button variations
1 parent 0174df0 commit 8d7d62f

File tree

1 file changed

+156
-0
lines changed

1 file changed

+156
-0
lines changed

content/en/patterns/forms/button.mdx

+156
Original file line numberDiff line numberDiff line change
@@ -131,6 +131,162 @@ end
131131
| Loading State | ❌ No | Indicates an ongoing process (e.g., saving, submitting). |
132132
| Visual States | ✅ Yes | Defines button interactions (hover, focus, active, etc.). |
133133

134+
## Button Variations
135+
136+
### Content Composition
137+
138+
1. **Text Only**
139+
140+
```html
141+
<button type="button">Button</button>
142+
```
143+
144+
2. **Icon Only**
145+
146+
```html
147+
<button type="button" aria-label="Settings">
148+
<svg aria-hidden="true">...</svg>
149+
</button>
150+
```
151+
152+
3. **Icon + Text**
153+
154+
- Left Icon
155+
156+
```html
157+
<button type="button">
158+
<svg aria-hidden="true">...</svg>
159+
<span>Button</span>
160+
</button>
161+
```
162+
163+
- Right Icon
164+
165+
```html
166+
<button type="button">
167+
<span>Button</span>
168+
<svg aria-hidden="true">...</svg>
169+
</button>
170+
```
171+
172+
4. **Double Icon**
173+
174+
```html
175+
<button type="button">
176+
<svg aria-hidden="true">...</svg>
177+
<span>Button</span>
178+
<svg aria-hidden="true">...</svg>
179+
</button>
180+
```
181+
182+
5. **With Counter/Badge**
183+
184+
```html
185+
<button type="button">
186+
<span>Messages</span>
187+
<span class="counter">18</span>
188+
</button>
189+
```
190+
191+
6. **With Command/Shortcut**
192+
```html
193+
<button type="button">
194+
<span>Print</span>
195+
<span class="shortcut">⌘P</span>
196+
</button>
197+
```
198+
199+
### Profile Variations
200+
201+
7. **With Avatar**
202+
```html
203+
<button type="button">
204+
<img src="avatar.jpg" alt="" />
205+
<span>@username</span>
206+
</button>
207+
```
208+
209+
### Action Groups
210+
211+
8. **Button Groups**
212+
213+
- Horizontal Group
214+
215+
```html
216+
<div role="group" aria-label="Text alignment">
217+
<button type="button">Left</button>
218+
<button type="button">Center</button>
219+
<button type="button">Right</button>
220+
</div>
221+
```
222+
223+
- Vertical Group
224+
225+
```html
226+
<div role="group" aria-label="Actions" class="vertical">
227+
<button type="button">Files</button>
228+
<button type="button">Media</button>
229+
</div>
230+
```
231+
232+
9. **Split Buttons**
233+
```html
234+
<div class="split-button">
235+
<button type="button">Action</button>
236+
<button type="button" aria-label="More options">▼</button>
237+
</div>
238+
```
239+
240+
### State Variations
241+
242+
10. **Loading States**
243+
244+
```html
245+
<button type="button" aria-busy="true">
246+
<svg class="spinner" aria-hidden="true">...</svg>
247+
<span>Loading...</span>
248+
</button>
249+
```
250+
251+
11. **Toggle States**
252+
```html
253+
<button type="button" aria-pressed="false">
254+
<span>Pin</span>
255+
</button>
256+
```
257+
258+
### Social Variations
259+
260+
12. **Social Login**
261+
```html
262+
<button type="button" class="social-login google">
263+
<svg aria-hidden="true">...</svg>
264+
<span>Login with Google</span>
265+
</button>
266+
```
267+
268+
### Special Purpose
269+
270+
13. **Upload Button**
271+
272+
```html
273+
<button type="button" class="upload">
274+
<svg aria-hidden="true">...</svg>
275+
<span>Upload image</span>
276+
<span class="status">No image uploaded</span>
277+
</button>
278+
```
279+
280+
14. **Numeric Indicator**
281+
```html
282+
<button type="button">
283+
<span>Star</span>
284+
<span class="count">729</span>
285+
</button>
286+
```
287+
288+
Each variation can be combined with different visual styles (primary, secondary, outline, ghost) and sizes (small, medium, large) to create the full range of possible button components.
289+
134290
## Best Practices
135291

136292
### Content

0 commit comments

Comments
 (0)