Foundations · Borders
Borders
Border defines the visual boundary - width, color, opacity, style and which sides carry it. Shape belongs to Radius; this page never touches corner radius.
Border presets
Every preset stays fully editable below - picking one just seeds a starting point. Standard is the global default. The Focus preset affects focus indicators only; resting component borders stay neutral.
{}
Configure your border
Width, color, opacity, style and which sides carry it - independently controlled, composited live. Radius / shape is configured separately on the Radius page.
Sides: Start/End are logical (border-inline-start/-end) and flip automatically with this site's own RTL toggle - the right choice whenever "the side closest to where content starts" is the actual intent (a form field's leading accent, for example). Left/Right/Vertical stay physical on purpose, for the opposite case: something tied to a fixed position regardless of reading direction. Native, print and forced-colors (Windows High Contrast Mode) translation isn't implemented in this system yet - said plainly rather than left silently unaddressed: a native implementation would need its own platform-specific border APIs, print needs its own stylesheet, and forced-colors mode overrides border color/style with OS-level system colors by design, which custom opacity/color choices here can't override.
Light theme
Dark theme
Live preview
Uses Color - Light or Color - Dark automatically, matching whichever theme this site is currently in - toggle it in the top bar to check the other one.
Dividers & separators
Dividers always use just the width, color, opacity and style above - not the Sides setting, since a horizontal divider is inherently a top border and a vertical divider is inherently a left border.
Horizontal
Vertical
{}
Component guidance
Two component types this page's own live preview doesn't cover, with the real values already in use elsewhere in this system.
--border-width-1-5) used deliberately across every outlined/underlined form control's own resting border too, not unique to Card.
1.5px · Line strong
{}
Border states
State colors are editable independently in light and dark themes. The width, opacity and style displayed in each state row are fixed reference recipes. Use Configure your border to edit the base control boundary. Keyboard focus uses an outline outside the reserved boundary, so changing state does not shift the layout.
Presets seed the base control recipe. Valid saved settings apply through the shared Foundation resolver and are included in Markdown and JSON. Documentation panels and structural dividers keep neutral line tokens. State reference rows describe their fixed example geometry; they do not override the base recipe. A custom state color takes precedence over its semantic fallback. Focus remains visible over error and selected states.
When not to reach for a border: this system's own Background & surface elevation (Colors) separates Page/Panel/Raised using three different background shades, never a border between them - and Shadows gives floating elements (dropdowns, modals) real elevation instead. Reach for a border when two adjacent surfaces are the same color and something still needs to visually separate them (a divider, a card on a matching-color page); reach for a background shade or a shadow first when the surfaces can simply differ instead.
AI Rule
Generated interfaces must express state changes (error, focus, disabled) through more than border color alone - pair a border-state change with a second signal (icon, text, background tint) so the state doesn't depend on color perception alone.
{}
For developers and AI agents: Markdown export and implementation contract
Border tokens - Markdown export
A Markdown snapshot of Border presets, Configure your border and Border states above - regenerates live as you edit, so it's always in sync. Copy it straight into your design system docs or hand it to an AI/agent workflow.
Implementation contract
Saved validated choices override project recommendations, which override system defaults. This implementation contract governs static specimens. Resolved tokens in the current export are authoritative values. Component exceptions must name the affected role and reason.
Editable versus fixed
Base width, color, opacity, style and sides are editable. State colors are editable; per-state width/opacity/style rows are fixed reference geometry. Presets seed the base recipe and diverged edits become Custom. Default reference opacity and Standard preset opacity are different recipes, not competing applied defaults.
Geometry and precedence
Use border-box sizing and reserve base border width. Focus uses an external outline, never thicker layout geometry. Disabled/read-only prevents activation; error/warning communicates validation; selected communicates selection; hover/pressed may change tone; keyboard focus remains visible on top of all. Required adds a marker and validation rather than an unexplained border state.
Semantic defaults
Resting controls use --control-border; structural lines remain --line/--line-strong. Error, Warning, Success and Info resolve to semantic colors unless a state override is explicitly saved. Brand is for active/selected/focus. Include text or an icon for validation; do not make color the only indicator.
Combined-state examples
Focused error: error boundary and associated message plus an independent brand focus outline. Selected hover: preserve selection marker while adjusting its tone. Loading disabled: aria-busy plus blocked activation and a readable loading label; do not announce each frame. Success focus: success message/indicator plus visible focus. Read-only is focusable and copyable where appropriate, rather than disabled. Show required status in the label and validate on the documented form trigger.
Widths and exceptions
Approved visual widths are 0,1,1.5,2,3,4px. Custom base widths up to 8px are allowed only as explicit configured exceptions. CSS triangles are geometry and not control boundaries. Native hairlines require the platform adapter and physical-density acceptance; 1 CSS px is not universally one device pixel.
Accessible and directional behavior
Calculate alpha-composited boundary versus its adjacent surface for 3:1 when essential to identify a control. Focus must remain visible in forced colors. Logical start/end track RTL; physical sides are only for physical geometry. Print uses explicit solid boundaries if shadow/tint disappears.
Flow and export
Try partial hex and invalid opacity without replacing applied values. Zero width/opacity survives reload. Export effective base recipe, fixed state recipes, color overrides, exceptions, precedence, focus and directional behavior.
Save and edit
Selections preview immediately. Save foundation commits valid settings in this browser and locks the editor. Select Edit foundation to revise saved settings; Cancel retains the saved settings. Storage failure keeps the draft editable.
Machine contract: section rules, storage, units and acceptance
{
"schemaVersion": 1,
"authority": "Saved validated choices override project recommendations, which override system defaults. This implementation contract governs static specimens. Resolved tokens in the current export are authoritative values. Component exceptions must name the affected role and reason.",
"governance": {
"owners": "Design System Lead owns token and compatibility policy. Designers own specimens and interaction contracts. Developers own resolver/export/import parity. QA and Accessibility own release evidence. Product teams own domain-specific confidence, privacy and retention policies.",
"changes": "Change the JSON contract first, regenerate documentation/defaults/catalog/tokens, then run model, DOM and recipient checks. Link the changed finding IDs and evidence in the release review.",
"compatibility": "Keep hue-named CSS tokens as compatibility aliases while semantic consumers migrate. Additive tokens retain schemaVersion 1. A removed/renamed key or changed stored meaning requires a schema migration, a version bump and a documented replacement before release. Keep the prior reader fixture until the migration is verified.",
"deprecation": "Record old key, replacement, reason, introduced version, planned removal version and affected consumers. Do not remove a token while an active consumer still uses it. Future records are preserved rather than coerced.",
"scope": "This is a web design system with one shared workspace profile. Native dp/sp adaptation and real agent execution require separate adapters and acceptance. User-defined colors and responsive exceptions require product-specific rendered verification."
},
"storage": {
"version": 1,
"legacy": "Unversioned valid records migrate in memory. Typography headingScaleVersion 2 applies the smaller six-heading scale once to older records, retaining other roles and existing font/color/style metrics. Later custom size edits are retained. Unsupported future records are preserved. The next successful write stamps the migrated version.",
"future": "Reject unsupported future versions. Preserve raw data. Offer backup and explicit reset.",
"invalid": "Foundation selections preview locally until Save foundation succeeds. Saved Foundation editors require Edit foundation before changes. Cancel discards the preview. Invalid drafts never replace saved records; storage failures retain the editable preview and the last durable record.",
"concurrency": "A storage event refreshes applied tokens and disables stale editor controls until reload. Never merge simultaneous edits silently."
},
"units": {
"base": "1rem = 16px at default browser settings. Do not fix the root font size.",
"use": "Prefer rem for typography, spacing and control dimensions. Hairline borders and viewport thresholds may use px. Both equivalents appear in Markdown. SVG strokes use viewBox units. Ratios, percentages, columns, timing and weights are unitless or retain their own units.",
"native": "Web CSS px/rem are not native dp/sp. A native adapter must map semantic roles, support text scaling and test device density. Native rendering is not shipped by this web library."
},
"acceptance": [
"Compare page, applied tokens, durable record, Machine View and exported instructions.",
"Test valid, unfinished, invalid, missing, malformed, legacy and future records. Exercise storage failure, reset, reload and another tab.",
"Test 320, 375, 768, 1024 and 1440px widths, 200% zoom, text-spacing overrides, RTL and long/localized labels.",
"Use keyboard and screen reader. Confirm focus return, names, values, error associations and status announcements.",
"Verify actual rendered text/surface pairs, forced colors, reduced motion, print and exported recipes in a recipient fixture. Source or DOM checks alone are not rendered acceptance."
],
"layers": {
"content": 0,
"sticky": 20,
"popover": 40,
"scrim": 60,
"dialog": 70,
"toast": 80,
"tooltip": 90,
"rules": "Each overlay gets an explicit owner and close/focus-return path. Portal menus out of clipped scroll containers. Nested dialogs stack one scrim per modal owner. Escape closes the top dismissible layer. Tooltips never block actions. Test collision and zoom; do not infer stacking order from shadow size."
},
"section": {
"title": "Borders",
"rules": {
"Editable versus fixed": "Base width, color, opacity, style and sides are editable. State colors are editable; per-state width/opacity/style rows are fixed reference geometry. Presets seed the base recipe and diverged edits become Custom. Default reference opacity and Standard preset opacity are different recipes, not competing applied defaults.",
"Geometry and precedence": "Use border-box sizing and reserve base border width. Focus uses an external outline, never thicker layout geometry. Disabled/read-only prevents activation; error/warning communicates validation; selected communicates selection; hover/pressed may change tone; keyboard focus remains visible on top of all. Required adds a marker and validation rather than an unexplained border state.",
"Semantic defaults": "Resting controls use --control-border; structural lines remain --line/--line-strong. Error, Warning, Success and Info resolve to semantic colors unless a state override is explicitly saved. Brand is for active/selected/focus. Include text or an icon for validation; do not make color the only indicator.",
"Combined-state examples": "Focused error: error boundary and associated message plus an independent brand focus outline. Selected hover: preserve selection marker while adjusting its tone. Loading disabled: aria-busy plus blocked activation and a readable loading label; do not announce each frame. Success focus: success message/indicator plus visible focus. Read-only is focusable and copyable where appropriate, rather than disabled. Show required status in the label and validate on the documented form trigger.",
"Widths and exceptions": "Approved visual widths are 0,1,1.5,2,3,4px. Custom base widths up to 8px are allowed only as explicit configured exceptions. CSS triangles are geometry and not control boundaries. Native hairlines require the platform adapter and physical-density acceptance; 1 CSS px is not universally one device pixel.",
"Accessible and directional behavior": "Calculate alpha-composited boundary versus its adjacent surface for 3:1 when essential to identify a control. Focus must remain visible in forced colors. Logical start/end track RTL; physical sides are only for physical geometry. Print uses explicit solid boundaries if shadow/tint disappears.",
"Flow and export": "Try partial hex and invalid opacity without replacing applied values. Zero width/opacity survives reload. Export effective base recipe, fixed state recipes, color overrides, exceptions, precedence, focus and directional behavior.",
"Save and edit": "Selections preview immediately. Save foundation commits valid settings in this browser and locks the editor. Select Edit foundation to revise saved settings; Cancel retains the saved settings. Storage failure keeps the draft editable."
}
}
}