@equal-experts/kuat-react 0.2.2 → 0.2.4

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.
@@ -0,0 +1,500 @@
1
+ # Kuat Design System Borders
2
+
3
+ A guide to using borders in the Kuat Design System. This document helps ensure consistent, accessible, and purposeful border usage across all digital products built with shadcn/ui and shadcn-vue.
4
+
5
+ ---
6
+
7
+ ## Overview
8
+
9
+ The Kuat Design System follows a **minimal border philosophy**—borders should only be used when necessary to create clear separation between components or sections. When possible, prefer spacing and visual hierarchy over borders to create a cleaner, more modern interface.
10
+
11
+ **Key Principle:** Use borders sparingly and purposefully. Spacing and visual hierarchy should be the primary tools for creating separation.
12
+
13
+ ---
14
+
15
+ ## Border Usage Principles
16
+
17
+ ### When to Use Borders
18
+
19
+ Borders should only be used when:
20
+
21
+ 1. **Creating separation between distinct sections** of content that need clear visual boundaries
22
+ 2. **Distinguishing interactive elements** from static content (e.g., form inputs, clickable cards)
23
+ 3. **Defining component boundaries** where spacing alone is insufficient
24
+ 4. **Indicating state changes** (e.g., focus states, error states)
25
+
26
+ ### When NOT to Use Borders
27
+
28
+ Avoid using borders when:
29
+
30
+ - ❌ Spacing alone can create sufficient separation
31
+ - ❌ Visual hierarchy (size, color, weight) can distinguish elements
32
+ - ❌ The border would create visual clutter or noise
33
+ - ❌ The separation is already clear through other design elements
34
+
35
+ ### Prefer Spacing Over Borders
36
+
37
+ **✅ Good: Using spacing for separation**
38
+
39
+ ```tsx
40
+ // React
41
+ <div className="space-y-6">
42
+ <section className="py-6">
43
+ <h2>Section Title</h2>
44
+ <p>Content here</p>
45
+ </section>
46
+ <section className="py-6">
47
+ <h2>Another Section</h2>
48
+ <p>More content</p>
49
+ </section>
50
+ </div>
51
+ ```
52
+
53
+ **❌ Avoid: Unnecessary borders**
54
+
55
+ ```tsx
56
+ // Don't do this - spacing is sufficient
57
+ <div>
58
+ <section className="border-b pb-6">
59
+ <h2>Section Title</h2>
60
+ </section>
61
+ <section className="pt-6">
62
+ <h2>Another Section</h2>
63
+ </section>
64
+ </div>
65
+ ```
66
+
67
+ ---
68
+
69
+ ## Border Specifications
70
+
71
+ ### Border Width
72
+
73
+ Borders should be between **1px and 4px** in width:
74
+
75
+ - **1px:** Default borders for most UI elements (cards, inputs, dividers)
76
+ - **2px:** Emphasized borders for important separations or active states
77
+ - **3-4px:** Reserved for special cases like focus rings or high-contrast separations
78
+
79
+ **Usage:**
80
+
81
+ ```tsx
82
+ // React - 1px default border
83
+ <div className="border border-border">Content</div>
84
+
85
+ // React - 2px emphasized border
86
+ <div className="border-2 border-primary">Important content</div>
87
+
88
+ // React - 4px for focus rings (use ring utilities)
89
+ <button className="focus:ring-4 focus:ring-ring">Button</button>
90
+ ```
91
+
92
+ ### Border Style
93
+
94
+ **Always use solid lines.** The design system does not use dashed, dotted, or other border styles.
95
+
96
+ ```tsx
97
+ // ✅ Correct - solid border (default)
98
+ <div className="border border-border">Content</div>
99
+
100
+ // ❌ Avoid - dashed or dotted borders
101
+ <div className="border-dashed border-border">Content</div>
102
+ ```
103
+
104
+ ### Border Color
105
+
106
+ Borders use the semantic color token `--border` which adapts to light and dark modes:
107
+
108
+ - **Light Mode:** `var(--slate-200)` - Subtle, light gray
109
+ - **Dark Mode:** `var(--slate-700)` - Subtle, medium gray
110
+
111
+ **Usage:**
112
+
113
+ ```tsx
114
+ // React - Using semantic border color
115
+ <div className="border border-border">Content</div>
116
+
117
+ // React - Using Tailwind class (recommended)
118
+ <div className="border-border">Content</div>
119
+ ```
120
+
121
+ ### Accessibility: Color Contrast
122
+
123
+ Borders must meet **minimum contrast ratio requirements for graphical objects** (WCAG 2.1 Level AA):
124
+
125
+ - **Non-text content (borders):** Minimum contrast ratio of **3:1** against adjacent colors
126
+ - This ensures borders are visible and distinguishable
127
+
128
+ The default `border-border` token is designed to meet these requirements against both light and dark backgrounds.
129
+
130
+ **Testing Contrast:**
131
+
132
+ Always verify border contrast meets accessibility standards:
133
+ - Test borders against their background colors
134
+ - Ensure borders are visible in both light and dark modes
135
+ - Use browser DevTools accessibility features to verify contrast ratios
136
+
137
+ ---
138
+
139
+ ## Border Radius
140
+
141
+ The Kuat Design System uses a **minimal border radius approach**—most elements have no border radius by default, with radius applied only to interactive elements for better usability and visual feedback.
142
+
143
+ ### Default: No Radius (0px)
144
+
145
+ Most elements in the design system use **no border radius** (0px) by default. This creates a clean, modern, geometric aesthetic.
146
+
147
+ **Elements with no radius:**
148
+ - Cards
149
+ - Containers
150
+ - Sections
151
+ - Dividers
152
+ - Static content blocks
153
+
154
+ ```tsx
155
+ // React - Default no radius
156
+ <div className="bg-card border border-border p-4">
157
+ Card content (no radius)
158
+ </div>
159
+ ```
160
+
161
+ ### Interactive Elements: 6px Radius
162
+
163
+ **Interactive elements** that users can click or interact with should use a **6px border radius** to provide visual feedback and improve usability.
164
+
165
+ **Interactive elements that use 6px radius:**
166
+ - Buttons (all types)
167
+ - Clickable cards
168
+ - Interactive tiles
169
+ - Clickable list items
170
+ - Tabs
171
+ - Navigation items
172
+
173
+ ```tsx
174
+ // React - Button with 6px radius
175
+ <button className="bg-primary text-primary-foreground rounded-[6px] px-4 py-2">
176
+ Click me
177
+ </button>
178
+
179
+ // React - Clickable card with 6px radius
180
+ <div className="bg-card border border-border rounded-[6px] p-4 cursor-pointer hover:bg-muted">
181
+ Clickable card
182
+ </div>
183
+ ```
184
+
185
+ ### Form Inputs: 4px Radius
186
+
187
+ **Form input elements** should use a **4px border radius** to provide subtle visual softening while maintaining a clean, professional appearance.
188
+
189
+ **Form elements that use 4px radius:**
190
+ - Text inputs
191
+ - Textareas
192
+ - Select dropdowns
193
+ - Search inputs
194
+ - Number inputs
195
+ - Date pickers
196
+
197
+ ```tsx
198
+ // React - Form input with 4px radius
199
+ <input
200
+ type="text"
201
+ className="bg-background border border-input rounded-[4px] px-3 py-2 focus:ring-ring"
202
+ placeholder="Enter text"
203
+ />
204
+
205
+ // React - Textarea with 4px radius
206
+ <textarea
207
+ className="bg-background border border-input rounded-[4px] px-3 py-2 focus:ring-ring"
208
+ rows={4}
209
+ />
210
+ ```
211
+
212
+ ---
213
+
214
+ ## Common Border Patterns
215
+
216
+ ### Card Borders
217
+
218
+ Cards use subtle borders to define boundaries when spacing alone isn't sufficient.
219
+
220
+ ```tsx
221
+ // React - Card with border
222
+ <div className="bg-card border border-border p-6">
223
+ <h3 className="text-lg font-semibold">Card Title</h3>
224
+ <p className="text-muted-foreground">Card content</p>
225
+ </div>
226
+ ```
227
+
228
+ ### Form Input Borders
229
+
230
+ Form inputs use borders to define their boundaries and indicate focus states.
231
+
232
+ ```tsx
233
+ // React - Form input with border
234
+ <input
235
+ type="text"
236
+ className="bg-background border border-input rounded-[4px] px-3 py-2 focus:ring-2 focus:ring-ring"
237
+ />
238
+ ```
239
+
240
+ ### Divider Borders
241
+
242
+ Use borders to create visual dividers between sections when spacing is insufficient.
243
+
244
+ ```tsx
245
+ // React - Horizontal divider
246
+ <div className="border-t border-border my-6"></div>
247
+
248
+ // React - Vertical divider
249
+ <div className="border-l border-border pl-6"></div>
250
+ ```
251
+
252
+ ### Focus Rings
253
+
254
+ Focus rings use borders (via Tailwind's `ring` utilities) to indicate keyboard focus.
255
+
256
+ ```tsx
257
+ // React - Focus ring
258
+ <button className="bg-primary text-primary-foreground rounded-[6px] px-4 py-2 focus:ring-2 focus:ring-ring focus:ring-offset-2">
259
+ Focusable Button
260
+ </button>
261
+ ```
262
+
263
+ ### Error States
264
+
265
+ Error states use colored borders to indicate validation issues.
266
+
267
+ ```tsx
268
+ // React - Input with error border
269
+ <input
270
+ type="text"
271
+ className="bg-background border-2 border-destructive rounded-[4px] px-3 py-2"
272
+ aria-invalid="true"
273
+ />
274
+ ```
275
+
276
+ ---
277
+
278
+ ## Usage Guidelines
279
+
280
+ ### React Components
281
+
282
+ ```tsx
283
+ // Card with border (no radius)
284
+ <div className="bg-card border border-border p-6">
285
+ <h3>Card Title</h3>
286
+ <p>Card content</p>
287
+ </div>
288
+
289
+ // Clickable card with 6px radius
290
+ <div className="bg-card border border-border rounded-[6px] p-6 cursor-pointer hover:bg-muted">
291
+ <h3>Clickable Card</h3>
292
+ <p>Click to interact</p>
293
+ </div>
294
+
295
+ // Form input with 4px radius
296
+ <input
297
+ type="text"
298
+ className="bg-background border border-input rounded-[4px] px-3 py-2 focus:ring-2 focus:ring-ring"
299
+ />
300
+
301
+ // Button with 6px radius
302
+ <button className="bg-primary text-primary-foreground rounded-[6px] px-4 py-2">
303
+ Submit
304
+ </button>
305
+ ```
306
+
307
+ ### Vue Components
308
+
309
+ ```vue
310
+ <!-- Card with border (no radius) -->
311
+ <div class="bg-card border border-border p-6">
312
+ <h3>Card Title</h3>
313
+ <p>Card content</p>
314
+ </div>
315
+
316
+ <!-- Clickable card with 6px radius -->
317
+ <div class="bg-card border border-border rounded-[6px] p-6 cursor-pointer hover:bg-muted">
318
+ <h3>Clickable Card</h3>
319
+ <p>Click to interact</p>
320
+ </div>
321
+
322
+ <!-- Form input with 4px radius -->
323
+ <input
324
+ type="text"
325
+ class="bg-background border border-input rounded-[4px] px-3 py-2 focus:ring-2 focus:ring-ring"
326
+ />
327
+
328
+ <!-- Button with 6px radius -->
329
+ <button class="bg-primary text-primary-foreground rounded-[6px] px-4 py-2">
330
+ Submit
331
+ </button>
332
+ ```
333
+
334
+ ---
335
+
336
+ ## Best Practices
337
+
338
+ ### ✅ Do's
339
+
340
+ 1. **Use borders purposefully**
341
+ - ✅ Only when spacing alone is insufficient
342
+ - ✅ To create clear separation between distinct sections
343
+ - ✅ To define interactive element boundaries
344
+
345
+ 2. **Follow border width guidelines**
346
+ - ✅ Use 1px for most borders
347
+ - ✅ Use 2px for emphasized borders
348
+ - ✅ Use 3-4px only for special cases (focus rings)
349
+
350
+ 3. **Apply border radius correctly**
351
+ - ✅ Use 0px (no radius) for static content
352
+ - ✅ Use 6px for interactive elements (buttons, clickable cards)
353
+ - ✅ Use 4px for form inputs
354
+
355
+ 4. **Ensure accessibility**
356
+ - ✅ Verify border contrast meets WCAG 2.1 Level AA (3:1 ratio)
357
+ - ✅ Test borders in both light and dark modes
358
+ - ✅ Ensure borders are visible and distinguishable
359
+
360
+ 5. **Use semantic color tokens**
361
+ - ✅ Always use `border-border` for standard borders
362
+ - ✅ Use `border-input` for form input borders
363
+ - ✅ Use `border-destructive` for error states
364
+
365
+ ### ❌ Don'ts
366
+
367
+ 1. **Don't overuse borders**
368
+ - ❌ Don't add borders when spacing creates sufficient separation
369
+ - ❌ Don't use borders for decorative purposes
370
+ - ❌ Don't create visual clutter with excessive borders
371
+
372
+ 2. **Don't use non-solid borders**
373
+ - ❌ Don't use dashed borders
374
+ - ❌ Don't use dotted borders
375
+ - ❌ Always use solid lines
376
+
377
+ 3. **Don't ignore border radius guidelines**
378
+ - ❌ Don't add radius to static content unnecessarily
379
+ - ❌ Don't use inconsistent radius values
380
+ - ❌ Don't use radius values outside the specified guidelines (0px, 4px, 6px)
381
+
382
+ 4. **Don't break accessibility**
383
+ - ❌ Don't use low-contrast borders
384
+ - ❌ Don't rely solely on borders for information (use other indicators)
385
+ - ❌ Don't ignore contrast requirements
386
+
387
+ 5. **Don't hardcode border values**
388
+ - ❌ Don't use hardcoded border colors
389
+ - ❌ Don't use arbitrary border widths
390
+ - ❌ Always use semantic tokens and Tailwind utilities
391
+
392
+ ---
393
+
394
+ ## Examples
395
+
396
+ ### ✅ Good: Purposeful Border Usage
397
+
398
+ ```tsx
399
+ // React - Card with border for clear separation
400
+ <div className="bg-card border border-border p-6 mb-6">
401
+ <h3>Section Title</h3>
402
+ <p>Content that needs clear boundaries</p>
403
+ </div>
404
+
405
+ // React - Form input with appropriate border and radius
406
+ <input
407
+ type="text"
408
+ className="bg-background border border-input rounded-[4px] px-3 py-2"
409
+ />
410
+
411
+ // React - Clickable card with border and 6px radius
412
+ <div className="bg-card border border-border rounded-[6px] p-6 cursor-pointer hover:bg-muted">
413
+ <h3>Clickable Item</h3>
414
+ </div>
415
+ ```
416
+
417
+ ### ❌ Bad: Unnecessary or Incorrect Borders
418
+
419
+ ```tsx
420
+ // Don't do this - unnecessary border when spacing is sufficient
421
+ <div className="space-y-4">
422
+ <div className="border-b border-border pb-4">
423
+ <h3>Section 1</h3>
424
+ </div>
425
+ <div className="pt-4">
426
+ <h3>Section 2</h3>
427
+ </div>
428
+ </div>
429
+
430
+ // Don't do this - wrong border radius for static content
431
+ <div className="bg-card border border-border rounded-[6px] p-6">
432
+ <h3>Static Card</h3>
433
+ <p>This should have no radius</p>
434
+ </div>
435
+
436
+ // Don't do this - wrong border radius for form input
437
+ <input
438
+ type="text"
439
+ className="bg-background border border-input rounded-[6px] px-3 py-2"
440
+ />
441
+ ```
442
+
443
+ ### ✅ Good: Using Spacing Instead of Borders
444
+
445
+ ```tsx
446
+ // React - Using spacing for separation (preferred)
447
+ <div className="space-y-8">
448
+ <section>
449
+ <h2 className="text-2xl font-bold mb-4">Section Title</h2>
450
+ <p>Content here</p>
451
+ </section>
452
+ <section>
453
+ <h2 className="text-2xl font-bold mb-4">Another Section</h2>
454
+ <p>More content</p>
455
+ </section>
456
+ </div>
457
+ ```
458
+
459
+ ---
460
+
461
+ ## Integration with Design System
462
+
463
+ ### Color Tokens
464
+
465
+ Borders use the following semantic color tokens from `@equal-experts/kuat-core/src/variables.css`:
466
+
467
+ - **`--border`:** Default border color (slate-200 in light, slate-700 in dark)
468
+ - **`--input`:** Form input border color
469
+ - **`--ring`:** Focus ring color
470
+ - **`--destructive`:** Error state border color
471
+
472
+ ### Tailwind Utilities
473
+
474
+ The design system provides the following Tailwind utilities for borders:
475
+
476
+ - **Border width:** `border`, `border-2`, `border-4`
477
+ - **Border color:** `border-border`, `border-input`, `border-destructive`
478
+ - **Border radius:** `rounded-[0px]`, `rounded-[4px]`, `rounded-[6px]`
479
+ - **Focus rings:** `focus:ring-2`, `focus:ring-ring`
480
+
481
+ ---
482
+
483
+ ## Additional Resources
484
+
485
+ - **Design System Overview:** See [design-system.md](./design-system.md) for complete design system documentation
486
+ - **Color Guide:** See [colours.md](./colours.md) for border color tokens and usage
487
+ - **Component Guidelines:** See [../technical/component-guidelines.md](../technical/component-guidelines.md) for component border patterns
488
+ - **shadcn/ui Borders:** [shadcn/ui Component Documentation](https://ui.shadcn.com/docs/components)
489
+ - **Tailwind Borders:** [Tailwind CSS Border Documentation](https://tailwindcss.com/docs/border-width)
490
+
491
+ ---
492
+
493
+ ## Notes
494
+
495
+ - **Minimal Philosophy:** Borders should be used sparingly—prefer spacing and visual hierarchy
496
+ - **Consistent Radius:** Use 0px, 4px, or 6px only—no arbitrary values
497
+ - **Accessibility First:** Always verify border contrast meets WCAG 2.1 Level AA standards
498
+ - **Semantic Tokens:** Always use design system color tokens for borders
499
+ - **Purpose-Driven:** Every border should have a clear purpose for separation or definition
500
+