Size Tokens
Size tokens hold the widths and heights of components, icons, and layout parts, from the base scale to the sizes of each component.
This page is a work in progress. Parts of it may be incomplete or differ from the current version of Chassis Tokens.
Introduction
Size tokens hold the dimensions of an element: the height of a button, the size of an icon, the width of a modal window. The whitespace inside and between elements belongs to the space tokens, whose page has the same sections as this one.
A size is a number of design pixels, and the build converts it to the unit of each platform, as Platform output shows. In the committed token sets, no brand, theme, or app overrides a size token. The tokens of size.website.* differ per screen, the optional fourth group.
Token levels
Each level references the level below it, so a size is written once, in dimension.base.*. The chain of one step shows the three levels:
dimension.base.16 holds the size
└── size.unit.16 {dimension.base.16}
├── size.context.2xsmall {size.unit.16}
├── size.icon.glyph.xsmall {size.unit.16}
└── size.button.small-caret {size.unit.16}Context and component tokens both reference size.unit.*. No component token references size.context.*, so a change to size.context.medium leaves size.button.medium-main as it is. The token sets of each level are files of packages/tokens/source/:
| Level | Tokens | References | Token set |
|---|---|---|---|
| Base | dimension.base.* | None | base/metric-source.json |
| Base | size.unit.* | dimension.base.* | base/metric-base.json |
| Context | size.context.*, size.icon.glyph.*, size.asset.* | size.unit.* | base/app-base.json |
| Component | size.<component>.* | size.unit.* | base/app-base.json |
| Component | size.website.* | size.unit.* | screen-website/screen-<screen>.json |
Base tokens
The base level holds the scale. dimension.base.* holds the sizes, and size.unit.* references them one to one under the name of the category.
Dimension scale
dimension.base.* holds a size in design pixels, and the name of a step states that size: dimension.base.16 is sixteen design pixels. The steps are close together at the start of the scale and further apart toward its end. The size, space, border radius, and shadow tokens reference this scale.
A step that is not a positive whole number has a prefix:
dmarks a fraction:d15is one and a half, andd25is two and a half.05andd05are both a half.nmarks a negative size:n4is minus four, andnd15is minus one and a half.
Size units
size.unit.* has a token for every step of the dimension scale, under the name of the step: size.unit.16 references {dimension.base.16}, and size.unit.n4 references {dimension.base.n4}. The context and component tokens of this page reference these tokens.
Context tokens
size.context.* names evenly spaced steps of the scale by role, from 2xsmall to 2xlarge. Reach for them to size an element that has no component token.
| Token | Reference |
|---|---|
size.context.2xlarge | {size.unit.64} |
size.context.xlarge | {size.unit.56} |
size.context.large | {size.unit.48} |
size.context.medium | {size.unit.40} |
size.context.small | {size.unit.32} |
size.context.xsmall | {size.unit.24} |
size.context.2xsmall | {size.unit.16} |
Icon sizes
size.icon.glyph.* names the sizes of an icon, from 3xsmall to 6xlarge. Most component tokens for an icon reference size.unit.* directly; size.dropdown.icon references size.icon.glyph.small.
| Token | Reference |
|---|---|
size.icon.glyph.6xlarge | {size.unit.64} |
size.icon.glyph.5xlarge | {size.unit.56} |
size.icon.glyph.4xlarge | {size.unit.48} |
size.icon.glyph.3xlarge | {size.unit.40} |
size.icon.glyph.2xlarge | {size.unit.36} |
size.icon.glyph.xlarge | {size.unit.32} |
size.icon.glyph.large | {size.unit.28} |
size.icon.glyph.medium | {size.unit.24} |
size.icon.glyph.small | {size.unit.20} |
size.icon.glyph.xsmall | {size.unit.16} |
size.icon.glyph.2xsmall | {size.unit.12} |
size.icon.glyph.3xsmall | {size.unit.8} |
Asset sizes
size.asset.* holds the size of an indicator and of a separator. The border width tokens borderWidth.asset.indicator and borderWidth.asset.separator reference them.
| Token | Reference |
|---|---|
size.asset.indicator | {size.unit.4} |
size.asset.separator | {size.unit.1} |
Component tokens
Component tokens hold the sizes of the parts of one component. A component with sizes has a token per size and part, size.<component>.<size>-<part>, in the source order medium, large, small. The part main is the component itself; parts like icon, caret, and avatar are elements inside it.
Accordion
Accordion sizes hold the indicator of each accordion size.
| Token | Reference |
|---|---|
size.accordion.medium-indicator | {size.unit.24} |
size.accordion.large-indicator | {size.unit.28} |
size.accordion.small-indicator | {size.unit.20} |
Alert
Alert sizes hold the icon of the large and the small alert.
| Token | Reference |
|---|---|
size.alert.large-icon | {size.unit.40} |
size.alert.small-icon | {size.unit.40} |
Badge
Badge sizes hold the badge and its icon for each badge size.
| Token | Reference |
|---|---|
size.badge.medium-main | {size.unit.24} |
size.badge.medium-icon | {size.unit.16} |
size.badge.large-main | {size.unit.28} |
size.badge.large-icon | {size.unit.20} |
size.badge.small-main | {size.unit.20} |
size.badge.small-icon | {size.unit.12} |
Button
Button sizes hold the button, its icon, and its caret for each button size.
| Token | Reference |
|---|---|
size.button.medium-main | {size.unit.40} |
size.button.medium-icon | {size.unit.24} |
size.button.medium-caret | {size.unit.20} |
size.button.large-main | {size.unit.48} |
size.button.large-icon | {size.unit.28} |
size.button.large-caret | {size.unit.24} |
size.button.small-main | {size.unit.32} |
size.button.small-icon | {size.unit.20} |
size.button.small-caret | {size.unit.16} |
Chip
Chip sizes hold the chip, its icon, and its avatar for each chip size.
| Token | Reference |
|---|---|
size.chip.medium-main | {size.unit.32} |
size.chip.medium-icon | {size.unit.20} |
size.chip.medium-avatar | {size.unit.24} |
size.chip.large-main | {size.unit.40} |
size.chip.large-icon | {size.unit.24} |
size.chip.large-avatar | {size.unit.32} |
size.chip.small-main | {size.unit.24} |
size.chip.small-icon | {size.unit.16} |
size.chip.small-avatar | {size.unit.20} |
List
List sizes hold the icon, the image, and the disclosure of a list item.
| Token | Reference |
|---|---|
size.list.icon | {size.unit.24} |
size.list.image | {size.unit.40} |
size.list.disclosure | {size.unit.8} |
Date picker
Date picker sizes hold the width and the height of a day, and the widths of a week and of a preset. The source computes the width of a week from the width of a day.
| Token | Reference |
|---|---|
size.datepicker.day-width | {size.unit.32} |
size.datepicker.day-height | {size.unit.32} |
size.datepicker.week-width | {size.datepicker.day-width}*7 |
size.datepicker.preset-width | {size.unit.120} |
Dropdown
Dropdown sizes hold the icon and the disclosure of a dropdown. The icon follows the icon sizes of the context level.
| Token | Reference |
|---|---|
size.dropdown.icon | {size.icon.glyph.small} |
size.dropdown.disclosure | {size.unit.16} |
Form input
Form input sizes hold the icon and the caret of each input size. The group has no main token.
| Token | Reference |
|---|---|
size.form-input.medium-icon | {size.unit.20} |
size.form-input.medium-caret | {size.unit.20} |
size.form-input.large-icon | {size.unit.24} |
size.form-input.large-caret | {size.unit.24} |
size.form-input.small-icon | {size.unit.16} |
size.form-input.small-caret | {size.unit.16} |
Modal
Modal sizes hold the width and the height of the modal window: size.modal.window-<size>-w and size.modal.window-<size>-h, for the sizes small, medium, large, and xlarge. These tokens hold a size of their own and reference no step of the scale.
Notification
Notification sizes hold the icon of a notification.
| Token | Reference |
|---|---|
size.notification.icon | {size.unit.28} |
Navigation
Navigation sizes hold the widths of the left navigation and the height of the top navigation. size.nav-left.width references the expanded width.
| Token | Reference |
|---|---|
size.nav-left.width | {size.nav-left.width-expanded} |
size.nav-left.width-expanded | {size.unit.256} |
size.nav-left.width-collapsed | {size.unit.72} |
size.nav-top.height | {size.unit.64} |
Pagination
Pagination sizes hold the width (-w) and the height (-h) of a dot in its idle and its active state.
| Token | Reference |
|---|---|
size.pagination.dot-idle-h | {size.unit.8} |
size.pagination.dot-idle-w | {size.unit.8} |
size.pagination.dot-active-h | {size.unit.8} |
size.pagination.dot-active-w | {size.unit.16} |
Segment
Segment sizes hold the segment and its icon for each segment size.
| Token | Reference |
|---|---|
size.segment.medium-main | {size.unit.32} |
size.segment.medium-icon | {size.unit.20} |
size.segment.large-main | {size.unit.40} |
size.segment.large-icon | {size.unit.24} |
size.segment.small-main | {size.unit.24} |
size.segment.small-icon | {size.unit.16} |
Website
Website sizes hold the thumb and the icon of a section, a feature, and a module of a website. They differ per screen: each option of the screen group has its own token set, screen-website/screen-<screen>.json, with the same names. The columns are the screens of the committed configuration.
| Token | large | medium | small |
|---|---|---|---|
size.website.section-thumb | {size.unit.96} | {size.unit.80} | {size.unit.64} |
size.website.section-icon | {size.unit.80} | {size.unit.64} | {size.unit.48} |
size.website.feature-thumb | {size.unit.56} | {size.unit.48} | {size.unit.40} |
size.website.feature-icon | {size.unit.48} | {size.unit.40} | {size.unit.32} |
size.website.module-thumb | {size.unit.56} | {size.unit.48} | {size.unit.40} |
size.website.module-icon | {size.unit.48} | {size.unit.40} | {size.unit.32} |
Grid tokens
grid.* is a group of its own, next to size.*, in base/app-base.json. It holds the widths of the layout grid, named grid.<part>.<step> with the steps xsmall, small, medium, large, xlarge, and 2xlarge. The tokens hold a size of their own, reference no step of the scale, and are the same on every screen.
grid.breakpoint.* holds the breakpoints, grid.container.* the width of the container at each breakpoint, and grid.gutter.* the gutters. The container of a step is narrower than the breakpoint of that step. The page gaps space.page.large-gap, space.page.medium-gap, and space.page.small-gap of the space tokens reference grid.gutter.medium.
Usage
Size tokens apply to the width and the height of an element. The level to use depends on how specific the element is.
Choosing a level
Use the most specific token that names the element, and go down a level only when none does:
- Use a component token for the part that it names:
size.button.medium-iconfor the icon of a medium button. - Use
size.icon.glyph.*for an icon andsize.context.*for another element that has no component token. - Use
size.unit.*when no context token holds the size. The unit scale has steps between and beyond those of the context scale. - Leave
dimension.base.*to the token sets. It is in the output because the unit tokens reference it.
Size and space
A size token sets a width or a height; a space token sets a padding or a gap. size.unit.16 and space.unit.16 hold the same size, because both reference dimension.base.16. The context tokens of both categories reference size.unit.*, so a change to size.unit.16 changes size.context.2xsmall and space.context.medium.
Platform output
Size tokens print in rem on the web, as CGFloat points on iOS, and as dp dimension resources on Android.
| Platform | Name | Format |
|---|---|---|
| Web | $cx-size-context-medium | A size in rem |
| iOS | SizeContextMedium | A CGFloat in points |
| Android | @dimen/size_context_medium | A <dimen> in dp |
The web platform converts design pixels to rem at sixteen pixels per rem. iOS and Android keep the number of design pixels, as points and as dp.
The build writes every level with its resolved size, dimension.base.* included. The values in the examples are those of the chassis brand in the current version and differ in other brands. In main.scss:
$cx-dimension-base-16: 1rem !default;
$cx-size-unit-16: 1rem !default;
$cx-size-context-2xsmall: 1rem !default;With the outputReferences option, a token names the token that it references, which is why dimension.base.* is in the output. The Style Dictionary guide describes the option. With it, the build writes in ChassisTokens.swift:
public static let DimensionBase16 = CGFloat(16)
public static let SizeUnit16 = DimensionBase16
public static let SizeContext2xsmall = SizeUnit16The main file of each platform holds size.website.* of the first configured screen. The number file of a screen, such as number-small.scss, holds them for that screen.
See the web, iOS, and Android docs for the files that hold these names.