@fpkit/acss 3.1.1 → 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.
Files changed (202) hide show
  1. package/libs/{chunk-2NRIP6RB.cjs → chunk-2C3YLBWP.cjs} +3 -3
  2. package/libs/{chunk-NWJDAHP6.cjs → chunk-2GJHKWEK.cjs} +3 -3
  3. package/libs/{chunk-FVROL3V5.js → chunk-2JCDEC32.js} +3 -3
  4. package/libs/{chunk-IRLFZ3OL.js → chunk-3XJC4XUG.js} +2 -2
  5. package/libs/{chunk-L6PRDL6F.cjs → chunk-5CJPTDK3.cjs} +3 -3
  6. package/libs/{chunk-E4OSROCA.cjs → chunk-5QSNJQVH.cjs} +3 -3
  7. package/libs/{chunk-O3JIHC5M.cjs → chunk-6BUJZ4DJ.cjs} +3 -3
  8. package/libs/{chunk-WXBFBWYF.cjs → chunk-AFINOD2L.cjs} +3 -3
  9. package/libs/{chunk-HRRHPLER.js → chunk-AWZLSWDO.js} +2 -2
  10. package/libs/chunk-DDSXKOUB.js +7 -0
  11. package/libs/chunk-DDSXKOUB.js.map +1 -0
  12. package/libs/{chunk-CWRNJA4P.js → chunk-DIJBIOFE.js} +3 -3
  13. package/libs/chunk-EJ6KYBFE.cjs +13 -0
  14. package/libs/chunk-EJ6KYBFE.cjs.map +1 -0
  15. package/libs/{chunk-GUJSMQ3V.cjs → chunk-EKJYOCLY.cjs} +3 -3
  16. package/libs/{chunk-X5RKCLDC.cjs → chunk-F64GE6RG.cjs} +4 -4
  17. package/libs/{chunk-5RAWNUVD.js → chunk-IBUTNPTQ.js} +2 -2
  18. package/libs/chunk-IWP4VJEP.cjs +18 -0
  19. package/libs/chunk-IWP4VJEP.cjs.map +1 -0
  20. package/libs/{chunk-ZFJ4U45S.js → chunk-KDMX3FAW.js} +2 -2
  21. package/libs/{chunk-DYFAUAB7.cjs → chunk-LXODKKA3.cjs} +4 -4
  22. package/libs/{chunk-MPTMPBFT.js → chunk-M7JLT62Q.js} +2 -2
  23. package/libs/{chunk-IQ76HGVP.js → chunk-MBWI67UT.js} +2 -2
  24. package/libs/{chunk-O5XAJ7BY.cjs → chunk-NCGVF2QS.cjs} +4 -4
  25. package/libs/{chunk-W2UIN7EV.cjs → chunk-NPWHQVYB.cjs} +3 -3
  26. package/libs/{chunk-43TK2ICH.js → chunk-PMWL5XZ4.js} +3 -3
  27. package/libs/{chunk-KVKQLRJG.js → chunk-TF3GQKOY.js} +2 -2
  28. package/libs/{chunk-IEB64SWY.js → chunk-U5VA34SU.js} +2 -2
  29. package/libs/chunk-UGMP72J2.js +8 -0
  30. package/libs/chunk-UGMP72J2.js.map +1 -0
  31. package/libs/{chunk-EE3ZWSBY.cjs → chunk-URBGDUFN.cjs} +6 -6
  32. package/libs/{chunk-TPIB3RQP.js → chunk-ZF6Y7W57.js} +5 -5
  33. package/libs/component-props-50e69975.d.ts +66 -0
  34. package/libs/components/box/box.css +1 -0
  35. package/libs/components/box/box.css.map +1 -0
  36. package/libs/components/box/box.min.css +3 -0
  37. package/libs/components/breadcrumbs/breadcrumb.cjs +6 -6
  38. package/libs/components/breadcrumbs/breadcrumb.js +3 -3
  39. package/libs/components/button.cjs +4 -4
  40. package/libs/components/button.d.cts +10 -3
  41. package/libs/components/button.d.ts +10 -3
  42. package/libs/components/button.js +2 -2
  43. package/libs/components/card.cjs +7 -7
  44. package/libs/components/card.d.cts +13 -85
  45. package/libs/components/card.d.ts +13 -85
  46. package/libs/components/card.js +2 -2
  47. package/libs/components/cards/card.css +1 -1
  48. package/libs/components/cards/card.css.map +1 -1
  49. package/libs/components/cards/card.min.css +2 -2
  50. package/libs/components/cluster/cluster.css +1 -0
  51. package/libs/components/cluster/cluster.css.map +1 -0
  52. package/libs/components/cluster/cluster.min.css +3 -0
  53. package/libs/components/dialog/dialog.cjs +7 -7
  54. package/libs/components/dialog/dialog.js +5 -5
  55. package/libs/components/form/fields.cjs +4 -4
  56. package/libs/components/form/fields.js +2 -2
  57. package/libs/components/form/textarea.cjs +4 -4
  58. package/libs/components/form/textarea.js +2 -2
  59. package/libs/components/grid/grid.css +1 -0
  60. package/libs/components/grid/grid.css.map +1 -0
  61. package/libs/components/grid/grid.min.css +3 -0
  62. package/libs/components/heading/heading.cjs +3 -3
  63. package/libs/components/heading/heading.js +2 -2
  64. package/libs/components/icons/icon.cjs +4 -4
  65. package/libs/components/icons/icon.d.cts +2 -2
  66. package/libs/components/icons/icon.d.ts +2 -2
  67. package/libs/components/icons/icon.js +2 -2
  68. package/libs/components/link/link.cjs +6 -6
  69. package/libs/components/link/link.js +2 -2
  70. package/libs/components/list/list.cjs +5 -5
  71. package/libs/components/list/list.js +2 -2
  72. package/libs/components/modal.cjs +4 -4
  73. package/libs/components/modal.d.cts +1 -1
  74. package/libs/components/modal.d.ts +1 -1
  75. package/libs/components/modal.js +3 -3
  76. package/libs/components/nav/nav.cjs +7 -7
  77. package/libs/components/nav/nav.js +3 -3
  78. package/libs/components/stack/stack.css +1 -0
  79. package/libs/components/stack/stack.css.map +1 -0
  80. package/libs/components/stack/stack.min.css +3 -0
  81. package/libs/components/tables/table.d.cts +1 -1
  82. package/libs/components/tables/table.d.ts +1 -1
  83. package/libs/components/text/text.cjs +5 -5
  84. package/libs/components/text/text.js +2 -2
  85. package/libs/hooks.cjs +4 -4
  86. package/libs/hooks.js +3 -3
  87. package/libs/{icons-287fce3a.d.ts → icons-df8e744f.d.ts} +1 -1
  88. package/libs/icons.cjs +3 -3
  89. package/libs/icons.d.cts +2 -2
  90. package/libs/icons.d.ts +2 -2
  91. package/libs/icons.js +2 -2
  92. package/libs/index.cjs +64 -63
  93. package/libs/index.cjs.map +1 -1
  94. package/libs/index.css +1 -1
  95. package/libs/index.css.map +1 -1
  96. package/libs/index.d.cts +923 -4
  97. package/libs/index.d.ts +923 -4
  98. package/libs/index.js +28 -28
  99. package/libs/index.js.map +1 -1
  100. package/package.json +2 -2
  101. package/src/components/alert/STYLES.mdx +790 -0
  102. package/src/components/badge/STYLES.mdx +610 -0
  103. package/src/components/box/README.mdx +401 -0
  104. package/src/components/box/STYLES.mdx +360 -0
  105. package/src/components/box/box.scss +245 -0
  106. package/src/components/box/box.stories.tsx +395 -0
  107. package/src/components/box/box.test.tsx +425 -0
  108. package/src/components/box/box.tsx +170 -0
  109. package/src/components/box/box.types.ts +166 -0
  110. package/src/components/breadcrumbs/STYLES.mdx +99 -0
  111. package/src/components/buttons/STYLES.mdx +766 -0
  112. package/src/components/cards/STYLES.mdx +835 -0
  113. package/src/components/cards/card.scss +29 -21
  114. package/src/components/cards/card.tsx +13 -3
  115. package/src/components/cards/card.types.ts +13 -0
  116. package/src/components/cluster/README.mdx +595 -0
  117. package/src/components/cluster/STYLES.mdx +626 -0
  118. package/src/components/cluster/cluster.scss +86 -0
  119. package/src/components/cluster/cluster.stories.tsx +385 -0
  120. package/src/components/cluster/cluster.test.tsx +655 -0
  121. package/src/components/cluster/cluster.tsx +94 -0
  122. package/src/components/cluster/cluster.types.ts +75 -0
  123. package/src/components/details/STYLES.mdx +445 -0
  124. package/src/components/dialog/STYLES.mdx +888 -0
  125. package/src/components/flexbox/STYLES.mdx +1 -1
  126. package/src/components/form/STYLES.mdx +821 -0
  127. package/src/components/grid/README.mdx +709 -0
  128. package/src/components/grid/STYLES.mdx +785 -0
  129. package/src/components/grid/grid.scss +287 -0
  130. package/src/components/grid/grid.stories.tsx +486 -0
  131. package/src/components/grid/grid.test.tsx +981 -0
  132. package/src/components/grid/grid.tsx +222 -0
  133. package/src/components/grid/grid.types.ts +344 -0
  134. package/src/components/icons/STYLES.mdx +56 -0
  135. package/src/components/images/STYLES.mdx +75 -0
  136. package/src/components/layout/STYLES.mdx +556 -0
  137. package/src/components/link/STYLES.mdx +75 -0
  138. package/src/components/list/STYLES.mdx +631 -0
  139. package/src/components/nav/STYLES.mdx +460 -0
  140. package/src/components/progress/STYLES.mdx +64 -0
  141. package/src/components/stack/README.mdx +400 -0
  142. package/src/components/stack/STYLES.mdx +414 -0
  143. package/src/components/stack/stack.scss +109 -0
  144. package/src/components/stack/stack.stories.tsx +559 -0
  145. package/src/components/stack/stack.test.tsx +426 -0
  146. package/src/components/stack/stack.tsx +141 -0
  147. package/src/components/stack/stack.types.ts +133 -0
  148. package/src/components/tag/STYLES.mdx +105 -0
  149. package/src/components/text-to-speech/STYLES.mdx +80 -0
  150. package/src/components/ui.tsx +3 -3
  151. package/src/index.scss +5 -1
  152. package/src/index.ts +305 -12
  153. package/src/sass/GLOBALS-STYLES.md +631 -0
  154. package/src/sass/_globals.scss +45 -24
  155. package/src/styles/box/box.css +220 -0
  156. package/src/styles/box/box.css.map +1 -0
  157. package/src/styles/cards/card.css +22 -17
  158. package/src/styles/cards/card.css.map +1 -1
  159. package/src/styles/cluster/cluster.css +71 -0
  160. package/src/styles/cluster/cluster.css.map +1 -0
  161. package/src/styles/grid/grid.css +238 -0
  162. package/src/styles/grid/grid.css.map +1 -0
  163. package/src/styles/index.css +667 -49
  164. package/src/styles/index.css.map +1 -1
  165. package/src/styles/stack/stack.css +86 -0
  166. package/src/styles/stack/stack.css.map +1 -0
  167. package/src/types/component-props.ts +42 -14
  168. package/src/types/layout-primitives.ts +48 -0
  169. package/src/types/shared.ts +10 -26
  170. package/libs/chunk-ENTCUJ3A.cjs +0 -13
  171. package/libs/chunk-ENTCUJ3A.cjs.map +0 -1
  172. package/libs/chunk-HHLNOC5T.js +0 -7
  173. package/libs/chunk-HHLNOC5T.js.map +0 -1
  174. package/libs/chunk-KK47SYZI.js +0 -8
  175. package/libs/chunk-KK47SYZI.js.map +0 -1
  176. package/libs/chunk-W5TKWBFC.cjs +0 -18
  177. package/libs/chunk-W5TKWBFC.cjs.map +0 -1
  178. package/libs/component-props-67d978a2.d.ts +0 -38
  179. /package/libs/{chunk-2NRIP6RB.cjs.map → chunk-2C3YLBWP.cjs.map} +0 -0
  180. /package/libs/{chunk-NWJDAHP6.cjs.map → chunk-2GJHKWEK.cjs.map} +0 -0
  181. /package/libs/{chunk-FVROL3V5.js.map → chunk-2JCDEC32.js.map} +0 -0
  182. /package/libs/{chunk-IRLFZ3OL.js.map → chunk-3XJC4XUG.js.map} +0 -0
  183. /package/libs/{chunk-L6PRDL6F.cjs.map → chunk-5CJPTDK3.cjs.map} +0 -0
  184. /package/libs/{chunk-E4OSROCA.cjs.map → chunk-5QSNJQVH.cjs.map} +0 -0
  185. /package/libs/{chunk-O3JIHC5M.cjs.map → chunk-6BUJZ4DJ.cjs.map} +0 -0
  186. /package/libs/{chunk-WXBFBWYF.cjs.map → chunk-AFINOD2L.cjs.map} +0 -0
  187. /package/libs/{chunk-HRRHPLER.js.map → chunk-AWZLSWDO.js.map} +0 -0
  188. /package/libs/{chunk-CWRNJA4P.js.map → chunk-DIJBIOFE.js.map} +0 -0
  189. /package/libs/{chunk-GUJSMQ3V.cjs.map → chunk-EKJYOCLY.cjs.map} +0 -0
  190. /package/libs/{chunk-X5RKCLDC.cjs.map → chunk-F64GE6RG.cjs.map} +0 -0
  191. /package/libs/{chunk-5RAWNUVD.js.map → chunk-IBUTNPTQ.js.map} +0 -0
  192. /package/libs/{chunk-ZFJ4U45S.js.map → chunk-KDMX3FAW.js.map} +0 -0
  193. /package/libs/{chunk-DYFAUAB7.cjs.map → chunk-LXODKKA3.cjs.map} +0 -0
  194. /package/libs/{chunk-MPTMPBFT.js.map → chunk-M7JLT62Q.js.map} +0 -0
  195. /package/libs/{chunk-IQ76HGVP.js.map → chunk-MBWI67UT.js.map} +0 -0
  196. /package/libs/{chunk-O5XAJ7BY.cjs.map → chunk-NCGVF2QS.cjs.map} +0 -0
  197. /package/libs/{chunk-W2UIN7EV.cjs.map → chunk-NPWHQVYB.cjs.map} +0 -0
  198. /package/libs/{chunk-43TK2ICH.js.map → chunk-PMWL5XZ4.js.map} +0 -0
  199. /package/libs/{chunk-KVKQLRJG.js.map → chunk-TF3GQKOY.js.map} +0 -0
  200. /package/libs/{chunk-IEB64SWY.js.map → chunk-U5VA34SU.js.map} +0 -0
  201. /package/libs/{chunk-EE3ZWSBY.cjs.map → chunk-URBGDUFN.cjs.map} +0 -0
  202. /package/libs/{chunk-TPIB3RQP.js.map → chunk-ZF6Y7W57.js.map} +0 -0
@@ -0,0 +1,401 @@
1
+ import { Meta, Story, Canvas } from '@storybook/addon-docs/blocks';
2
+ import * as BoxStories from './box.stories';
3
+
4
+ <Meta of={BoxStories} />
5
+
6
+ # Box Component
7
+
8
+ A fundamental container primitive for spacing and sizing control.
9
+
10
+ ## Overview
11
+
12
+ The Box component is the foundational layout primitive in fpkit, providing a flexible, semantic container with comprehensive control over spacing (padding/margin), sizing, and visual appearance. It uses utility classes generated from props, ensuring consistent styling across your application.
13
+
14
+ ## Features
15
+
16
+ - **Unified Spacing Scale**: Fluid responsive spacing using CSS `clamp()` for automatic adaptation across viewports
17
+ - **Logical Properties**: Uses `padding-inline`/`padding-block` for better internationalization support
18
+ - **Polymorphic Rendering**: Render as any semantic HTML element via the `as` prop
19
+ - **CSS Custom Properties**: All values customizable for theming
20
+ - **Type-Safe**: Full TypeScript support with IntelliSense
21
+ - **Zero Runtime**: Utility classes compiled at build time
22
+
23
+ ## Installation
24
+
25
+ ```bash
26
+ npm install @fpkit/acss
27
+ ```
28
+
29
+ ## Basic Usage
30
+
31
+ ```tsx
32
+ import { Box } from '@fpkit/acss';
33
+ import '@fpkit/acss/styles';
34
+
35
+ function App() {
36
+ return (
37
+ <Box padding="md">
38
+ <h1>Content</h1>
39
+ </Box>
40
+ );
41
+ }
42
+ ```
43
+
44
+ ## API Reference
45
+
46
+ ### Props
47
+
48
+ | Prop | Type | Default | Description |
49
+ |------|------|---------|-------------|
50
+ | `padding` | `SpacingScale` | - | Padding on all sides |
51
+ | `paddingInline` | `SpacingScale` | - | Padding on inline axis (left/right in LTR) |
52
+ | `paddingBlock` | `SpacingScale` | - | Padding on block axis (top/bottom) |
53
+ | `margin` | `SpacingScale` | - | Margin on all sides |
54
+ | `marginInline` | `SpacingScale` | - | Margin on inline axis |
55
+ | `marginBlock` | `SpacingScale` | - | Margin on block axis |
56
+ | `width` | `'auto' \| 'full' \| 'fit' \| 'max'` | `'auto'` | Width behavior |
57
+ | `maxWidth` | `'xs' \| 'sm' \| 'md' \| 'lg' \| 'xl' \| 'container'` | - | Maximum width constraint |
58
+ | `radius` | `SpacingScale \| 'full'` | - | Border radius |
59
+ | `as` | `BoxElement` | `'div'` | HTML element to render |
60
+ | `className` | `string` | - | Additional CSS classes |
61
+ | `styles` | `CSSProperties` | - | Inline styles |
62
+ | `children` | `ReactNode` | - | Child elements |
63
+
64
+ #### SpacingScale
65
+
66
+ The spacing scale provides fluid, responsive values that adapt to viewport size:
67
+
68
+ - `'0'`: No spacing (0)
69
+ - `'xs'`: Extra small (4-8px responsive)
70
+ - `'sm'`: Small (8-12px responsive)
71
+ - `'md'`: Medium (12-18px responsive)
72
+ - `'lg'`: Large (16-24px responsive)
73
+ - `'xl'`: Extra large (24-32px responsive)
74
+
75
+ #### BoxElement
76
+
77
+ Semantic HTML elements supported via the `as` prop:
78
+
79
+ - `'div'` (default)
80
+ - `'section'`
81
+ - `'article'`
82
+ - `'aside'`
83
+ - `'main'`
84
+ - `'header'`
85
+ - `'footer'`
86
+ - `'nav'`
87
+
88
+ ## Usage Examples
89
+
90
+ ### Basic Container
91
+
92
+ ```tsx
93
+ <Box padding="md">
94
+ <h1>Page Title</h1>
95
+ <p>Content goes here...</p>
96
+ </Box>
97
+ ```
98
+
99
+ ### Centered Container
100
+
101
+ A common pattern for page layouts with max-width and centered alignment:
102
+
103
+ ```tsx
104
+ <Box
105
+ padding="lg"
106
+ maxWidth="container"
107
+ style={{ marginInline: 'auto' }}
108
+ >
109
+ <article>
110
+ <h1>Article Title</h1>
111
+ <p>Centered content with 1200px max width...</p>
112
+ </article>
113
+ </Box>
114
+ ```
115
+
116
+ ### Card-like Component
117
+
118
+ Create a card with padding, border radius, and shadow:
119
+
120
+ ```tsx
121
+ <Box
122
+ padding="lg"
123
+ radius="md"
124
+ as="article"
125
+ styles={{
126
+ backgroundColor: '#fff',
127
+ boxShadow: '0 1px 3px rgba(0,0,0,0.1)',
128
+ border: '1px solid #e0e0e0'
129
+ }}
130
+ >
131
+ <h3>Card Title</h3>
132
+ <p>Card content goes here...</p>
133
+ <button>Action</button>
134
+ </Box>
135
+ ```
136
+
137
+ ### Asymmetric Spacing
138
+
139
+ Use logical properties for different horizontal and vertical padding:
140
+
141
+ ```tsx
142
+ <Box
143
+ paddingInline="xl"
144
+ paddingBlock="md"
145
+ as="section"
146
+ >
147
+ <p>Wide horizontal padding, narrow vertical padding</p>
148
+ </Box>
149
+ ```
150
+
151
+ ### Semantic Sections
152
+
153
+ Use semantic HTML elements for better accessibility:
154
+
155
+ ```tsx
156
+ <Box as="main" padding="lg">
157
+ <Box as="section" padding="xl" margin="lg">
158
+ <h2>Section Title</h2>
159
+ <p>Section content...</p>
160
+ </Box>
161
+
162
+ <Box as="aside" padding="md" marginInline="lg">
163
+ <h3>Related Content</h3>
164
+ <p>Sidebar content...</p>
165
+ </Box>
166
+ </Box>
167
+ ```
168
+
169
+ ### Full-Width Hero Section
170
+
171
+ ```tsx
172
+ <Box
173
+ as="section"
174
+ width="full"
175
+ paddingBlock="xl"
176
+ paddingInline="lg"
177
+ styles={{
178
+ backgroundColor: '#0066cc',
179
+ color: '#fff'
180
+ }}
181
+ >
182
+ <h1>Hero Title</h1>
183
+ <p>Hero subtitle or description...</p>
184
+ </Box>
185
+ ```
186
+
187
+ ## Theming with CSS Custom Properties
188
+
189
+ Override CSS variables to customize spacing and appearance:
190
+
191
+ ```tsx
192
+ <Box
193
+ padding="lg"
194
+ radius="md"
195
+ styles={{
196
+ // Override spacing scale
197
+ '--spacing-lg': '2rem',
198
+ // Override border radius
199
+ '--box-radius-md': '1rem',
200
+ // Add custom styles
201
+ backgroundColor: '#f8f9fa'
202
+ } as React.CSSProperties}
203
+ >
204
+ <h3>Themed Box</h3>
205
+ <p>Custom spacing and radius via CSS variables</p>
206
+ </Box>
207
+ ```
208
+
209
+ ## Composition
210
+
211
+ Box components can be nested for complex layouts:
212
+
213
+ ```tsx
214
+ <Box padding="lg" styles={{ backgroundColor: '#f8f9fa' }}>
215
+ <h2>Outer Container</h2>
216
+
217
+ <Box
218
+ padding="md"
219
+ margin="md"
220
+ radius="md"
221
+ styles={{ backgroundColor: '#fff', boxShadow: '0 1px 3px rgba(0,0,0,0.1)' }}
222
+ >
223
+ <h3>Nested Box 1</h3>
224
+ <p>Independent spacing and styling</p>
225
+ </Box>
226
+
227
+ <Box
228
+ padding="md"
229
+ margin="md"
230
+ radius="md"
231
+ styles={{ backgroundColor: '#fff', boxShadow: '0 1px 3px rgba(0,0,0,0.1)' }}
232
+ >
233
+ <h3>Nested Box 2</h3>
234
+ <p>Each Box is self-contained</p>
235
+ </Box>
236
+ </Box>
237
+ ```
238
+
239
+ ## Accessibility
240
+
241
+ ### Semantic HTML
242
+
243
+ Always prefer semantic HTML elements over generic divs:
244
+
245
+ ```tsx
246
+ // ✅ Good - semantic elements
247
+ <Box as="section" padding="lg">
248
+ <Box as="article" padding="md">
249
+ <h2>Article Title</h2>
250
+ </Box>
251
+ </Box>
252
+
253
+ // ❌ Avoid - generic divs when semantic elements make sense
254
+ <Box padding="lg">
255
+ <Box padding="md">
256
+ <h2>Article Title</h2>
257
+ </Box>
258
+ </Box>
259
+ ```
260
+
261
+ ### ARIA Attributes
262
+
263
+ Box forwards all ARIA attributes for enhanced accessibility:
264
+
265
+ ```tsx
266
+ <Box
267
+ as="section"
268
+ padding="lg"
269
+ aria-label="Featured content"
270
+ role="region"
271
+ >
272
+ <h2>Featured Articles</h2>
273
+ <p>Content...</p>
274
+ </Box>
275
+ ```
276
+
277
+ ### Focus Management
278
+
279
+ Use refs for programmatic focus control:
280
+
281
+ ```tsx
282
+ function ScrollToSection() {
283
+ const sectionRef = useRef<HTMLElement>(null);
284
+
285
+ const scrollToSection = () => {
286
+ sectionRef.current?.scrollIntoView({ behavior: 'smooth' });
287
+ };
288
+
289
+ return (
290
+ <>
291
+ <button onClick={scrollToSection}>Jump to Section</button>
292
+ <Box as="section" ref={sectionRef} padding="xl">
293
+ <h2>Target Section</h2>
294
+ </Box>
295
+ </>
296
+ );
297
+ }
298
+ ```
299
+
300
+ ## Best Practices
301
+
302
+ ### 1. Use Semantic Elements
303
+
304
+ Choose the most appropriate HTML element for your content:
305
+
306
+ - Use `<section>` for thematic groupings
307
+ - Use `<article>` for self-contained content
308
+ - Use `<aside>` for tangentially related content
309
+ - Use `<main>` for primary page content
310
+ - Use `<header>`/`<footer>` for page or section headers/footers
311
+ - Use `<nav>` for navigation landmarks
312
+
313
+ ### 2. Prefer Logical Properties
314
+
315
+ Use `paddingInline`/`paddingBlock` instead of directional padding for better i18n support:
316
+
317
+ ```tsx
318
+ // ✅ Good - adapts to text direction
319
+ <Box paddingInline="lg" paddingBlock="md">
320
+ Content
321
+ </Box>
322
+
323
+ // ❌ Avoid - hardcoded direction
324
+ <Box style={{ paddingLeft: '2rem', paddingRight: '2rem' }}>
325
+ Content
326
+ </Box>
327
+ ```
328
+
329
+ ### 3. Leverage the Spacing Scale
330
+
331
+ Use the spacing scale for consistency instead of arbitrary values:
332
+
333
+ ```tsx
334
+ // ✅ Good - consistent spacing
335
+ <Box padding="md" margin="lg">
336
+ Content
337
+ </Box>
338
+
339
+ // ❌ Avoid - arbitrary values
340
+ <Box style={{ padding: '15px', margin: '22px' }}>
341
+ Content
342
+ </Box>
343
+ ```
344
+
345
+ ### 4. Compose for Complex Layouts
346
+
347
+ Build complex layouts by composing simple Box components:
348
+
349
+ ```tsx
350
+ <Box as="main" maxWidth="container" style={{ marginInline: 'auto' }}>
351
+ <Box as="section" paddingBlock="xl">
352
+ <h1>Main Content</h1>
353
+ </Box>
354
+ <Box as="aside" padding="lg" radius="md">
355
+ <h2>Sidebar</h2>
356
+ </Box>
357
+ </Box>
358
+ ```
359
+
360
+ ## Related Components
361
+
362
+ - **Stack**: Simplified vertical/horizontal layouts with gap spacing
363
+ - **Cluster**: Wrapping flex layout for inline groups (tags, buttons)
364
+ - **Grid**: CSS Grid primitive with responsive columns
365
+ - **Flex**: Full-featured flexbox container with advanced controls
366
+
367
+ ## CSS Variables
368
+
369
+ See [STYLES.mdx](./STYLES.mdx) for a complete reference of CSS custom properties.
370
+
371
+ ## TypeScript Support
372
+
373
+ Box is fully typed with TypeScript, providing IntelliSense and type checking:
374
+
375
+ ```tsx
376
+ import type { BoxProps } from '@fpkit/acss';
377
+
378
+ const MyBox: React.FC<BoxProps> = (props) => {
379
+ return <Box {...props} />;
380
+ };
381
+
382
+ // Type-safe polymorphic rendering
383
+ const section: React.FC = () => (
384
+ <Box
385
+ as="section"
386
+ // TypeScript knows section-specific props are available
387
+ aria-labelledby="section-title"
388
+ >
389
+ <h2 id="section-title">Section</h2>
390
+ </Box>
391
+ );
392
+ ```
393
+
394
+ ## Browser Support
395
+
396
+ Box works in all modern browsers that support:
397
+ - CSS Custom Properties
398
+ - CSS Logical Properties
399
+ - CSS `clamp()` function
400
+
401
+ For legacy browser support, consider using PostCSS with appropriate polyfills.