v0.1 public beta early access on GitHub
Home / Screens / ecommerce-delivery-options
Screen template

Delivery Screen

Shipping speed picker with ETA, price, and recommended badge.

pro Expo Go ✓ iosandroid gestures: tap · scroll haptics: light · selection
$ npx lumioui add ecommerce-delivery-options
import { ShippingOptionsScreen } from "@/screens/ecommerce/delivery-options";
Registry dependencies4
Native packages installed6
@lumioui/ui@latest@lumioui/core@latestreact-native-safe-area-context@*react-native-reanimated@*react-native-svg@*nativewind@*
ecommerce/delivery-options.tsxsource · yours to edit
import * as React from "react";
import { ScrollView, View } from "react-native";
import { SafeAreaView, useSafeAreaInsets } from "react-native-safe-area-context";
import { Button, Glass, Icon, type IconName, Text } from "@lumioui/ui";
import { cn, useHaptic } from "@lumioui/core";
import { LumioMark, Mount, type IconTone, Press, RowIcon, SectionHead, StickyBottomBar } from "../shared";

export interface ShippingOption {
  id: string;
  label: string;
  /** e.g. "Arrives Thu, Sep 25" */
  eta: string;
  price: string;
  /** Mini calendar tile — weekday over day-of-month ("Thu" / "25"). */
  day?: string;
  date?: string;
  recommended?: boolean;
}

export interface ShippingOptionsScreenProps {
  options?: ShippingOption[];
  address?: string;
  onSelect?: (id: string) => void;
  onContinue?: (id: string) => void;
  onBack?: () => void;
}

const DEFAULT_OPTIONS: ShippingOption[] = [
  { id: "standard", label: "Standard", eta: "Arrives Sep 29 – Oct 1 · lowest emissions", price: "Free", day: "Mon", date: "Sep 29" },
  { id: "express", label: "Express", eta: "Arrives Thu, Sep 25", price: "$8.90", day: "Thu", date: "Sep 25", recommended: true },
  { id: "priority", label: "Priority", eta: "Arrives tomorrow, Sep 24", price: "$14.90", day: "Wed", date: "Sep 24" },
];

/** Transport glyph per speed — fallback when a ship-date isn't provided. */
const SPEED_META: Record<string, { icon: IconName; tone: IconTone }> = {
  standard: { icon: "truck", tone: "gray" },
  express: { icon: "zap", tone: "orange" },
  priority: { icon: "rocket", tone: "purple" },
};

/** Mini calendar tile — the arrival date IS the content, not a truck icon
 *  (the Amazon/Apple checkout idiom). Accents when selected. */
function DateTile({ day, date, selected }: { day: string; date: string; selected: boolean }) {
  return (
    <View
      className={cn(
        "h-12 w-12 items-center justify-center rounded-xl border",
        selected ? "border-[#BEF04C] bg-[#BEF04C]" : "border-transparent bg-[#F4F5F9] dark:bg-white/10"
      )}
      accessibilityElementsHidden
      importantForAccessibility="no"
    >
      <Text className={cn("text-[9px] font-semibold uppercase tracking-wider", selected ? "text-[#1B1B26]" : "text-muted-foreground")}>
        {day}
      </Text>
      <Text className={cn("text-sm font-bold leading-4", selected && "text-[#1B1B26]")}>{date.split(" ").pop()}</Text>
    </View>
  );
}
DateTile.displayName = "DateTile";

/** Delivery options — shipping speed picker with ETA and price per option. */
export function ShippingOptionsScreen({
  options = DEFAULT_OPTIONS,
  address = "421 Harbor Lane, Apt 5B, San Francisco",
  onSelect,
  onContinue,
  onBack,
}: ShippingOptionsScreenProps) {
  const haptics = useHaptic();
  const insets = useSafeAreaInsets();
  const [active, setActive] = React.useState(
    options.find((o) => o.recommended)?.id ?? options[0]?.id
  );
  const chosen = options.find((o) => o.id === active);

  return (
    <SafeAreaView className="flex-1 bg-[#F4F5F9] dark:bg-[#111114]" edges={["top"]}>
      {/* Floating chrome — back disc + centered brand/title pill. */}
      <View pointerEvents="box-none" className="absolute inset-x-4 z-10" style={{ top: insets.top + 8 }}>
        <View className="flex-row items-center justify-between">
          <Glass interactive effect="regular" className="h-11 w-11 items-center justify-center rounded-full">
            <Press
              haptic="light"
              onPress={() => onBack?.()}
              accessibilityRole="button"
              accessibilityLabel="Go back"
              className="h-9 w-9 items-center justify-center"
            >
              <Icon name="chevron-left" size="md" color="foreground" />
            </Press>
          </Glass>
          <View className="h-11 w-11" />
        </View>
        <View pointerEvents="none" className="absolute inset-0 items-center justify-center">
          <View className="h-11 flex-row items-center justify-center gap-2 rounded-full pl-3.5 pr-5">
            <Glass effect="regular" className="absolute inset-0 rounded-full" />
            <LumioMark size={18} />
            <Text accessibilityRole="header" className="text-sm font-bold tracking-tight">
              Delivery
            </Text>
          </View>
        </View>
      </View>

      <ScrollView
        showsVerticalScrollIndicator={false}
        contentContainerStyle={{ paddingTop: insets.top + 60, paddingBottom: insets.bottom + 120 }}
      >
        <Mount className="px-6 pb-2">
          <Text variant="muted" className="text-xs" numberOfLines={1}>
            Shipping to {address}
          </Text>
        </Mount>
        <Mount delay={60} className="gap-3 px-4 pt-1">
          <SectionHead title="Speed" />
          {options.map((opt) => {
            const selected = active === opt.id;
            const meta = SPEED_META[opt.id] ?? { icon: "package", tone: "gray" };
            return (
              <Press
                key={opt.id}
                haptic="light"
                onPress={() => {
                  haptics.selection();
                  setActive(opt.id);
                  onSelect?.(opt.id);
                }}
                accessibilityRole="radio"
                accessibilityState={{ selected }}
                accessibilityLabel={`${opt.label}, ${opt.eta}, ${opt.price}`}
                className={cn(
                  "w-full flex-row items-center gap-3 overflow-hidden rounded-2xl border p-4",
                  selected
                    ? "border-[#BEF04C] bg-[#EDF8C4] dark:bg-[#1E2410]"
                    : "border-transparent bg-white dark:bg-[#1A1A20]"
                )}
              >
                {opt.day && opt.date ? (
                  <DateTile day={opt.day} date={opt.date} selected={selected} />
                ) : (
                  <RowIcon name={meta.icon} tone={meta.tone} />
                )}
                <View className="flex-1">
                  <View className="flex-row items-center gap-2">
                    <Text className="font-medium">{opt.label}</Text>
                    {opt.recommended && (
                      <View className="rounded-full bg-[#BEF04C] px-2 py-0.5">
                        <Text className="text-xs font-semibold text-[#1B1B26]">
                          Best value
                        </Text>
                      </View>
                    )}
                  </View>
                  <Text variant="small" className="text-muted-foreground">
                    {opt.eta}
                  </Text>
                </View>
                <View className="items-end gap-1.5">
                  <Text
                    className={cn(
                      "text-sm font-semibold",
                      opt.price === "Free" && "text-[#65A30D]"
                    )}
                  >
                    {opt.price}
                  </Text>
                  <View
                    className={cn(
                      "h-5 w-5 items-center justify-center rounded-full",
                      selected ? "bg-[#BEF04C]" : "border-2 border-muted-foreground/30"
                    )}
                  >
                    {selected && (
                      <Icon name="check" size="sm" color="#1B1B26" />
                    )}
                  </View>
                </View>
              </Press>
            );
          })}
        </Mount>

        <Mount delay={120} className="mx-4 mt-2 flex-row items-center gap-2.5 rounded-2xl bg-white px-4 py-3 dark:bg-[#1A1A20]">
          <Icon name="clock" size="sm" color="#65A30D" />
          <Text variant="small" className="flex-1 text-muted-foreground">
            Order within 3h 12m for the earliest date — carrier cutoff is 4 PM.
          </Text>
        </Mount>
      </ScrollView>

      <StickyBottomBar>
        <Button
          tone="inverse" className="w-full"
          haptic="medium"
          onPress={() => {
            haptics.medium();
            onContinue?.(active ?? "standard");
          }}
          accessibilityLabel="Continue with selected delivery"
        >
          {chosen
            ? `Continue · ${chosen.label} ${chosen.price === "Free" ? "(free)" : chosen.price}`
            : "Continue"}
        </Button>
      </StickyBottomBar>
    </SafeAreaView>
  );
}
ShippingOptionsScreen.displayName = "ShippingOptionsScreen";
agent prompt — paste into Claude Code, Cursor, Devin…
Recreate the "Delivery Screen" screen in React Native using LumioUI.

Goal: Shipping speed picker with ETA, price, and recommended badge. Match the reference implementation's layout, behavior, and motion exactly — this is a production screen, not a mockup.

## Setup

Fastest path — install the screen plus its component deps:

```bash
npx lumioui add ecommerce-delivery-options
```

Or pull just the components: `npx lumioui add button icon list text`

Native packages:
- @lumioui/ui@latest
- @lumioui/core@latest
- react-native-safe-area-context@*
- react-native-reanimated@*
- react-native-svg@*
- nativewind@*

Stack assumptions: Expo SDK 54 / RN 0.81, Reanimated 4, NativeWind v4, TypeScript strict, Expo Go compatible.

## Components — how, where, when

### `button` — Tactile pill button with press spring, ink wash and async loading.
- `<Button>` ×1

### `icon` — Lucide icon set mapped to theme colors and sizes.
- `<Icon>` ×3

### `list` — Settings-style rows with separators and press feedback.
- imported but not rendered directly — likely used through a sibling or as a utility

### `text` — Themed type scale from caption to display.
- `<Text>` ×9

## Conventions (non-negotiable)

- Styling via NativeWind `className` with semantic tokens only: `bg-background`, `text-foreground`, `bg-card`, `text-card-foreground`, `bg-secondary`, `bg-muted`, `text-muted-foreground`, `bg-accent`, `bg-destructive`, `border-border`. Hard-coded colors only inside media overlays (`text-white`, `bg-black/N`).
- Motion via the token presets from `@lumioui/core` (`spring.press`, `spring.surface`, `spring.glide`, `timing.fast`, `timing.slow`, …) — no bespoke spring configs or durations.
- Gate transform motion behind `useReducedMotion()`; keep opacity/color feedback, drop travel and overshoot.
- Haptics via `useHaptic()`: `light` on press, `selection` on toggle/select, `warning` on invalid input. Never import expo-haptics directly.
- Press feedback via `usePressAnimation()` (~0.97 scale), not `activeOpacity` tricks.
- a11y: `accessibilityRole` + `accessibilityLabel` on every control, touch targets ≥44pt.
- Entrance choreography: staggered `Mount` wrappers (delay 0/60/120…) so regions land in sequence instead of popping in at once.
- Wrap the screen in `SafeAreaView`; keep dark mode working via the semantic tokens.

## Deliverable

One file: `screens/ecommerce/delivery-options.tsx` exporting ShippingOptionsScreen. Preserve the props interface — the host app wires the callbacks (navigation, submit handlers) through them.

## Reference implementation

The LumioUI source for this screen — reproduce it faithfully:

```tsx
import * as React from "react";
import { ScrollView, View } from "react-native";
import { SafeAreaView, useSafeAreaInsets } from "react-native-safe-area-context";
import { Button, Glass, Icon, type IconName, Text } from "@lumioui/ui";
import { cn, useHaptic } from "@lumioui/core";
import { LumioMark, Mount, type IconTone, Press, RowIcon, SectionHead, StickyBottomBar } from "../shared";

export interface ShippingOption {
  id: string;
  label: string;
  /** e.g. "Arrives Thu, Sep 25" */
  eta: string;
  price: string;
  /** Mini calendar tile — weekday over day-of-month ("Thu" / "25"). */
  day?: string;
  date?: string;
  recommended?: boolean;
}

export interface ShippingOptionsScreenProps {
  options?: ShippingOption[];
  address?: string;
  onSelect?: (id: string) => void;
  onContinue?: (id: string) => void;
  onBack?: () => void;
}

const DEFAULT_OPTIONS: ShippingOption[] = [
  { id: "standard", label: "Standard", eta: "Arrives Sep 29 – Oct 1 · lowest emissions", price: "Free", day: "Mon", date: "Sep 29" },
  { id: "express", label: "Express", eta: "Arrives Thu, Sep 25", price: "$8.90", day: "Thu", date: "Sep 25", recommended: true },
  { id: "priority", label: "Priority", eta: "Arrives tomorrow, Sep 24", price: "$14.90", day: "Wed", date: "Sep 24" },
];

/** Transport glyph per speed — fallback when a ship-date isn't provided. */
const SPEED_META: Record<string, { icon: IconName; tone: IconTone }> = {
  standard: { icon: "truck", tone: "gray" },
  express: { icon: "zap", tone: "orange" },
  priority: { icon: "rocket", tone: "purple" },
};

/** Mini calendar tile — the arrival date IS the content, not a truck icon
 *  (the Amazon/Apple checkout idiom). Accents when selected. */
function DateTile({ day, date, selected }: { day: string; date: string; selected: boolean }) {
  return (
    <View
      className={cn(
        "h-12 w-12 items-center justify-center rounded-xl border",
        selected ? "border-[#BEF04C] bg-[#BEF04C]" : "border-transparent bg-[#F4F5F9] dark:bg-white/10"
      )}
      accessibilityElementsHidden
      importantForAccessibility="no"
    >
      <Text className={cn("text-[9px] font-semibold uppercase tracking-wider", selected ? "text-[#1B1B26]" : "text-muted-foreground")}>
        {day}
      </Text>
      <Text className={cn("text-sm font-bold leading-4", selected && "text-[#1B1B26]")}>{date.split(" ").pop()}</Text>
    </View>
  );
}
DateTile.displayName = "DateTile";

/** Delivery options — shipping speed picker with ETA and price per option. */
export function ShippingOptionsScreen({
  options = DEFAULT_OPTIONS,
  address = "421 Harbor Lane, Apt 5B, San Francisco",
  onSelect,
  onContinue,
  onBack,
}: ShippingOptionsScreenProps) {
  const haptics = useHaptic();
  const insets = useSafeAreaInsets();
  const [active, setActive] = React.useState(
    options.find((o) => o.recommended)?.id ?? options[0]?.id
  );
  const chosen = options.find((o) => o.id === active);

  return (
    <SafeAreaView className="flex-1 bg-[#F4F5F9] dark:bg-[#111114]" edges={["top"]}>
      {/* Floating chrome — back disc + centered brand/title pill. */}
      <View pointerEvents="box-none" className="absolute inset-x-4 z-10" style={{ top: insets.top + 8 }}>
        <View className="flex-row items-center justify-between">
          <Glass interactive effect="regular" className="h-11 w-11 items-center justify-center rounded-full">
            <Press
              haptic="light"
              onPress={() => onBack?.()}
              accessibilityRole="button"
              accessibilityLabel="Go back"
              className="h-9 w-9 items-center justify-center"
            >
              <Icon name="chevron-left" size="md" color="foreground" />
            </Press>
          </Glass>
          <View className="h-11 w-11" />
        </View>
        <View pointerEvents="none" className="absolute inset-0 items-center justify-center">
          <View className="h-11 flex-row items-center justify-center gap-2 rounded-full pl-3.5 pr-5">
            <Glass effect="regular" className="absolute inset-0 rounded-full" />
            <LumioMark size={18} />
            <Text accessibilityRole="header" className="text-sm font-bold tracking-tight">
              Delivery
            </Text>
          </View>
        </View>
      </View>

      <ScrollView
        showsVerticalScrollIndicator={false}
        contentContainerStyle={{ paddingTop: insets.top + 60, paddingBottom: insets.bottom + 120 }}
      >
        <Mount className="px-6 pb-2">
          <Text variant="muted" className="text-xs" numberOfLines={1}>
            Shipping to {address}
          </Text>
        </Mount>
        <Mount delay={60} className="gap-3 px-4 pt-1">
          <SectionHead title="Speed" />
          {options.map((opt) => {
            const selected = active === opt.id;
            const meta = SPEED_META[opt.id] ?? { icon: "package", tone: "gray" };
            return (
              <Press
                key={opt.id}
                haptic="light"
                onPress={() => {
                  haptics.selection();
                  setActive(opt.id);
                  onSelect?.(opt.id);
                }}
                accessibilityRole="radio"
                accessibilityState={{ selected }}
                accessibilityLabel={`${opt.label}, ${opt.eta}, ${opt.price}`}
                className={cn(
                  "w-full flex-row items-center gap-3 overflow-hidden rounded-2xl border p-4",
                  selected
                    ? "border-[#BEF04C] bg-[#EDF8C4] dark:bg-[#1E2410]"
                    : "border-transparent bg-white dark:bg-[#1A1A20]"
                )}
              >
                {opt.day && opt.date ? (
                  <DateTile day={opt.day} date={opt.date} selected={selected} />
                ) : (
                  <RowIcon name={meta.icon} tone={meta.tone} />
                )}
                <View className="flex-1">
                  <View className="flex-row items-center gap-2">
                    <Text className="font-medium">{opt.label}</Text>
                    {opt.recommended && (
                      <View className="rounded-full bg-[#BEF04C] px-2 py-0.5">
                        <Text className="text-xs font-semibold text-[#1B1B26]">
                          Best value
                        </Text>
                      </View>
                    )}
                  </View>
                  <Text variant="small" className="text-muted-foreground">
                    {opt.eta}
                  </Text>
                </View>
                <View className="items-end gap-1.5">
                  <Text
                    className={cn(
                      "text-sm font-semibold",
                      opt.price === "Free" && "text-[#65A30D]"
                    )}
                  >
                    {opt.price}
                  </Text>
                  <View
                    className={cn(
                      "h-5 w-5 items-center justify-center rounded-full",
                      selected ? "bg-[#BEF04C]" : "border-2 border-muted-foreground/30"
                    )}
                  >
                    {selected && (
                      <Icon name="check" size="sm" color="#1B1B26" />
                    )}
                  </View>
                </View>
              </Press>
            );
          })}
        </Mount>

        <Mount delay={120} className="mx-4 mt-2 flex-row items-center gap-2.5 rounded-2xl bg-white px-4 py-3 dark:bg-[#1A1A20]">
          <Icon name="clock" size="sm" color="#65A30D" />
          <Text variant="small" className="flex-1 text-muted-foreground">
            Order within 3h 12m for the earliest date — carrier cutoff is 4 PM.
          </Text>
        </Mount>
      </ScrollView>

      <StickyBottomBar>
        <Button
          tone="inverse" className="w-full"
          haptic="medium"
          onPress={() => {
            haptics.medium();
            onContinue?.(active ?? "standard");
          }}
          accessibilityLabel="Continue with selected delivery"
        >
          {chosen
            ? `Continue · ${chosen.label} ${chosen.price === "Free" ? "(free)" : chosen.price}`
            : "Continue"}
        </Button>
      </StickyBottomBar>
    </SafeAreaView>
  );
}
ShippingOptionsScreen.displayName = "ShippingOptionsScreen";
```

Screen: https://lumioui.dev/screens/ecommerce-delivery-options
iPhone 17 · iOS
9:41
Live preview — the real screen via Expo Web · open full ↗