Patterns from production · Layout that holds
One card that is also a row
One item, two layouts, one switch.
One card that is also a row
Try the controls to see the rule.
The rule
A grid of cards and a list of rows are the same markup laid out two ways, so switching view never re-renders, loses a menu, or changes what is listed. Remember the view the person chose.
Tokens used
space.md12pxmotion.duration.fast180mssize.tap44pxmotion.duration.base260ms
Native spec · generated from this pattern and the shared token registry
struct OvCardOrRow: 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: space.md=12px, motion.duration.fast=180ms, size.tap=44px, motion.duration.base=260ms@Composable
fun OvCardOrRow(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: space.md=12px, motion.duration.fast=180ms, size.tap=44px, motion.duration.base=260ms