Radius
Radius tokens define consistent corner curvature for buttons, cards, input fields, and other components.
Overview
Pine provides 11 foundation radius tokens from none to pill. These map to semantic tokens (small, medium, large, xlarge, full) and to component tokens (button.radius, badge.radius, input.radius, card.radius). Each theme (basic, game, crayon) maps them to different foundation values, so the same component can look sharp in the game theme and rounded in the crayon theme.
full (100%) turns a square element into a circle, such as a status dot. pill (9999px) rounds the short sides of a wide element into half-circles, so use it for pill-shaped buttons and badges.
Foundation Radius Tokens
| Token | Preview | Value |
|---|---|---|
| none | 0px | |
| xxs | 2px | |
| xs | 4px | |
| sm | 6px | |
| md | 8px | |
| lg | 12px | |
| xl | 16px | |
| xxl | 24px | |
| xxxl | 32px | |
| full | 100% | |
| pill | 9999px |
Theme Adapters
Semantic tokens (small, medium, large, xlarge) map to foundation tokens per theme:
| Theme | small | medium | large | xlarge | full |
|---|---|---|---|---|---|
| basic | sm (6px) | xl (16px) | xxl (24px) | xxxl (32px) | 100% |
| game | none (0px) | none (0px) | none (0px) | none (0px) | 100% |
| crayon | lg (12px) | xxl (24px) | xxxl (32px) | xxxl (32px) | 100% |
- basic: Rounded, pill-friendly style
- game: Sharp corners (0px) for pixel-art feel
- crayon: Very rounded for a soft, hand-drawn look
Component Mapping
Components with a rounded prop (small, medium, large) read component radius tokens instead of the semantic ones. A radius at or above half an element’s height already renders as a pill, so each component gets values sized for its own height. That keeps the three steps visibly distinct at every size, and large is always a full pill.
| Token | Used by | basic | crayon |
|---|---|---|---|
button.radius | Button | sm (6px) / xl (16px) / pill | md (8px) / xl (16px) / pill |
badge.radius | Badge | xs (4px) / md (8px) / pill | xs (4px) / md (8px) / pill |
input.radius | TextField, Dropdown | xs (4px) / lg (12px) / pill | xs (4px) / lg (12px) / pill |
The game theme sets every component radius to none (0px). Its pixel frame is drawn with box-shadow, which border-radius can’t round, so rounded steps the frame’s corners instead: small is square, medium cuts a one-step notch, and large cuts a two-step corner. See Shadow for the pixelColor token behind the frame.
The ThemeProvider’s design prop selects the theme.
Guidelines
- Consistency: Use the same radius token for components at the same hierarchy level (e.g. buttons, cards).
- Theme alignment: Let the theme drive radius—avoid overriding with custom values unless necessary.
- Visual hierarchy: Use larger radius for containers (cards, modals) and smaller for controls (buttons, inputs) within the same theme.
- Accessibility: Avoid extreme radius on small touch targets; it can reduce the perceived clickable area.