Radius
Overview of the border radius scale and style variants in Apsara.Border radius tokens control the roundness of corners throughout your interface. These tokens automatically adjust based on the active style variant—modern style uses sharp, minimal radii while traditional style uses softer, more rounded corners. By using radius tokens instead of fixed values, your custom components will seamlessly adapt when the style changes.
Radius Scale
The radius scale provides 7 tokens for different levels of roundness, from subtle to fully circular.
Modern Style (Default)
TokenValueDescription
--rs-radius-12pxSubtle rounding for small elements
--rs-radius-24pxBadges, chips, small buttons
--rs-radius-36pxInputs, buttons, cards
--rs-radius-48pxModals, dialogs, larger cards
--rs-radius-512pxLarge containers, panels
--rs-radius-616pxExtra large containers
--rs-radius-full800pxPills, circular elements, avatars
Traditional Style
When using data-style="traditional", the radius values increase for a softer, more rounded appearance.
TokenValueDescription
--rs-radius-18pxSubtle rounding for small elements
--rs-radius-216pxBadges, chips, small buttons
--rs-radius-320pxInputs, buttons, cards
--rs-radius-424pxModals, dialogs, larger cards
--rs-radius-532pxLarge containers, panels
--rs-radius-640pxExtra large containers
--rs-radius-full1600pxPills, circular elements, avatars
Usage
1/* Dashboard widget container */2.widget {3 border-radius: var(--rs-radius-4);4 overflow: hidden;5}67.widget-header {8 border-radius: var(--rs-radius-4) var(--rs-radius-4) 0 0;9}1011/* Filter tags with remove button */12.filter-tag {13 border-radius: var(--rs-radius-full);14 display: inline-flex;15 align-items: center;16 gap: var(--rs-space-2);17}1819/* Nested card with image */20.preview-card {21 border-radius: var(--rs-radius-4);22}2324.preview-card-image {25 border-radius: var(--rs-radius-3);26}2728/* Search results dropdown */29.search-results {30 border-radius: var(--rs-radius-3);31}3233.search-result-item:first-child {34 border-radius: var(--rs-radius-3) var(--rs-radius-3) 0 0;35}3637.search-result-item:last-child {38 border-radius: 0 0 var(--rs-radius-3) var(--rs-radius-3);39}4041/* User avatar with status indicator */42.avatar-wrapper {43 position: relative;44}4546.avatar-image {47 border-radius: var(--rs-radius-full);48}4950.avatar-status {51 border-radius: var(--rs-radius-full);52 position: absolute;53 bottom: 0;54 right: 0;55}5657/* Segmented control */58.segmented-control {59 border-radius: var(--rs-radius-3);60}6162.segmented-control-item[data-active="true"] {63 border-radius: var(--rs-radius-2);64}
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