Metrics
Touch target, press scale, screen margin and hairline.
Draft
The values shown here are conceptual and may change.
Metrics are layout constants that apply across the whole app rather than to one element.
export const metrics = {
touchTarget: 44,
pressScale: 0.97,
screenMargin: 16,
hairline: StyleSheet.hairlineWidth,
stackScale: 0.915,
} satisfies Metrics;| Key | Default | Use |
|---|---|---|
touchTarget | 44pt | Minimum touch area of anything pressable |
pressScale | 0.97 | Scale a button-like element takes while it is held |
screenMargin | 16pt | Horizontal padding between content and the screen edges |
hairline | 1 physical pixel | Separators and thin borders |
stackScale | 0.915 | How much a sheet shrinks per level in a stack |
Usage
Tappable reads touchTarget and adds hitSlop when an element is smaller, so a 24pt icon button still gets a 44pt touch area.
pressScale is the value Button, IconButton and FloatingButton hand to Tappable’s pressScale prop. Lower it for a firmer press, or set it to 1 to keep the fill change as the only feedback.
stackScale is how far a BottomSheet recedes when another one opens over it, applied once per level and capped at two levels. Set it to 1 to keep the sheet underneath at full size and leave the new overlay as the only sign that something opened on top.
<ScrollView
contentContainerStyle={{ paddingHorizontal: tokens.metrics.screenMargin }}
/>