Sizing
Size is one axis across the system: a size prop on the component, a tier name (xs, sm, md, lg), and an is-size-* class on its root. The default tier emits no class.
The tiers that matter most are the control heights. Text inputs, selects, buttons, icon buttons and segmented controls all read the same four tokens, so any two controls of the same tier line up in a row, whatever they are, and a host retunes them all with one override.
The control ladder
| Tier | Token | Default | Field font size | Who uses it |
|---|---|---|---|---|
xs |
--tui-control-height-xs |
1.5rem (24px) |
none | Button, IconButton, SegmentedControl only: dense toolbars and table rows. There is no xs form field. |
sm |
--tui-control-height-sm |
2rem (32px) |
--tui-control-font-size-sm → typography-size-sm (14px) |
Every control. IconButton and Pager default here. |
md |
--tui-control-height-md |
2.5rem (40px) |
--tui-control-font-size-md → typography-size-md (16px) |
Every control. The default for fields, Button and SegmentedControl. |
lg |
--tui-control-height-lg |
3rem (48px) |
--tui-control-font-size-lg → typography-size-lg (20px) |
Every control, plus Chip's opt-in lg readout. |
The heights sit on an 8px ladder and are written in rem, so they grow with the reader's browser font size. Pixel values above are at the browser default of 16px.
Visual swatches: see the interactive page. Token values are in the primitive token reference.
Each row shows the measured height of every control in it. One number per row means the row lines up. Override the tokens in your own stylesheet and this page follows.
How a control gets its height
Height is a floor, not a formula. Form controls share the control-sizing mixin, which sets three independent things:
min-heightfrom--tui-control-height-{tier}font-sizefrom--tui-control-font-size-{tier}, falling back to the matching typography sizepadding-blockof--tui-spacing-xxs
Nothing is derived from the font size, so you can change text size and height separately. Button, IconButton and SegmentedControl read the same height tokens directly.
The tokens are never declared on .tui-interface; components only read them, with the ladder value as the fallback. The fallbacks are therefore the real defaults, and every one of them must match the table above. A fallback that drifts ships as a visible misalignment, so the token build reports any that disagree.
Which size type a component takes
| Type | Tiers | Components |
|---|---|---|
SizeStandard |
sm md lg |
TextInput, Textarea, Select, MultiSelect, Combobox, MultiCombobox, SearchSelect, CommandPalette, Switch |
Size |
xs sm md lg |
Button, IconButton, SegmentedControl, plus Progress, StepIndicator and ContentIndicator, which have their own scales |
| Own scale | varies | Avatar, IconTile, MoveHandle, Skeleton, Icon; Rating takes sm–lg but sizes its stars, not a box |
Only the components that read --tui-control-height-* are on the ladder. Switch takes size but scales its track in em from the font size, Checkbox and Radio size from the surrounding text, and Chip is compact by default.
Retuning heights for a context
Set the tokens on an interface root and every control inside follows, Button and IconButton included:
.my-context .tui-interface {
--tui-control-height-sm: 32px;
--tui-control-height-md: 36px;
--tui-control-height-lg: 44px;
/* Optional: keep text size steady across tiers */
--tui-control-font-size-sm: 13px;
--tui-control-font-size-md: 13px;
--tui-control-font-size-lg: 14px;
}
This is how Fields matches WordPress admin, Elementor and Beaver Builder. Override all the tiers you use, or sm and md can end up closer together than the ladder intends. The font-size tokens reach fields and SegmentedControl; Button has its own, --tui-button-font-size and --tui-button-font-size-{xs,sm,lg}.
Composing controls
- Pass the same
sizeto everything in a row. AsmButton next to amdTextInput won't line up; nothing infers the tier from neighbours. - A button inside a field's prefix or suffix goes one tier below the field. A
mdTextInput takes asmIconButton. The input group cancels the slot's padding, so the field keeps its height either way, but a button of the same tier fills the whole content box and touches the border. - Small in-control buttons keep a 24px target. Clear, remove and reveal buttons get a
1.5remminimum size for WCAG 2.5.8, plusmargin-block: calc(-1 * var(--_py)), so the field doesn't grow past its tier. - Composites pass
sizethrough. Pager hands its size to its Buttons, IconButtons and page-size Select. Select and MultiSelect hand theirs to the trigger.
Building a component on the ladder
- Read the height as
var(--tui-control-height-{tier}, <ladder value>)with exactly the fallbacks above:1.5rem,2rem,2.5rem,3rem. - Accept
size?: SizeStandard(orSizeif anxsstep makes sense). Emitis-size-smandis-size-lg, and no class for the default. - Form controls include the
control-sizingmixin on the element that owns the visible box. Don't add your own vertical padding on top. - Container-query breakpoints that guard rem-sized controls are written in
rem, so they move when a host rescales.