Patterns from production · Layout that holds
Drag or tap, never both
Small moves are taps; real moves are drags.
Drag or tap, never both
Try the controls to see the rule.
The rule
A press becomes a drag only after the pointer moves 6 px. Listen to the moves on the window, because a quick drag leaves the handle before then. Swallow the click that ends a drag, so a drag that began on a tab does not select it.
Tokens used
size.tap44pxmotion.duration.fast180msspace.md12pxmotion.duration.base260ms
Native spec · generated from this pattern and the shared token registry
struct OvDragOrTap: View {
let status: String
@Environment(\.accessibilityReduceMotion) private var reduceMotion
var body: some View {
HStack(spacing: OvScale.spaceMd) {
Text(status).font(.body)
}
.frame(minHeight: OvScale.sizeTap)
.animation(reduceMotion ? .none : .easeOut(duration: OvScale.motionDurationBase), value: status)
}
}
// Tokens: size.tap=44px, motion.duration.fast=180ms, space.md=12px, motion.duration.base=260ms@Composable
fun OvDragOrTap(status: String, reduceMotion: Boolean) {
Row(
modifier = Modifier.defaultMinSize(minHeight = OvScale.SizeTap),
horizontalArrangement = Arrangement.spacedBy(OvScale.SpaceMd),
) {
Text(status, style = MaterialTheme.typography.bodyMedium)
}
// Apply motion only when !reduceMotion.
}
// Tokens: size.tap=44px, motion.duration.fast=180ms, space.md=12px, motion.duration.base=260ms