@fpkit/acss 3.1.0 → 3.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/libs/{chunk-2NRIP6RB.cjs → chunk-2C3YLBWP.cjs} +3 -3
- package/libs/{chunk-NWJDAHP6.cjs → chunk-2GJHKWEK.cjs} +3 -3
- package/libs/{chunk-FVROL3V5.js → chunk-2JCDEC32.js} +3 -3
- package/libs/{chunk-IRLFZ3OL.js → chunk-3XJC4XUG.js} +2 -2
- package/libs/{chunk-23ANBDCR.js → chunk-4I5MF54P.js} +3 -3
- package/libs/chunk-4I5MF54P.js.map +1 -0
- package/libs/chunk-5CJPTDK3.cjs +31 -0
- package/libs/chunk-5CJPTDK3.cjs.map +1 -0
- package/libs/{chunk-E4OSROCA.cjs → chunk-5QSNJQVH.cjs} +3 -3
- package/libs/{chunk-O3JIHC5M.cjs → chunk-6BUJZ4DJ.cjs} +3 -3
- package/libs/{chunk-WXBFBWYF.cjs → chunk-AFINOD2L.cjs} +3 -3
- package/libs/{chunk-HRRHPLER.js → chunk-AWZLSWDO.js} +2 -2
- package/libs/chunk-DDSXKOUB.js +7 -0
- package/libs/chunk-DDSXKOUB.js.map +1 -0
- package/libs/{chunk-CWRNJA4P.js → chunk-DIJBIOFE.js} +3 -3
- package/libs/chunk-EJ6KYBFE.cjs +13 -0
- package/libs/chunk-EJ6KYBFE.cjs.map +1 -0
- package/libs/{chunk-GUJSMQ3V.cjs → chunk-EKJYOCLY.cjs} +3 -3
- package/libs/{chunk-X5RKCLDC.cjs → chunk-F64GE6RG.cjs} +4 -4
- package/libs/chunk-FMIM3332.js +8 -0
- package/libs/chunk-FMIM3332.js.map +1 -0
- package/libs/{chunk-5RAWNUVD.js → chunk-IBUTNPTQ.js} +2 -2
- package/libs/chunk-IWP4VJEP.cjs +18 -0
- package/libs/chunk-IWP4VJEP.cjs.map +1 -0
- package/libs/{chunk-ZFJ4U45S.js → chunk-KDMX3FAW.js} +2 -2
- package/libs/{chunk-DYFAUAB7.cjs → chunk-LXODKKA3.cjs} +4 -4
- package/libs/chunk-M7JLT62Q.js +9 -0
- package/libs/chunk-M7JLT62Q.js.map +1 -0
- package/libs/{chunk-IQ76HGVP.js → chunk-MBWI67UT.js} +2 -2
- package/libs/{chunk-O5XAJ7BY.cjs → chunk-NCGVF2QS.cjs} +4 -4
- package/libs/{chunk-W2UIN7EV.cjs → chunk-NPWHQVYB.cjs} +3 -3
- package/libs/{chunk-G55UJ53G.cjs → chunk-NZVSXRTB.cjs} +3 -3
- package/libs/chunk-NZVSXRTB.cjs.map +1 -0
- package/libs/{chunk-43TK2ICH.js → chunk-PMWL5XZ4.js} +3 -3
- package/libs/{chunk-KVKQLRJG.js → chunk-TF3GQKOY.js} +2 -2
- package/libs/chunk-TNEJXNZA.cjs +22 -0
- package/libs/chunk-TNEJXNZA.cjs.map +1 -0
- package/libs/{chunk-IEB64SWY.js → chunk-U5VA34SU.js} +2 -2
- package/libs/chunk-UGMP72J2.js +8 -0
- package/libs/chunk-UGMP72J2.js.map +1 -0
- package/libs/{chunk-MGPWZRBX.cjs → chunk-URBGDUFN.cjs} +6 -6
- package/libs/{chunk-QKHPHMG2.js → chunk-ZF6Y7W57.js} +5 -5
- package/libs/component-props-50e69975.d.ts +66 -0
- package/libs/components/box/box.css +1 -0
- package/libs/components/box/box.css.map +1 -0
- package/libs/components/box/box.min.css +3 -0
- package/libs/components/breadcrumbs/breadcrumb.cjs +6 -6
- package/libs/components/breadcrumbs/breadcrumb.js +3 -3
- package/libs/components/button.cjs +4 -4
- package/libs/components/button.d.cts +10 -3
- package/libs/components/button.d.ts +10 -3
- package/libs/components/button.js +2 -2
- package/libs/components/card.cjs +7 -7
- package/libs/components/card.d.cts +13 -85
- package/libs/components/card.d.ts +13 -85
- package/libs/components/card.js +2 -2
- package/libs/components/cards/card.css +1 -1
- package/libs/components/cards/card.css.map +1 -1
- package/libs/components/cards/card.min.css +2 -2
- package/libs/components/cluster/cluster.css +1 -0
- package/libs/components/cluster/cluster.css.map +1 -0
- package/libs/components/cluster/cluster.min.css +3 -0
- package/libs/components/dialog/dialog.cjs +7 -7
- package/libs/components/dialog/dialog.js +5 -5
- package/libs/components/form/fields.cjs +4 -4
- package/libs/components/form/fields.js +2 -2
- package/libs/components/form/textarea.cjs +4 -4
- package/libs/components/form/textarea.js +2 -2
- package/libs/components/grid/grid.css +1 -0
- package/libs/components/grid/grid.css.map +1 -0
- package/libs/components/grid/grid.min.css +3 -0
- package/libs/components/heading/heading.cjs +3 -3
- package/libs/components/heading/heading.js +2 -2
- package/libs/components/icons/icon.cjs +4 -4
- package/libs/components/icons/icon.d.cts +2 -2
- package/libs/components/icons/icon.d.ts +2 -2
- package/libs/components/icons/icon.js +2 -2
- package/libs/components/link/link.cjs +6 -6
- package/libs/components/link/link.js +2 -2
- package/libs/components/list/list.cjs +5 -5
- package/libs/components/list/list.js +2 -2
- package/libs/components/modal.cjs +4 -4
- package/libs/components/modal.d.cts +1 -1
- package/libs/components/modal.d.ts +1 -1
- package/libs/components/modal.js +3 -3
- package/libs/components/nav/nav.cjs +7 -7
- package/libs/components/nav/nav.js +3 -3
- package/libs/components/popover/popover.cjs +4 -4
- package/libs/components/popover/popover.d.cts +1 -1
- package/libs/components/popover/popover.d.ts +1 -1
- package/libs/components/popover/popover.js +1 -1
- package/libs/components/stack/stack.css +1 -0
- package/libs/components/stack/stack.css.map +1 -0
- package/libs/components/stack/stack.min.css +3 -0
- package/libs/components/tables/table.cjs +4 -4
- package/libs/components/tables/table.d.cts +2 -2
- package/libs/components/tables/table.d.ts +2 -2
- package/libs/components/tables/table.js +1 -1
- package/libs/components/text/text.cjs +5 -5
- package/libs/components/text/text.js +2 -2
- package/libs/hooks.cjs +4 -4
- package/libs/hooks.js +3 -3
- package/libs/{icons-287fce3a.d.ts → icons-df8e744f.d.ts} +1 -1
- package/libs/icons.cjs +3 -3
- package/libs/icons.d.cts +2 -2
- package/libs/icons.d.ts +2 -2
- package/libs/icons.js +2 -2
- package/libs/index.cjs +74 -73
- package/libs/index.cjs.map +1 -1
- package/libs/index.css +1 -1
- package/libs/index.css.map +1 -1
- package/libs/index.d.cts +925 -6
- package/libs/index.d.ts +925 -6
- package/libs/index.js +30 -30
- package/libs/index.js.map +1 -1
- package/package.json +2 -2
- package/src/App.tsx +1 -3
- package/src/components/alert/STYLES.mdx +790 -0
- package/src/components/badge/STYLES.mdx +610 -0
- package/src/components/box/README.mdx +401 -0
- package/src/components/box/STYLES.mdx +360 -0
- package/src/components/box/box.scss +245 -0
- package/src/components/box/box.stories.tsx +395 -0
- package/src/components/box/box.test.tsx +425 -0
- package/src/components/box/box.tsx +170 -0
- package/src/components/box/box.types.ts +166 -0
- package/src/components/breadcrumbs/STYLES.mdx +99 -0
- package/src/components/breadcrumbs/bc-item.tsx +0 -1
- package/src/components/buttons/STYLES.mdx +766 -0
- package/src/components/cards/STYLES.mdx +835 -0
- package/src/components/cards/card.scss +29 -21
- package/src/components/cards/card.tsx +13 -3
- package/src/components/cards/card.types.ts +13 -0
- package/src/components/cluster/README.mdx +595 -0
- package/src/components/cluster/STYLES.mdx +626 -0
- package/src/components/cluster/cluster.scss +86 -0
- package/src/components/cluster/cluster.stories.tsx +385 -0
- package/src/components/cluster/cluster.test.tsx +655 -0
- package/src/components/cluster/cluster.tsx +94 -0
- package/src/components/cluster/cluster.types.ts +75 -0
- package/src/components/details/STYLES.mdx +445 -0
- package/src/components/dialog/STYLES.mdx +888 -0
- package/src/components/flexbox/STYLES.mdx +857 -0
- package/src/components/flexbox/flex.stories.tsx +842 -141
- package/src/components/flexbox/flex.types.ts +25 -6
- package/src/components/form/STYLES.mdx +821 -0
- package/src/components/grid/README.mdx +709 -0
- package/src/components/grid/STYLES.mdx +785 -0
- package/src/components/grid/grid.scss +287 -0
- package/src/components/grid/grid.stories.tsx +486 -0
- package/src/components/grid/grid.test.tsx +981 -0
- package/src/components/grid/grid.tsx +222 -0
- package/src/components/grid/grid.types.ts +344 -0
- package/src/components/icons/STYLES.mdx +56 -0
- package/src/components/icons/components/arrow-right.tsx +0 -5
- package/src/components/images/STYLES.mdx +75 -0
- package/src/components/kit.tsx +8 -4
- package/src/components/layout/STYLES.mdx +556 -0
- package/src/components/link/STYLES.mdx +75 -0
- package/src/components/list/STYLES.mdx +631 -0
- package/src/components/nav/STYLES.mdx +460 -0
- package/src/components/popover/popover.tsx +1 -1
- package/src/components/progress/STYLES.mdx +64 -0
- package/src/components/stack/README.mdx +400 -0
- package/src/components/stack/STYLES.mdx +414 -0
- package/src/components/stack/stack.scss +109 -0
- package/src/components/stack/stack.stories.tsx +559 -0
- package/src/components/stack/stack.test.tsx +426 -0
- package/src/components/stack/stack.tsx +141 -0
- package/src/components/stack/stack.types.ts +133 -0
- package/src/components/tables/table-elements.tsx +1 -1
- package/src/components/tables/table.tsx +2 -2
- package/src/components/tag/STYLES.mdx +105 -0
- package/src/components/text-to-speech/STYLES.mdx +80 -0
- package/src/components/text-to-speech/TextToSpeech.tsx +0 -4
- package/src/components/text-to-speech/useTextToSpeech.tsx +2 -6
- package/src/components/ui.tsx +3 -3
- package/src/decorators/instructions.tsx +22 -18
- package/src/hooks/popover/popover.tsx +1 -1
- package/src/index.scss +5 -1
- package/src/index.ts +305 -12
- package/src/sass/GLOBALS-STYLES.md +631 -0
- package/src/sass/_globals.scss +45 -24
- package/src/styles/box/box.css +220 -0
- package/src/styles/box/box.css.map +1 -0
- package/src/styles/cards/card.css +22 -17
- package/src/styles/cards/card.css.map +1 -1
- package/src/styles/cluster/cluster.css +71 -0
- package/src/styles/cluster/cluster.css.map +1 -0
- package/src/styles/grid/grid.css +238 -0
- package/src/styles/grid/grid.css.map +1 -0
- package/src/styles/index.css +667 -49
- package/src/styles/index.css.map +1 -1
- package/src/styles/stack/stack.css +86 -0
- package/src/styles/stack/stack.css.map +1 -0
- package/src/types/component-props.ts +42 -13
- package/src/types/layout-primitives.ts +48 -0
- package/src/types/shared.ts +10 -26
- package/libs/chunk-23ANBDCR.js.map +0 -1
- package/libs/chunk-5QD3DWFI.js +0 -9
- package/libs/chunk-5QD3DWFI.js.map +0 -1
- package/libs/chunk-6WTC4JXH.cjs +0 -31
- package/libs/chunk-6WTC4JXH.cjs.map +0 -1
- package/libs/chunk-ENTCUJ3A.cjs +0 -13
- package/libs/chunk-ENTCUJ3A.cjs.map +0 -1
- package/libs/chunk-G55UJ53G.cjs.map +0 -1
- package/libs/chunk-HHLNOC5T.js +0 -7
- package/libs/chunk-HHLNOC5T.js.map +0 -1
- package/libs/chunk-KK47SYZI.js +0 -8
- package/libs/chunk-KK47SYZI.js.map +0 -1
- package/libs/chunk-US2I5GI7.cjs +0 -22
- package/libs/chunk-US2I5GI7.cjs.map +0 -1
- package/libs/chunk-W5TKWBFC.cjs +0 -18
- package/libs/chunk-W5TKWBFC.cjs.map +0 -1
- package/libs/chunk-Y2PFDELK.js +0 -8
- package/libs/chunk-Y2PFDELK.js.map +0 -1
- package/libs/component-props-67d978a2.d.ts +0 -38
- /package/libs/{chunk-2NRIP6RB.cjs.map → chunk-2C3YLBWP.cjs.map} +0 -0
- /package/libs/{chunk-NWJDAHP6.cjs.map → chunk-2GJHKWEK.cjs.map} +0 -0
- /package/libs/{chunk-FVROL3V5.js.map → chunk-2JCDEC32.js.map} +0 -0
- /package/libs/{chunk-IRLFZ3OL.js.map → chunk-3XJC4XUG.js.map} +0 -0
- /package/libs/{chunk-E4OSROCA.cjs.map → chunk-5QSNJQVH.cjs.map} +0 -0
- /package/libs/{chunk-O3JIHC5M.cjs.map → chunk-6BUJZ4DJ.cjs.map} +0 -0
- /package/libs/{chunk-WXBFBWYF.cjs.map → chunk-AFINOD2L.cjs.map} +0 -0
- /package/libs/{chunk-HRRHPLER.js.map → chunk-AWZLSWDO.js.map} +0 -0
- /package/libs/{chunk-CWRNJA4P.js.map → chunk-DIJBIOFE.js.map} +0 -0
- /package/libs/{chunk-GUJSMQ3V.cjs.map → chunk-EKJYOCLY.cjs.map} +0 -0
- /package/libs/{chunk-X5RKCLDC.cjs.map → chunk-F64GE6RG.cjs.map} +0 -0
- /package/libs/{chunk-5RAWNUVD.js.map → chunk-IBUTNPTQ.js.map} +0 -0
- /package/libs/{chunk-ZFJ4U45S.js.map → chunk-KDMX3FAW.js.map} +0 -0
- /package/libs/{chunk-DYFAUAB7.cjs.map → chunk-LXODKKA3.cjs.map} +0 -0
- /package/libs/{chunk-IQ76HGVP.js.map → chunk-MBWI67UT.js.map} +0 -0
- /package/libs/{chunk-O5XAJ7BY.cjs.map → chunk-NCGVF2QS.cjs.map} +0 -0
- /package/libs/{chunk-W2UIN7EV.cjs.map → chunk-NPWHQVYB.cjs.map} +0 -0
- /package/libs/{chunk-43TK2ICH.js.map → chunk-PMWL5XZ4.js.map} +0 -0
- /package/libs/{chunk-KVKQLRJG.js.map → chunk-TF3GQKOY.js.map} +0 -0
- /package/libs/{chunk-IEB64SWY.js.map → chunk-U5VA34SU.js.map} +0 -0
- /package/libs/{chunk-MGPWZRBX.cjs.map → chunk-URBGDUFN.cjs.map} +0 -0
- /package/libs/{chunk-QKHPHMG2.js.map → chunk-ZF6Y7W57.js.map} +0 -0
|
@@ -0,0 +1,766 @@
|
|
|
1
|
+
import { Meta } from "@storybook/addon-docs/blocks";
|
|
2
|
+
|
|
3
|
+
<Meta title="FP.REACT Components/Buttons/Styles" />
|
|
4
|
+
|
|
5
|
+
# Button Styles
|
|
6
|
+
|
|
7
|
+
Comprehensive button styling system with CSS custom properties for flexible,
|
|
8
|
+
accessible, and themeable buttons.
|
|
9
|
+
|
|
10
|
+
## Overview
|
|
11
|
+
|
|
12
|
+
The fpkit button styling system provides a complete set of button styles
|
|
13
|
+
supporting multiple sizes, variants, and states. All styles use CSS custom
|
|
14
|
+
properties for easy customization and theming, with rem-based sizing for
|
|
15
|
+
accessibility.
|
|
16
|
+
|
|
17
|
+
### Key Features
|
|
18
|
+
|
|
19
|
+
- **Size variants** - Extra small (xs) through large (lg) with fluid typography
|
|
20
|
+
- **Style variants** - Pill, icon, and text button styles
|
|
21
|
+
- **Type-based styling** - Automatic styling for submit, reset button types
|
|
22
|
+
- **State management** - Hover, focus, and disabled states with smooth
|
|
23
|
+
transitions
|
|
24
|
+
- **CSS custom properties** - Extensive theming support via CSS variables
|
|
25
|
+
- **Rem-based sizing** - All measurements use rem units (1rem = 16px)
|
|
26
|
+
- **Accessibility** - Proper focus indicators and disabled state handling
|
|
27
|
+
|
|
28
|
+
## CSS Custom Properties
|
|
29
|
+
|
|
30
|
+
### Size Tokens
|
|
31
|
+
|
|
32
|
+
The button system uses predefined size tokens for consistent typography:
|
|
33
|
+
|
|
34
|
+
```css
|
|
35
|
+
button {
|
|
36
|
+
/* Size tokens */
|
|
37
|
+
--btn-size-xs: 0.6875rem; /* 11px */
|
|
38
|
+
--btn-size-sm: 0.8125rem; /* 13px */
|
|
39
|
+
--btn-size-md: 0.9375rem; /* 15px */
|
|
40
|
+
--btn-size-lg: 1.125rem; /* 18px */
|
|
41
|
+
|
|
42
|
+
/* Default font size */
|
|
43
|
+
--btn-fs: var(--btn-size-md);
|
|
44
|
+
|
|
45
|
+
/* Dynamic height based on font size */
|
|
46
|
+
--btn-height: calc(var(--btn-fs) * 2.25);
|
|
47
|
+
}
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
### Core Style Properties
|
|
51
|
+
|
|
52
|
+
```css
|
|
53
|
+
button {
|
|
54
|
+
/* Typography */
|
|
55
|
+
--btn-fs: var(--btn-size-md); /* Font size */
|
|
56
|
+
--btn-fw: 500; /* Font weight */
|
|
57
|
+
|
|
58
|
+
/* Colors */
|
|
59
|
+
--btn-bg: lightgray; /* Background color */
|
|
60
|
+
--btn-color: currentColor; /* Text color */
|
|
61
|
+
|
|
62
|
+
/* Spacing */
|
|
63
|
+
--btn-padding-inline: calc(var(--btn-fs) * 1.5); /* Horizontal padding */
|
|
64
|
+
--btn-padding-block: calc(var(--btn-fs) * 0.5); /* Vertical padding */
|
|
65
|
+
--btn-gap: 0.2rem; /* Gap between child elements */
|
|
66
|
+
--btn-spacing: 0; /* External margin */
|
|
67
|
+
|
|
68
|
+
/* Borders */
|
|
69
|
+
--btn-border: none; /* Border style */
|
|
70
|
+
--btn-radius: 0.375rem; /* Border radius (6px) */
|
|
71
|
+
|
|
72
|
+
/* Layout */
|
|
73
|
+
--btn-width: max-content; /* Button width */
|
|
74
|
+
--btn-height: calc(var(--btn-fs) * 2.25); /* Button height */
|
|
75
|
+
--btn-display: inline-flex; /* Display mode */
|
|
76
|
+
--btn-place: center; /* place-items value */
|
|
77
|
+
|
|
78
|
+
/* Effects */
|
|
79
|
+
--btn-transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1); /* Transition */
|
|
80
|
+
--btn-deco: none; /* Text decoration */
|
|
81
|
+
--btn-whitespace: inherit; /* White space handling */
|
|
82
|
+
}
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
### Hover & Focus Properties
|
|
86
|
+
|
|
87
|
+
```css
|
|
88
|
+
button:is(:hover, :focus) {
|
|
89
|
+
/* Hover effects */
|
|
90
|
+
--btn-hover-filter: brightness(0.85); /* Darken on hover */
|
|
91
|
+
--btn-hover-transform: scale(1.03); /* Slight scale up */
|
|
92
|
+
--btn-hover-outline: thin; /* Outline width */
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
button:focus-visible {
|
|
96
|
+
/* Focus indicator */
|
|
97
|
+
--btn-focus-outline: 2px solid currentColor; /* Focus outline */
|
|
98
|
+
--btn-focus-outline-offset: 1px; /* Outline offset */
|
|
99
|
+
}
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
### Disabled State Properties
|
|
103
|
+
|
|
104
|
+
```css
|
|
105
|
+
button[disabled],
|
|
106
|
+
button[aria-disabled="true"] {
|
|
107
|
+
--btn-cursor: not-allowed; /* Cursor style when disabled */
|
|
108
|
+
--btn-opacity: 0.5; /* Optional opacity reduction */
|
|
109
|
+
}
|
|
110
|
+
```
|
|
111
|
+
|
|
112
|
+
### Special Variant Properties
|
|
113
|
+
|
|
114
|
+
```css
|
|
115
|
+
button {
|
|
116
|
+
/* Pill variant */
|
|
117
|
+
--btn-pill: 100rem; /* Fully rounded borders */
|
|
118
|
+
}
|
|
119
|
+
```
|
|
120
|
+
|
|
121
|
+
### Customizing Button Styles
|
|
122
|
+
|
|
123
|
+
Override CSS variables for specific buttons:
|
|
124
|
+
|
|
125
|
+
```css
|
|
126
|
+
.custom-button {
|
|
127
|
+
--btn-bg: #0066cc;
|
|
128
|
+
--btn-color: white;
|
|
129
|
+
--btn-fs: 1.125rem;
|
|
130
|
+
--btn-radius: 0.5rem;
|
|
131
|
+
}
|
|
132
|
+
```
|
|
133
|
+
|
|
134
|
+
Or inline:
|
|
135
|
+
|
|
136
|
+
```html
|
|
137
|
+
<button style="--btn-bg: #0066cc; --btn-color: white">Custom Button</button>
|
|
138
|
+
```
|
|
139
|
+
|
|
140
|
+
## Base Button Styles
|
|
141
|
+
|
|
142
|
+
### Default Button
|
|
143
|
+
|
|
144
|
+
Standard button with default styling:
|
|
145
|
+
|
|
146
|
+
```html
|
|
147
|
+
<button>Default Button</button>
|
|
148
|
+
```
|
|
149
|
+
|
|
150
|
+
**CSS Applied:**
|
|
151
|
+
|
|
152
|
+
```css
|
|
153
|
+
button {
|
|
154
|
+
font-size: var(--btn-fs); /* 0.9375rem / 15px */
|
|
155
|
+
font-weight: 500;
|
|
156
|
+
height: calc(var(--btn-fs) * 2.25);
|
|
157
|
+
padding-inline: calc(var(--btn-fs) * 1.5);
|
|
158
|
+
padding-block: calc(var(--btn-fs) * 0.5);
|
|
159
|
+
border-radius: 0.375rem;
|
|
160
|
+
background-color: lightgray;
|
|
161
|
+
color: currentColor;
|
|
162
|
+
display: inline-flex;
|
|
163
|
+
align-items: center;
|
|
164
|
+
gap: 0.2rem;
|
|
165
|
+
transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
|
|
166
|
+
}
|
|
167
|
+
```
|
|
168
|
+
|
|
169
|
+
### Type Variants
|
|
170
|
+
|
|
171
|
+
Buttons automatically styled based on their type attribute:
|
|
172
|
+
|
|
173
|
+
#### Submit Button
|
|
174
|
+
|
|
175
|
+
```html
|
|
176
|
+
<button type="submit">Submit</button>
|
|
177
|
+
```
|
|
178
|
+
|
|
179
|
+
**CSS:**
|
|
180
|
+
|
|
181
|
+
```css
|
|
182
|
+
button[type="submit"] {
|
|
183
|
+
--btn-bg: var(--primary-700, blue);
|
|
184
|
+
--btn-color: #fff;
|
|
185
|
+
--btn-border: none;
|
|
186
|
+
}
|
|
187
|
+
```
|
|
188
|
+
|
|
189
|
+
#### Reset Button
|
|
190
|
+
|
|
191
|
+
```html
|
|
192
|
+
<button type="reset">Reset</button>
|
|
193
|
+
```
|
|
194
|
+
|
|
195
|
+
**CSS:**
|
|
196
|
+
|
|
197
|
+
```css
|
|
198
|
+
button[type="reset"] {
|
|
199
|
+
--btn-bg: transparent;
|
|
200
|
+
--btn-color: gray;
|
|
201
|
+
--btn-border: gray thin solid;
|
|
202
|
+
}
|
|
203
|
+
```
|
|
204
|
+
|
|
205
|
+
## Size Variants
|
|
206
|
+
|
|
207
|
+
Control button size using data attributes or classes:
|
|
208
|
+
|
|
209
|
+
| Data Attribute | Class | Font Size | Pixel Equivalent | Description |
|
|
210
|
+
| --------------- | --------- | ----------- | ---------------- | ------------------ |
|
|
211
|
+
| `data-btn="xs"` | `.btn-xs` | `0.6875rem` | 11px | Extra small button |
|
|
212
|
+
| `data-btn="sm"` | `.btn-sm` | `0.8125rem` | 13px | Small button |
|
|
213
|
+
| `data-btn="md"` | `.btn-md` | `0.9375rem` | 15px | Medium (default) |
|
|
214
|
+
| `data-btn="lg"` | `.btn-lg` | `1.125rem` | 18px | Large button |
|
|
215
|
+
|
|
216
|
+
### Examples
|
|
217
|
+
|
|
218
|
+
```html
|
|
219
|
+
<!-- Extra small (uppercase text) -->
|
|
220
|
+
<button data-btn="xs">Extra Small</button>
|
|
221
|
+
|
|
222
|
+
<!-- Small -->
|
|
223
|
+
<button data-btn="sm">Small Button</button>
|
|
224
|
+
|
|
225
|
+
<!-- Medium (default) -->
|
|
226
|
+
<button>Medium Button</button>
|
|
227
|
+
<button data-btn="md">Medium Button</button>
|
|
228
|
+
|
|
229
|
+
<!-- Large -->
|
|
230
|
+
<button data-btn="lg">Large Button</button>
|
|
231
|
+
```
|
|
232
|
+
|
|
233
|
+
### Size Customization
|
|
234
|
+
|
|
235
|
+
Height and padding scale automatically based on font size:
|
|
236
|
+
|
|
237
|
+
```css
|
|
238
|
+
button[data-btn~="lg"] {
|
|
239
|
+
--btn-fs: 1.125rem; /* 18px */
|
|
240
|
+
--btn-height: calc(1.125rem * 2.25); /* 2.53125rem / 40.5px */
|
|
241
|
+
--btn-padding-inline: calc(1.125rem * 1.5); /* 1.6875rem / 27px */
|
|
242
|
+
--btn-padding-block: calc(1.125rem * 0.5); /* 0.5625rem / 9px */
|
|
243
|
+
}
|
|
244
|
+
```
|
|
245
|
+
|
|
246
|
+
## Style Variants
|
|
247
|
+
|
|
248
|
+
### Pill Button
|
|
249
|
+
|
|
250
|
+
Fully rounded button with large border radius:
|
|
251
|
+
|
|
252
|
+
```html
|
|
253
|
+
<button data-btn="pill">Pill Button</button>
|
|
254
|
+
<button data-style="pill">Pill Button</button>
|
|
255
|
+
<button data-fp-btn="pill">Pill Button</button>
|
|
256
|
+
```
|
|
257
|
+
|
|
258
|
+
**CSS:**
|
|
259
|
+
|
|
260
|
+
```css
|
|
261
|
+
button[data-btn~="pill"] {
|
|
262
|
+
border-radius: var(--btn-pill, 100rem);
|
|
263
|
+
}
|
|
264
|
+
```
|
|
265
|
+
|
|
266
|
+
**Example:**
|
|
267
|
+
|
|
268
|
+
```html
|
|
269
|
+
<button data-btn="pill" style="--btn-bg: #4CAF50; --btn-color: white">
|
|
270
|
+
Pill Button
|
|
271
|
+
</button>
|
|
272
|
+
```
|
|
273
|
+
|
|
274
|
+
### Icon Button
|
|
275
|
+
|
|
276
|
+
Button optimized for icons with minimal padding:
|
|
277
|
+
|
|
278
|
+
```html
|
|
279
|
+
<button data-btn="icon">
|
|
280
|
+
<svg><!-- icon --></svg>
|
|
281
|
+
</button>
|
|
282
|
+
```
|
|
283
|
+
|
|
284
|
+
**CSS:**
|
|
285
|
+
|
|
286
|
+
```css
|
|
287
|
+
button[data-btn~="icon"] {
|
|
288
|
+
padding: unset;
|
|
289
|
+
height: unset;
|
|
290
|
+
--btn-bg: transparent;
|
|
291
|
+
min-width: 1.5rem;
|
|
292
|
+
min-height: 1.5rem;
|
|
293
|
+
text-align: center;
|
|
294
|
+
display: inline-flex;
|
|
295
|
+
align-items: center;
|
|
296
|
+
justify-content: center;
|
|
297
|
+
}
|
|
298
|
+
```
|
|
299
|
+
|
|
300
|
+
**Example:**
|
|
301
|
+
|
|
302
|
+
```html
|
|
303
|
+
<button data-btn="icon" aria-label="Close">✕</button>
|
|
304
|
+
<button data-btn="icon lg" aria-label="Menu">☰</button>
|
|
305
|
+
```
|
|
306
|
+
|
|
307
|
+
### Text Button
|
|
308
|
+
|
|
309
|
+
Minimal button with transparent background and subtle hover:
|
|
310
|
+
|
|
311
|
+
```html
|
|
312
|
+
<button data-btn="text">Text Button</button>
|
|
313
|
+
```
|
|
314
|
+
|
|
315
|
+
**CSS:**
|
|
316
|
+
|
|
317
|
+
```css
|
|
318
|
+
button[data-btn~="text"] {
|
|
319
|
+
--btn-bg: transparent;
|
|
320
|
+
--btn-color: currentColor;
|
|
321
|
+
--btn-border: none;
|
|
322
|
+
--btn-height: unset;
|
|
323
|
+
--btn-width: unset;
|
|
324
|
+
--btn-padding-block: 0.75rem;
|
|
325
|
+
--btn-padding-inline: 0.75rem;
|
|
326
|
+
}
|
|
327
|
+
|
|
328
|
+
button[data-btn~="text"]:is(:hover, :focus) {
|
|
329
|
+
background-color: color-mix(in srgb, var(--btn-color) 10%, transparent);
|
|
330
|
+
outline: 0.025rem solid var(--btn-color);
|
|
331
|
+
outline-offset: 0;
|
|
332
|
+
filter: none;
|
|
333
|
+
}
|
|
334
|
+
```
|
|
335
|
+
|
|
336
|
+
**Example:**
|
|
337
|
+
|
|
338
|
+
```html
|
|
339
|
+
<button data-btn="text">Learn More</button>
|
|
340
|
+
<button data-btn="text" style="--btn-color: #0066cc">View Details</button>
|
|
341
|
+
```
|
|
342
|
+
|
|
343
|
+
## State Styles
|
|
344
|
+
|
|
345
|
+
### Hover State
|
|
346
|
+
|
|
347
|
+
Buttons darken and scale slightly on hover:
|
|
348
|
+
|
|
349
|
+
```css
|
|
350
|
+
button:is(:hover, :focus) {
|
|
351
|
+
filter: brightness(0.85); /* Darkens background */
|
|
352
|
+
transform: scale(1.03); /* Slight scale up */
|
|
353
|
+
outline: thin;
|
|
354
|
+
outline-offset: 1px;
|
|
355
|
+
}
|
|
356
|
+
```
|
|
357
|
+
|
|
358
|
+
**Customization:**
|
|
359
|
+
|
|
360
|
+
```html
|
|
361
|
+
<button
|
|
362
|
+
style="--btn-hover-transform: scale(1.05); --btn-hover-filter: brightness(0.9)"
|
|
363
|
+
>
|
|
364
|
+
Hover Me
|
|
365
|
+
</button>
|
|
366
|
+
```
|
|
367
|
+
|
|
368
|
+
### Focus State
|
|
369
|
+
|
|
370
|
+
Visible focus indicator for keyboard navigation:
|
|
371
|
+
|
|
372
|
+
```css
|
|
373
|
+
button:focus-visible {
|
|
374
|
+
outline: 2px solid currentColor;
|
|
375
|
+
outline-offset: 1px;
|
|
376
|
+
}
|
|
377
|
+
```
|
|
378
|
+
|
|
379
|
+
**Customization:**
|
|
380
|
+
|
|
381
|
+
```html
|
|
382
|
+
<button
|
|
383
|
+
style="--btn-focus-outline: 3px solid blue; --btn-focus-outline-offset: 2px"
|
|
384
|
+
>
|
|
385
|
+
Focus Me
|
|
386
|
+
</button>
|
|
387
|
+
```
|
|
388
|
+
|
|
389
|
+
### Disabled State
|
|
390
|
+
|
|
391
|
+
Disabled buttons show not-allowed cursor and no hover effects:
|
|
392
|
+
|
|
393
|
+
```html
|
|
394
|
+
<button disabled>Disabled Button</button>
|
|
395
|
+
<button aria-disabled="true">Disabled Button</button>
|
|
396
|
+
```
|
|
397
|
+
|
|
398
|
+
**CSS:**
|
|
399
|
+
|
|
400
|
+
```css
|
|
401
|
+
button[disabled],
|
|
402
|
+
button[aria-disabled="true"] {
|
|
403
|
+
cursor: not-allowed;
|
|
404
|
+
}
|
|
405
|
+
|
|
406
|
+
button[disabled]:is(:hover, :focus),
|
|
407
|
+
button[aria-disabled="true"]:is(:hover, :focus) {
|
|
408
|
+
transform: none; /* No scale effect */
|
|
409
|
+
opacity: 0.5;
|
|
410
|
+
filter: none; /* No brightness filter */
|
|
411
|
+
}
|
|
412
|
+
```
|
|
413
|
+
|
|
414
|
+
## Combining Variants
|
|
415
|
+
|
|
416
|
+
You can combine multiple variants using space-separated values:
|
|
417
|
+
|
|
418
|
+
```html
|
|
419
|
+
<!-- Large pill button -->
|
|
420
|
+
<button data-btn="lg pill">Large Pill</button>
|
|
421
|
+
|
|
422
|
+
<!-- Small icon button -->
|
|
423
|
+
<button data-btn="sm icon" aria-label="Close">✕</button>
|
|
424
|
+
|
|
425
|
+
<!-- Large text button -->
|
|
426
|
+
<button data-btn="lg text">Large Text</button>
|
|
427
|
+
```
|
|
428
|
+
|
|
429
|
+
**Example:**
|
|
430
|
+
|
|
431
|
+
```html
|
|
432
|
+
<button data-btn="lg pill" style="--btn-bg: #9C27B0; --btn-color: white">
|
|
433
|
+
Large Pill Button
|
|
434
|
+
</button>
|
|
435
|
+
```
|
|
436
|
+
|
|
437
|
+
## Real-World Examples
|
|
438
|
+
|
|
439
|
+
### Primary Action Button
|
|
440
|
+
|
|
441
|
+
```html
|
|
442
|
+
<button
|
|
443
|
+
type="submit"
|
|
444
|
+
data-btn="lg"
|
|
445
|
+
style="--btn-bg: #1976D2; --btn-color: white; --btn-radius: 0.5rem"
|
|
446
|
+
>
|
|
447
|
+
Get Started
|
|
448
|
+
</button>
|
|
449
|
+
```
|
|
450
|
+
|
|
451
|
+
### Secondary Button
|
|
452
|
+
|
|
453
|
+
```html
|
|
454
|
+
<button
|
|
455
|
+
type="button"
|
|
456
|
+
style="--btn-bg: transparent; --btn-color: #1976D2; --btn-border: 2px solid #1976D2"
|
|
457
|
+
>
|
|
458
|
+
Learn More
|
|
459
|
+
</button>
|
|
460
|
+
```
|
|
461
|
+
|
|
462
|
+
### Danger Button
|
|
463
|
+
|
|
464
|
+
```html
|
|
465
|
+
<button type="button" style="--btn-bg: #D32F2F; --btn-color: white">
|
|
466
|
+
Delete
|
|
467
|
+
</button>
|
|
468
|
+
```
|
|
469
|
+
|
|
470
|
+
### Icon Button Group
|
|
471
|
+
|
|
472
|
+
```html
|
|
473
|
+
<div style="display: flex; gap: 0.5rem">
|
|
474
|
+
<button data-btn="icon" aria-label="Edit">✎</button>
|
|
475
|
+
<button data-btn="icon" aria-label="Delete">✕</button>
|
|
476
|
+
<button data-btn="icon" aria-label="Settings">⚙</button>
|
|
477
|
+
</div>
|
|
478
|
+
```
|
|
479
|
+
|
|
480
|
+
### Button with Icon and Text
|
|
481
|
+
|
|
482
|
+
```html
|
|
483
|
+
<button data-btn="lg" style="--btn-bg: #4CAF50; --btn-color: white">
|
|
484
|
+
<svg width="20" height="20"><!-- icon --></svg>
|
|
485
|
+
<span>Add Item</span>
|
|
486
|
+
</button>
|
|
487
|
+
```
|
|
488
|
+
|
|
489
|
+
### Outlined Pill Button
|
|
490
|
+
|
|
491
|
+
```html
|
|
492
|
+
<button
|
|
493
|
+
data-btn="pill"
|
|
494
|
+
style="--btn-bg: transparent; --btn-color: #FF5722; --btn-border: 2px solid #FF5722"
|
|
495
|
+
>
|
|
496
|
+
Contact Us
|
|
497
|
+
</button>
|
|
498
|
+
```
|
|
499
|
+
|
|
500
|
+
### Loading Button
|
|
501
|
+
|
|
502
|
+
```html
|
|
503
|
+
<button disabled style="--btn-opacity: 0.7">
|
|
504
|
+
<span>Loading...</span>
|
|
505
|
+
<span style="animation: spin 1s linear infinite">⟳</span>
|
|
506
|
+
</button>
|
|
507
|
+
```
|
|
508
|
+
|
|
509
|
+
### Full Width Button
|
|
510
|
+
|
|
511
|
+
```html
|
|
512
|
+
<button style="--btn-width: 100%" type="submit">Continue</button>
|
|
513
|
+
```
|
|
514
|
+
|
|
515
|
+
## Accessibility Considerations
|
|
516
|
+
|
|
517
|
+
### Keyboard Navigation
|
|
518
|
+
|
|
519
|
+
All buttons are keyboard-accessible by default:
|
|
520
|
+
|
|
521
|
+
- **Tab** - Focus the button
|
|
522
|
+
- **Enter** or **Space** - Activate the button
|
|
523
|
+
- **Focus indicators** - Visible outline on `:focus-visible`
|
|
524
|
+
|
|
525
|
+
### Disabled State
|
|
526
|
+
|
|
527
|
+
Use proper disabled attributes:
|
|
528
|
+
|
|
529
|
+
```html
|
|
530
|
+
<!-- Native disabled (recommended) -->
|
|
531
|
+
<button disabled>Cannot click</button>
|
|
532
|
+
|
|
533
|
+
<!-- ARIA disabled (for custom behavior) -->
|
|
534
|
+
<button aria-disabled="true">Cannot click</button>
|
|
535
|
+
```
|
|
536
|
+
|
|
537
|
+
**Note:** The `aria-disabled="true"` attribute allows custom JavaScript handling
|
|
538
|
+
while maintaining disabled styling.
|
|
539
|
+
|
|
540
|
+
### Icon Buttons
|
|
541
|
+
|
|
542
|
+
Always provide accessible labels for icon-only buttons:
|
|
543
|
+
|
|
544
|
+
```html
|
|
545
|
+
<!-- Good: Has aria-label -->
|
|
546
|
+
<button data-btn="icon" aria-label="Close dialog">✕</button>
|
|
547
|
+
|
|
548
|
+
<!-- Bad: No label (not accessible) -->
|
|
549
|
+
<button data-btn="icon">✕</button>
|
|
550
|
+
```
|
|
551
|
+
|
|
552
|
+
### Focus Management
|
|
553
|
+
|
|
554
|
+
The button system includes visible focus indicators:
|
|
555
|
+
|
|
556
|
+
```css
|
|
557
|
+
button:focus-visible {
|
|
558
|
+
outline: 2px solid currentColor;
|
|
559
|
+
outline-offset: 1px;
|
|
560
|
+
}
|
|
561
|
+
```
|
|
562
|
+
|
|
563
|
+
**Best practice:** Never use `outline: none` without providing an alternative
|
|
564
|
+
focus indicator.
|
|
565
|
+
|
|
566
|
+
### Color Contrast
|
|
567
|
+
|
|
568
|
+
Ensure sufficient color contrast (WCAG AA: 4.5:1 for text):
|
|
569
|
+
|
|
570
|
+
```html
|
|
571
|
+
<!-- Good contrast -->
|
|
572
|
+
<button style="--btn-bg: #1976D2; --btn-color: white">Button</button>
|
|
573
|
+
|
|
574
|
+
<!-- Poor contrast (avoid) -->
|
|
575
|
+
<button style="--btn-bg: #FFEB3B; --btn-color: white">Button</button>
|
|
576
|
+
```
|
|
577
|
+
|
|
578
|
+
## Button States Reference
|
|
579
|
+
|
|
580
|
+
### Interactive States
|
|
581
|
+
|
|
582
|
+
| State | Selector | Description |
|
|
583
|
+
| ----------------- | ------------------------------ | ----------------------------- |
|
|
584
|
+
| **Default** | `button` | Normal state |
|
|
585
|
+
| **Hover** | `button:hover` | Mouse hover |
|
|
586
|
+
| **Focus** | `button:focus` | Keyboard focus |
|
|
587
|
+
| **Focus Visible** | `button:focus-visible` | Keyboard focus indicator |
|
|
588
|
+
| **Active** | `button:active` | Being clicked |
|
|
589
|
+
| **Disabled** | `button[disabled]` | Disabled (native) |
|
|
590
|
+
| **ARIA Disabled** | `button[aria-disabled="true"]` | Disabled (ARIA, allows focus) |
|
|
591
|
+
|
|
592
|
+
### Visual Effects by State
|
|
593
|
+
|
|
594
|
+
```css
|
|
595
|
+
/* Default → Hover/Focus */
|
|
596
|
+
button:is(:hover, :focus) {
|
|
597
|
+
filter: brightness(0.85); /* 15% darker */
|
|
598
|
+
transform: scale(1.03); /* 3% larger */
|
|
599
|
+
outline: thin;
|
|
600
|
+
}
|
|
601
|
+
|
|
602
|
+
/* Disabled (no effects) */
|
|
603
|
+
button[disabled]:is(:hover, :focus) {
|
|
604
|
+
transform: none;
|
|
605
|
+
filter: none;
|
|
606
|
+
opacity: 0.5;
|
|
607
|
+
}
|
|
608
|
+
```
|
|
609
|
+
|
|
610
|
+
## CSS Variable Naming Convention
|
|
611
|
+
|
|
612
|
+
All button CSS variables follow the `--btn-{property}` pattern:
|
|
613
|
+
|
|
614
|
+
### Property Mapping
|
|
615
|
+
|
|
616
|
+
| Category | Variable Pattern | Example |
|
|
617
|
+
| --------------- | -------------------------- | ------------------------------------------- |
|
|
618
|
+
| **Colors** | `--btn-{property}` | `--btn-bg`, `--btn-color` |
|
|
619
|
+
| **Sizing** | `--btn-{dimension}` | `--btn-fs`, `--btn-height` |
|
|
620
|
+
| **Spacing** | `--btn-{spacing-type}` | `--btn-padding-inline`, `--btn-gap` |
|
|
621
|
+
| **Borders** | `--btn-{border-property}` | `--btn-border`, `--btn-radius` |
|
|
622
|
+
| **States** | `--btn-{state}-{property}` | `--btn-hover-filter`, `--btn-focus-outline` |
|
|
623
|
+
| **Size Tokens** | `--btn-size-{size}` | `--btn-size-xs`, `--btn-size-lg` |
|
|
624
|
+
| **Variants** | `--btn-{variant}` | `--btn-pill` |
|
|
625
|
+
|
|
626
|
+
### Common Variables Quick Reference
|
|
627
|
+
|
|
628
|
+
```css
|
|
629
|
+
/* Core Styling */
|
|
630
|
+
--btn-fs /* Font size */
|
|
631
|
+
--btn-fw /* Font weight */
|
|
632
|
+
--btn-bg /* Background color */
|
|
633
|
+
--btn-color /* Text color */
|
|
634
|
+
|
|
635
|
+
/* Spacing */
|
|
636
|
+
--btn-padding-inline /* Horizontal padding */
|
|
637
|
+
--btn-padding-block /* Vertical padding */
|
|
638
|
+
--btn-gap /* Gap between children */
|
|
639
|
+
|
|
640
|
+
/* Borders */
|
|
641
|
+
--btn-border /* Border style */
|
|
642
|
+
--btn-radius /* Border radius */
|
|
643
|
+
|
|
644
|
+
/* Layout */
|
|
645
|
+
--btn-width /* Button width */
|
|
646
|
+
--btn-height /* Button height */
|
|
647
|
+
--btn-display /* Display mode */
|
|
648
|
+
|
|
649
|
+
/* States */
|
|
650
|
+
--btn-hover-filter /* Hover brightness */
|
|
651
|
+
--btn-hover-transform /* Hover scale */
|
|
652
|
+
--btn-focus-outline /* Focus outline */
|
|
653
|
+
|
|
654
|
+
/* Size Tokens */
|
|
655
|
+
--btn-size-xs /* 0.6875rem / 11px */
|
|
656
|
+
--btn-size-sm /* 0.8125rem / 13px */
|
|
657
|
+
--btn-size-md /* 0.9375rem / 15px */
|
|
658
|
+
--btn-size-lg /* 1.125rem / 18px */
|
|
659
|
+
```
|
|
660
|
+
|
|
661
|
+
## Browser Support
|
|
662
|
+
|
|
663
|
+
The button styles use modern CSS features:
|
|
664
|
+
|
|
665
|
+
- **CSS Custom Properties:** All modern browsers (IE11 not supported)
|
|
666
|
+
- **`:is()` selector:** Chrome 88+, Firefox 78+, Safari 14+
|
|
667
|
+
- **`color-mix()`:** Chrome 111+, Firefox 113+, Safari 16.2+
|
|
668
|
+
- **`calc()`:** All modern browsers
|
|
669
|
+
- **Flexbox:** All modern browsers
|
|
670
|
+
- **Transitions:** All modern browsers
|
|
671
|
+
|
|
672
|
+
### Fallbacks
|
|
673
|
+
|
|
674
|
+
For older browsers without `color-mix()` support in text buttons:
|
|
675
|
+
|
|
676
|
+
```css
|
|
677
|
+
/* Modern browsers */
|
|
678
|
+
background-color: color-mix(in srgb, var(--btn-color) 10%, transparent);
|
|
679
|
+
|
|
680
|
+
/* Fallback (add before above rule) */
|
|
681
|
+
background-color: rgba(0, 0, 0, 0.05);
|
|
682
|
+
```
|
|
683
|
+
|
|
684
|
+
## Performance Tips
|
|
685
|
+
|
|
686
|
+
### Avoid Overriding Core Properties
|
|
687
|
+
|
|
688
|
+
When customizing, override CSS variables rather than properties:
|
|
689
|
+
|
|
690
|
+
```html
|
|
691
|
+
<!-- Good: Override variables -->
|
|
692
|
+
<button style="--btn-bg: blue">Button</button>
|
|
693
|
+
|
|
694
|
+
<!-- Less optimal: Override properties -->
|
|
695
|
+
<button style="background-color: blue">Button</button>
|
|
696
|
+
```
|
|
697
|
+
|
|
698
|
+
### Use Type Attributes
|
|
699
|
+
|
|
700
|
+
Leverage automatic styling for common button types:
|
|
701
|
+
|
|
702
|
+
```html
|
|
703
|
+
<!-- Automatic styling -->
|
|
704
|
+
<button type="submit">Submit</button>
|
|
705
|
+
|
|
706
|
+
<!-- Manual styling (more verbose) -->
|
|
707
|
+
<button style="--btn-bg: blue; --btn-color: white">Submit</button>
|
|
708
|
+
```
|
|
709
|
+
|
|
710
|
+
### Minimize Inline Styles
|
|
711
|
+
|
|
712
|
+
Create reusable button classes for common patterns:
|
|
713
|
+
|
|
714
|
+
```css
|
|
715
|
+
.btn-primary {
|
|
716
|
+
--btn-bg: #1976d2;
|
|
717
|
+
--btn-color: white;
|
|
718
|
+
}
|
|
719
|
+
|
|
720
|
+
.btn-large-pill {
|
|
721
|
+
--btn-fs: var(--btn-size-lg);
|
|
722
|
+
--btn-radius: var(--btn-pill);
|
|
723
|
+
}
|
|
724
|
+
```
|
|
725
|
+
|
|
726
|
+
```html
|
|
727
|
+
<button class="btn-primary">Primary</button>
|
|
728
|
+
<button class="btn-large-pill">Large Pill</button>
|
|
729
|
+
```
|
|
730
|
+
|
|
731
|
+
## Migration from Other Systems
|
|
732
|
+
|
|
733
|
+
### From Tailwind CSS
|
|
734
|
+
|
|
735
|
+
| Tailwind | fpkit Button |
|
|
736
|
+
| ------------------------------- | --------------------------------------------------------------- |
|
|
737
|
+
| `class="btn btn-primary"` | `type="submit"` or `style="--btn-bg: blue; --btn-color: white"` |
|
|
738
|
+
| `class="btn-sm"` | `data-btn="sm"` |
|
|
739
|
+
| `class="btn-lg"` | `data-btn="lg"` |
|
|
740
|
+
| `class="rounded-full"` | `data-btn="pill"` |
|
|
741
|
+
| `class="btn-ghost"` | `data-btn="text"` |
|
|
742
|
+
| `class="btn-circle"` | `data-btn="icon pill"` |
|
|
743
|
+
| `class="btn-disabled" disabled` | `disabled` or `aria-disabled="true"` |
|
|
744
|
+
|
|
745
|
+
### From Bootstrap
|
|
746
|
+
|
|
747
|
+
| Bootstrap | fpkit Button |
|
|
748
|
+
| --------------------------- | ------------------------------------ |
|
|
749
|
+
| `class="btn btn-primary"` | `type="submit"` or custom `--btn-bg` |
|
|
750
|
+
| `class="btn btn-secondary"` | `type="reset"` or custom styling |
|
|
751
|
+
| `class="btn btn-sm"` | `data-btn="sm"` |
|
|
752
|
+
| `class="btn btn-lg"` | `data-btn="lg"` |
|
|
753
|
+
| `class="btn rounded-pill"` | `data-btn="pill"` |
|
|
754
|
+
| `class="btn btn-link"` | `data-btn="text"` |
|
|
755
|
+
| `class="btn" disabled` | `disabled` or `aria-disabled="true"` |
|
|
756
|
+
|
|
757
|
+
## Related Resources
|
|
758
|
+
|
|
759
|
+
- **React Component** - See [README.mdx](./README.mdx) for the React Button
|
|
760
|
+
component API
|
|
761
|
+
- **MDN: `<button>` element** -
|
|
762
|
+
[https://developer.mozilla.org/en-US/docs/Web/HTML/Element/button](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/button)
|
|
763
|
+
- **W3C ARIA: Button Role** -
|
|
764
|
+
[https://www.w3.org/WAI/ARIA/apg/patterns/button/](https://www.w3.org/WAI/ARIA/apg/patterns/button/)
|
|
765
|
+
- **CSS Custom Properties** -
|
|
766
|
+
[https://developer.mozilla.org/en-US/docs/Web/CSS/Using_CSS_custom_properties](https://developer.mozilla.org/en-US/docs/Web/CSS/Using_CSS_custom_properties)
|