Patterns from production · Elements

Drop anywhere, watch a tray

The page is the drop target; the tray is the receipt.

Drop anywhere, watch a trayLive demo

Try the controls to see the rule.

The rule

Where people keep files, a file dropped anywhere on the page uploads into the place on screen. A tray in the corner lists each file with its progress, says what failed and why, and the list updates in place when they are in. Choosing files starts them; no second Upload button.

Tokens used

  • motion.duration.fast180ms
  • space.md12px
  • size.tap44px
  • motion.duration.base260ms

Native spec · generated from this pattern and the shared token registry

SwiftUI
struct OvDropAnywhere: 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: motion.duration.fast=180ms, space.md=12px, size.tap=44px, motion.duration.base=260ms
Compose
@Composable
fun OvDropAnywhere(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: motion.duration.fast=180ms, space.md=12px, size.tap=44px, motion.duration.base=260ms