Radius
Overview of the border radius scale and style variants in Apsara.Border radius tokens control the roundness of corners throughout your interface. Apsara provides a consistent radius scale with support for different style variants.
Radius Scale
The radius scale provides 7 tokens for different levels of roundness, from subtle to fully circular.
Modern Style (Default)
| Token | Value | Use Case |
|---|---|---|
--rs-radius-1 | 2px | Subtle rounding for small elements |
--rs-radius-2 | 4px | Badges, chips, small buttons |
--rs-radius-3 | 6px | Inputs, buttons, cards |
--rs-radius-4 | 8px | Modals, dialogs, larger cards |
--rs-radius-5 | 12px | Large containers, panels |
--rs-radius-6 | 16px | Extra large containers |
--rs-radius-full | 800px | Pills, circular elements, avatars |
Traditional Style
When using data-style="traditional", the radius values increase for a softer, more rounded appearance.
| Token | Value | Use Case |
|---|---|---|
--rs-radius-1 | 8px | Subtle rounding for small elements |
--rs-radius-2 | 16px | Badges, chips, small buttons |
--rs-radius-3 | 20px | Inputs, buttons, cards |
--rs-radius-4 | 24px | Modals, dialogs, larger cards |
--rs-radius-5 | 32px | Large containers, panels |
--rs-radius-6 | 40px | Extra large containers |
--rs-radius-full | 1600px | Pills, circular elements, avatars |
Style Comparison
| Token | Modern | Traditional |
|---|---|---|
--rs-radius-1 | 2px | 8px |
--rs-radius-2 | 4px | 16px |
--rs-radius-3 | 6px | 20px |
--rs-radius-4 | 8px | 24px |
--rs-radius-5 | 12px | 32px |
--rs-radius-6 | 16px | 40px |
--rs-radius-full | 800px | 1600px |
Usage
1/* Buttons */2.button {3 border-radius: var(--rs-radius-3);4}56/* Cards */7.card {8 border-radius: var(--rs-radius-4);9}1011/* Badges and chips */12.badge {13 border-radius: var(--rs-radius-2);14}1516/* Pills and tags */17.pill {18 border-radius: var(--rs-radius-full);19}2021/* Avatar */22.avatar {23 border-radius: var(--rs-radius-full);24}2526/* Input fields */27.input {28 border-radius: var(--rs-radius-3);29}3031/* Modal */32.modal {33 border-radius: var(--rs-radius-5);34}
Enabling Style Variants
To switch between modern and traditional styles, set the data-style attribute on your root element:
1<!-- Modern style (default) -->2<html data-style="modern">34<!-- Traditional style -->5<html data-style="traditional">
Best Practices
- Be consistent - Use the same radius token for similar elements throughout your application
- Match element size - Use smaller radius values for smaller elements, larger values for containers
- Use radius-full for circles - When you need perfectly circular elements, use
--rs-radius-full - Consider style context - Choose modern for sharp, contemporary designs; traditional for softer, friendly aesthetics