Scale
Scale the whole interface from one screen modifier by changing the UI scale factor. Use it to match content density to viewing distance or user preference.
Basic Usage
Apply scale modifiers to the screen element to scale all interface elements proportionally.
The selected scale changes typography, component dimensions, gaps, and pixel-based utilities while leaving screen dimensions and relative units unchanged. Scale carries no bit-depth gate, so it works on every screen.
Available Scale Levels
The framework provides seven predefined scale levels:
| Class | Scale Factor | Use Case |
|---|---|---|
screen--scale-xxsmall
|
0.66 (66%) | Dynamic mashup content density |
screen--scale-xsmall
|
0.75 (75%) | Maximum content density |
screen--scale-small
|
0.875 (87.5%) | Increased content density |
screen--scale-regular
|
1.0 (100%) | Default scale, no scaling applied |
screen--scale-large
|
1.125 (112.5%) | Increased size for better readability |
screen--scale-xlarge
|
1.25 (125%) | Large scale for increased readability |
screen--scale-xxlarge
|
1.5 (150%) | Maximum scale for accessibility needs |
Scale names its neutral tier regular, while utility families name theirs base (gap--base, rounded--base, text--base), so there is no screen--scale-base.
Text Scale runs four tiers against Scale's seven, so read the tier list from the page you are on instead of assuming one shared ladder.
Scale Examples
The following examples demonstrate how scale levels affect the same content layout. Notice how all elements scale proportionally.
Extra Small Scale (75%)
Maximum content density: useful when viewing up close or when you need to fit more information on screen.
<div class="screen screen--scale-xsmall">
<!-- Your content here -->
</div>
Small Scale (87.5%)
Reduced scale for fitting more content while maintaining good readability.
<div class="screen screen--scale-small">
<!-- Your content here -->
</div>
Regular Scale (100%)
Default scale: the baseline that all other scale levels are relative to.
<div class="screen screen--scale-regular">
<!-- Your content here -->
</div>
Large Scale (112.5%)
Increased size for better readability
<div class="screen screen--scale-large">
<!-- Your content here -->
</div>
Extra Large Scale (125%)
Large scale for increased readability
<div class="screen screen--scale-xlarge">
<!-- Your content here -->
</div>
Extra Extra Large Scale (150%)
Maximum scale for accessibility needs
<div class="screen screen--scale-xxlarge">
<!-- Your content here -->
</div>
How It Works
Scale modifiers set --modifier-scale. The screen composes it with --device-ui-scale for component typography and geometry, while --content-scale applies the modifier to plugin content.
Use Text Scale Text Scale Scale all framework typography independently of interface geometry Text Scale adjusts every framework font size and pixel line height from one screen modifier. It composes with Scale, so you can change text readability without applying the same factor to interface geometry or text strokes. when typography needs an additional factor without applying it to the rest of the interface.
Affected Properties
When you apply a scale modifier, it scales the following properties:
- Font sizes and line heights
- Component dimensions such as title bars and progress indicators
- Framework gaps and pixel-based spacing utilities
- Pixel-based size, flex basis, grid minimum, and image presets
- Framework radii, text strokes, and image strokes
- Custom properties that reference
var(--ui-scale)orvar(--content-scale)
Note: Screen dimensions, percentages, container units, and physical one-pixel rails remain unchanged. Fixed pixel values emitted by framework utilities follow the selected content scale.
Scaling Custom Values
Use framework utilities for fixed dimensions whenever possible. For custom CSS, multiply pixel values by --content-scale; for JavaScript, resolve them with TRMNLPaint.px().
<!-- Framework utilities scale automatically. -->
<div class="h--[40px] w--[80px] rounded--[6px]"></div>
<style>
.custom-panel {
height: calc(40px * var(--content-scale));
}
</style>
<script>
var height = TRMNLPaint.px(40, { el: "my-panel" });
</script>
Inline pixel styles, HTML width and height attributes, intrinsic image dimensions, and chart-library numbers do not scale by themselves. Convert those values explicitly or replace them with scale-aware framework utilities.
Combining with Device Configurations
Scale modifiers multiply the device's native UI scale instead of replacing it. Plugin content follows the selected modifier, while framework components also retain the device density adjustment. Every modifier except Regular also resolves typography to Inter Variable on low-density displays, because pixel bundles only render correctly at their native sizes.
| Class Combination | Description |
|---|---|
screen screen--v2
|
Uses device default scale |
screen screen--v2 screen--scale-small
|
Uses 87.5% content scale and 87.5% of the device UI scale |
screen screen--amazon_kindle_2024 screen--scale-large
|
Uses 112.5% content scale and 112.5% of the device UI scale |
<!-- Use device default UI scale -->
<div class="screen screen--v2">
<!-- Content -->
</div>
<!-- Override device scale with scale modifier -->
<div class="screen screen--v2 screen--scale-small">
<!-- Content at 87.5% scale -->
</div>
<!-- Combine with any device configuration -->
<div class="screen screen--amazon_kindle_2024 screen--scale-large">
<!-- Kindle device with 112.5% scale -->
</div>
Related Tokens
These tokens are automatically mapped to this page by token prefix.
| Token | 1-bit | 2-bit | Density 2x | 4-bit and up |
|---|---|---|---|---|
--content-scale
|
1 | - | - | - |
--device-ui-scale
|
1 | - | - | - |
--gap-large
|
20px | - | - | - |
--gap-medium
|
16px | - | - | - |
--gap-scale
|
1 | - | - | - |
--gap-small
|
7px | - | - | - |
--gap-xlarge
|
30px | - | - | - |
--gap-xsmall
|
5px | - | - | - |
--gap-xxlarge
|
40px | - | - | - |
--list-gap-small
|
8px | - | - | - |
--modifier-scale
|
1 | - | - | - |
--ui-scale
|
1 | - | - | - |
Related APIs
Reading scale factors from JavaScript
The scale({ el }) and
px(value, { el, kind }) helpers read the resolved
scale factors from the live screen, so JavaScript-drawn visuals follow the factors this page documents.
px() scales by the content scale by default; pass
kind: "ui" for framework geometry.
See
Paint API
Paint API
TRMNLPaint: read the live CSS cascade from JavaScript to resolve framework colors and tile patterns
TRMNLPaint is the framework's public JavaScript paint API. It reads the live CSS cascade (bit depth, dark mode, theme, limited palette, and tiles all resolved) and hands back a canonical Fill, so token mappings are never duplicated in JavaScript. Charts are just one consumer; any plugin can resolve framework colors from JS for any purpose.
.
var inset = TRMNLPaint.px(6, { el: "my-chart", kind: "ui" });