Space & shapeMarkdown
Borders
Borders use three fixed pixel widths (1px · 2px · 4px) to separate surfaces, mark active selection, and anchor architectural rules. Widths stay in px so hairlines remain crisp at every zoom level.
Border width scale
| Token | Tailwind | Width | Use | Sample |
|---|---|---|---|---|
| --border-width-1 | border-1 | 1px | Hairlines: dividers, inputs, dark-mode card edges | |
| --border-width-2 | border-2 | 2px | Selected and active states, focus rings | |
| --border-width-4 | border-4 | 4px | Architectural accent rules (section bars, active tab markers) |
Use 1px for structural hairlines, 2px for selected states and focus rings, and 4px for architectural accent bars.
Usage
Apply border-width utilities in Tailwind CSS or custom properties in CSS:
<div className="rounded-md border-1 border-border border-t-4 border-t-primary bg-card p-4">
<button
type="button"
className="rounded-sm border-2 border-ring bg-secondary px-3 py-1 text-secondary-foreground"
>
Selected item
</button>
</div>.section-rule {
border-top: var(--border-width-4) solid var(--primary);
}
.selected-tile {
border: var(--border-width-2) solid var(--ring);
}Do and don't
Do: Assign each width a single role
Reserve 1px for dividers and inputs, 2px for selected or active states, and 4px for section accent bars.
Don't: Use arbitrary border widths
Do not write border-0, border-3, or border-8 because off-scale border widths are blocked in theme.css.
Accessibility
- Pair
2pxselected borders with a text or icon indicator so active selection never relies on border color alone (WCAG 1.4.1). - Keep border colors at neutral step 6 or higher (
--border,--input) to maintain visible edge separation.
Rationale
Restricting borders to 1px, 2px, and 4px creates a clear three-tier hierarchy between structural hairlines, interactive selection, and section markers.