Density
Density sets how tall controls and rows are. Use this page to understand which density a screen gets and when to force one.
- Desktop density is for a mouse or trackpad. Controls are compact.
- Touch density is for fingers. Controls and rows are taller, and input text is 16px so phones do not zoom in when a field takes focus.
How Republic picks
Section titled “How Republic picks”By default, Republic follows the device. A coarse pointer (a touch screen) gets touch density. Everything else gets desktop density. You rarely need to set anything.
To force a density, set data-density on any element. It applies to everything inside.
<body class="rp-root" data-density="touch"> … <section data-density="desktop">A dense table on a touch device</section></body>data-density="desktop" wins over a touch screen, so you can keep a dense data table compact on a tablet when that is the better choice.
Only the density tokens change. Spacing, type and radii stay the same.
Tokens
Section titled “Tokens”| Token | Desktop | Touch |
|---|---|---|
--rp-density-control-height | 36px | 44px |
--rp-density-input-font-size | 14px | 16px |
--rp-density-list-row | 48px | 56px |
- Department of Records
- Ministry of Examples
- Department of Records
- Ministry of Examples