Primitives
Animated Number Avatar Badge Button Button Group Toggle Toggle Group Checkbox Chip Countdown Divider Fab Grid Icon Image Input Search Input Textarea Label Loader Marquee Masked Input Message Bubble Notification Banner Offline Banner Progress Progress Ring Radio Group Range Slider Rating Separator Skeleton Slider Stack Stepper Switch Text Theme Toggle Ticker Typing IndicatorComposed
Accordion Achievement Badge Action Bar Action Sheet Action Swap Activity Rings Add to Cart Button Address Card Agenda List Alert Amount Keypad Animated Icons App Bar Audio Message Audio Recorder Autocomplete Avatar Group Balance Display Bar List Barcode Before After Biometric Gate Bloom Menu Bottom Sheet Paywall Sheet Side Sheet Breadcrumb Calendar Calendar Strip Card Carousel Cart Item Character Charts Chat Composer Chat List Item Choice Card Circle Reveal Coach Marks Collapsible Collapsible Header Color Picker Combobox Command Palette Comment Thread Confetti Consent Sheet Context Menu Copy Field Country Picker Coupon Input Currency Input Data Table Date Range Picker Day Schedule Dialog Dock Donut Chart Drawer Driver Card Dropdown Menu Drum Picker Emoji Picker Empty State Error State Event Card Expandable Control Fader Feature Gate File Picker Filter Bar Follow Button Form Gauge Glass Glass Cluster Glass Dock Morph Glass Fab Morph Glass Lab Glass Orb Glass Search Morph Glass Sheet Edge Gradient Button Headline New Heatmap Image Cropper Image Viewer Kanban Card Keyboard Avoiding Keyboard Toolbar Leaderboard Level Progress Lightbox Like Button Line Chart List Reorderable List Swipeable Row Location Card Location Search Map Sheet Map View Markdown View Media Controls Media Picker Media Tile Mention Input Meter Bar Mini Player Mood Slider Morphing Modal Multi Select Navigation Rail Notification Item Number Input Onboarding Pager Order Card Order Summary OTP Input Pagination Paper Clip New Parallax Header Pass Card Password Strength Payment Button Payment Card Payment Method Permission Primer Phone Input PIN Pad Polaroid New Poll Popover Post Card Postage Stamp New Price Tag Pricing Table Product Card Product Gallery Profile Header Promo Banner Prompt Input Property Card Pull To Refresh QR Code Quick Actions Quick Replies Rating Summary Reaction Picker Resend Timer Review Card Review Prompt Ride Option Save Button Scan Frame Scroll Spy Tabs Seat Map Section Header Section Index Segmented Control Select Share Button Share Sheet Shutter Button Signature Pad Slide to Confirm Slot Picker Smart Banner Social Login Button Sparkline Splash Screen Split Button Stat Card Stateful Button Status Dot Step Flow Steps Sticker New Stopwatch Stories Progress Stories Viewer Story Ring Streak Counter Streaming Text Success Seal Swipe Deck Tabs Tag Input Tape New Text Reveal Thinking Indicator Time Picker Timeline Timer Ring Tip Selector Toast Toolbar Tooltip Track Row Transaction Row Trip Progress Variant Picker Video Controls Waveform Weather Card Weekday Picker Zoom TransitionScreens
Account Switcher Biometric Setup Delete Account Forgot Password Grow Auth Login Login — Dark Stage Login — Dense Work Login — Editorial Login — Illustrated Login — Minimal Ink Login — Social Login — Video Loop Food Onboarding Onboarding Onboarding Dark Objects Onboarding Editorial Onboarding Illustrated Onboarding Personalize Onboarding Photo Carousel OTP Verification Passkey — Create Password Reset Permission — Notifications Phone Verification Onboarding Quiz Session Devices Signup Sign-up Chat Sign-up Photo Sheet Social Auth Split Auth Verify Identity Welcome AI Chat AI Assistant Channels List Chat Info Chat List Chat Media Chat Thread Create Group Group Info Message Requests New Message Kept Messages Accessibility Activity Log Appearance Authenticator Blocked Accounts Export Your Data Downloads Edit Profile Edit Profile — Rows Emergency Call Empty States Set Error State Send Feedback Device Locator Help Center Home — Bento Home — Dark Home — Editorial Home Feed Invite Friends Language & Region Linked Accounts Not Found (404) Notification Settings Notifications Password Vault Paywall Paywall — Comparison Paywall — Dark Stage Paywall — Editorial Paywall — Photo Paywall — Trial Timeline Privacy Profile Profile — Gamified Profile — Minimal Profile — Photo Hero QR Scanner Report Issue Saved Items Phone Time Search Search — Command Palette Search — Visual Account Health Settings Settings — Dark Device Settings — Search Storage & Data Terms & Privacy Dating Chat Dating Filters Profile Discover Its A Match Into You Matches Profile Detail Profile Editor Courier Matching Delivery History Delivery Support Package Schedule Parcel Tracking Proof Of Delivery Quick Aisle Quick Home Send Package Substitutions Add Payment Address Book Cart Categories Checkout Checkout — Steps Checkout Success Delivery Filters & Sort Flash Sale Gift Cards Loyalty Points Order Cancel Order Detail Orders Pay Later Checkout Payment Methods Product Detail Product Detail — Hero Product Grid Product Reviews Promo Codes Recently Viewed Return Items Search Results Shop Assistant Store Home Tip & Rate Courier Order Tracking Wishlist Write a Review Event Checkin Event Hero Events Discover My Tickets Seat Selection Ticket Checkout Add Card Bank Accounts Dashboard — Bento Bill Pay Budgets Card Details Crypto Portfolio Finance Dashboard Dashboard — Dark Exchange Currency Expense List Invoice Detail Manage Cards Plan Management Savings Goals Send Money Spending Analytics Split Bill Subscriptions Token Detail Token Swap Transactions Wallet Home Wallet Movers Courier Tracking Food Cart Food Home Food Orders Grocery List Recipe Detail Restaurant — Dark Restaurant Detail Activity Rings Fitness Home Habit Quest Habit Tracker Meal Planner Med Store Meditation Player Mood Check-in Nutrition Home Period Tracker Prior Auth Prior Auth Cases Quest Complete Run Tracking Rx Scan Sleep Tracker Telehealth Booking Walk Map Water Tracker Workout Complete Workout Detail Workout Session Applications Apply Company Interview Schedule Job Detail Job Feed Resume Saved Jobs Create Listing Item Chat Listing Detail Make Offer Market Checkout Market Home Market Search My Listings Offers Inbox Seller Profile Audiobook Player Camera Gallery Albums Game Store Mini Player Music Player Photo Editor Photo Gallery Playlist Detail Podcast Player Clips Feed Serene Home Sound Mixer Stories Video Call Video Player Article Reader Course Detail Event Detail Memory Onboarding Icon Lab Leaderboard Lesson Player Match Detail News Editorial News Home Plant Care Prediction Live Prediction Welcome Smart Home Standings Ticket Wallet Topics Follow Weather Detail Add Task Sheet Alarm Clock Calendar Day Calendar Month Doc Scanner File Manager Focus Timer Journal Kanban Board Mail Inbox Mail Thread Note Editor Notes List Reminders Task List Time Blocks Agent Profile Compare Homes Mortgage Calculator Property Detail Rental Application Saved Homes Schedule Tour Search List Search Map Complete Destination Driver Arriving Ev Charging History Home In Trip Matching Options Parking Receipt Safety Schedule Scooter Unlock Booking Confirmed Booking Review Booking Slots My Bookings Pro On The Way Provider Detail Provider List Rate Service Services Home Arc Create Arc Detail Arc Onboarding Avatar Creator Comments Sheet Create Post Explore Grid Followers List Hashtag Feed Mentions Post Detail Post Hero Social Profile Boarding Pass Booking Confirm Car Rental Trip Discover Flight Live Flight Preferences Flight Results Flight Search Hotel Detail Live Transit Trip — Map Day Trip — Rideshare Request Seat Select Travel Home Trip Itinerary Trip OnboardingNothing matches — try another word.
Dialog
Centred modal for confirmations and short decisions. The backdrop darkens first, the panel rises with its title, message and actions, and on close it fades out in place.
Preview
import * as React from "react";
import { createContext, forwardRef, useContext } from "react";
import { Modal, Pressable, View, Text, type ViewProps, type TextProps } from "react-native";
import Animated, { Easing, useSharedValue, useAnimatedStyle, withDelay, withSpring, withTiming } from "react-native-reanimated";
import { BAND_STAGGER, cn, ease, spring, timing, useHaptic, useReducedMotion, SwitchOn } from "@lumioui/core";
import { Glass } from "../glass";
import { useSafeAreaInsets } from "react-native-safe-area-context";
/**
* Lumio dialog — light before motion. The backdrop dims first; 80ms later
* the panel rises 12px into place while scaling 0.96→1 on spring.panel and
* igniting over timing.fast, arriving as a surface. Its content switches on
* 120ms behind it, one band at a time (title → description → actions, 120ms
* apart). Leaving, the panel dims in place (to 0.97, no retreat) on
* timing.recede and the backdrop clears 60ms after it — the light restores
* last. Reduced motion keeps only the opacity.
*/
const RISE = 12;
const FROM_SCALE = 0.96;
const EXIT_SCALE = 0.97;
/** Surface corner radius — the large end of Lumio's radius scale. */
const PANEL_RADIUS = 28;
const IGNITE = { duration: timing.fast.duration, easing: Easing.bezier(...ease.out) } as const;
const DIM = { duration: timing.recede.duration, easing: Easing.bezier(...ease.in) } as const;
const SCRIM_IN = { duration: timing.normal.duration, easing: Easing.bezier(...ease.out) } as const;
/** The backdrop dims this long before the panel moves (light before motion). */
const SCRIM_LEAD = timing.instant.duration;
/** The scrim clears this long after the panel starts dimming (light restores last). */
const SCRIM_TRAIL = timing.recede.duration / 2;
/** Content switches on one band behind the arriving surface (container, then content). */
const CONTENT_LAG = SCRIM_LEAD + BAND_STAGGER;
/** How long the root keeps the tree mounted after close — panel dim + scrim trail. */
const EXIT_MS = DIM.duration + SCRIM_TRAIL;
/** Band index handed to a DialogHeader so its title and description switch on as separate bands. */
const BandCtx = createContext<number | null>(null);
const bandDelay = (band: number) => CONTENT_LAG + band * BAND_STAGGER;
interface DialogCtx {
open: boolean;
onOpenChange: (open: boolean) => void;
/** User-initiated close — fires the close haptic, then resolves state. */
dismiss: () => void;
}
const Ctx = createContext<DialogCtx | null>(null);
export interface DialogProps {
/** Controlled open state. Omit for uncontrolled usage with defaultOpen. */
open?: boolean;
/** Uncontrolled initial open state. Default false. */
defaultOpen?: boolean;
onOpenChange?: (open: boolean) => void;
children: React.ReactNode;
}
/**
* Dialog — modal whose backdrop dims first, then the panel arrives and its content switches on.
* Focus is contained by RN's Modal; VoiceOver/TalkBack announce the content.
*/
export function Dialog({ open, defaultOpen = false, onOpenChange, children }: DialogProps) {
const haptics = useHaptic();
const [internal, setInternal] = React.useState(defaultOpen);
const isControlled = open !== undefined;
const value = isControlled ? open : internal;
const firstRender = React.useRef(true);
// Held mounted through the 120ms dim so DialogContent's exit animation is
// actually visible — `visible={value}` would drop the Modal instantly.
const [rendered, setRendered] = React.useState(value);
const setOpen = React.useCallback(
(next: boolean) => {
if (!isControlled) setInternal(next);
onOpenChange?.(next);
},
[isControlled, onOpenChange]
);
// User-initiated dismiss paths (backdrop press, hardware back,
// DialogClose) route through here so the close haptic is intentional —
// programmatic onOpenChange(false) stays silent.
const dismiss = React.useCallback(() => {
haptics.selection();
setOpen(false);
}, [haptics, setOpen]);
React.useEffect(() => {
if (firstRender.current) {
firstRender.current = false;
return;
}
// Open haptic only — close haptics live on user-initiated dismiss paths,
// not a passive effect that fires on every value flip.
if (value) haptics.light();
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [value]);
React.useEffect(() => {
if (value) {
setRendered(true);
return;
}
if (!rendered) return;
// Unmount lands once the panel has dimmed out.
const t = setTimeout(() => setRendered(false), EXIT_MS);
return () => clearTimeout(t);
}, [value, rendered]);
return (
<Ctx.Provider value={{ open: value, onOpenChange: setOpen, dismiss }}>
<Modal
visible={rendered}
transparent
animationType="none"
onRequestClose={dismiss}
statusBarTranslucent
>
{/* Children stay mounted through the exit recede, then unmount —
re-opening remounts fresh so the entrance spring replays. */}
{rendered ? children : null}
</Modal>
</Ctx.Provider>
);
}
function useDialog() {
const ctx = useContext(Ctx);
if (!ctx) throw new Error("Dialog.* must be inside <Dialog>");
return ctx;
}
export interface DialogContentProps extends ViewProps {
className?: string;
/** Surface material. "solid" (default) is the opaque popover surface,
* legible in light and dark over any screen. "glass" opts into liquid
* glass; use it only when the dialog floats over photos or video. */
material?: "solid" | "glass";
}
export const DialogContent = forwardRef<React.ElementRef<typeof View>, DialogContentProps>(
function DialogContent({ className, material = "solid", children, onLayout, ...props }, ref) {
const { open, dismiss } = useDialog();
const reduceMotion = useReducedMotion();
const insets = useSafeAreaInsets();
const opacity = useSharedValue(0);
const rise = useSharedValue(reduceMotion ? 0 : RISE);
const scale = useSharedValue(reduceMotion ? 1 : FROM_SCALE);
const scrim = useSharedValue(0);
React.useEffect(() => {
// Children only mount while rendered, so this fires on mount — the
// close branch matters because the root holds the tree through the
// exit window.
if (open) {
// Light first: the scrim dims, then the panel travels.
scrim.value = withTiming(1, SCRIM_IN);
opacity.value = withDelay(SCRIM_LEAD, withTiming(1, IGNITE));
if (reduceMotion) {
rise.value = 0;
scale.value = 1;
} else {
rise.value = withDelay(SCRIM_LEAD, withSpring(0, spring.panel));
scale.value = withDelay(SCRIM_LEAD, withSpring(1, spring.panel));
}
} else {
// Dim in place — no retreat; the scrim clears after the panel.
opacity.value = withTiming(0, DIM);
scrim.value = withDelay(SCRIM_TRAIL, withTiming(0, DIM));
if (!reduceMotion) scale.value = withTiming(EXIT_SCALE, DIM);
}
}, [open, opacity, rise, scale, scrim, reduceMotion]);
const panelStyle = useAnimatedStyle(() => ({
opacity: opacity.value,
transform: [{ translateY: rise.value }, { scale: scale.value }],
}));
const backdropStyle = useAnimatedStyle(() => ({ opacity: scrim.value }));
// Content switches on in bands. A DialogHeader spends one band per child
// (title, then description); any other child is one band.
let band = 0;
const staggered = React.Children.toArray(children).map((child, index) => {
if (React.isValidElement<{ children?: React.ReactNode }>(child) && child.type === DialogHeader) {
const base = band;
band += Math.max(1, React.Children.count(child.props.children));
return (
<BandCtx.Provider key={index} value={base}>
{child}
</BandCtx.Provider>
);
}
const delay = bandDelay(band);
band += 1;
return (
<SwitchOn key={index} delay={delay}>
{child}
</SwitchOn>
);
});
return (
// Single overlay layer (was triple-stacked → near-black backdrop).
<View
ref={ref}
className="flex-1 items-center justify-center p-5"
style={{ width: "100%", height: "100%", paddingTop: Math.max(20, insets.top + 8), paddingBottom: Math.max(20, insets.bottom + 8) }}
>
<Animated.View className="bg-overlay" style={[{ position: "absolute", top: 0, left: 0, right: 0, bottom: 0 }, backdropStyle]}>
<Pressable
style={{ width: "100%", height: "100%" }}
onPress={dismiss}
accessibilityLabel="Close dialog"
accessibilityRole="button"
/>
</Animated.View>
<Animated.View
style={[
{
// Native elevation — shadow-lg is web-only and did nothing on
// device. Shadow is black, not foreground: a foreground shadow
// glows white under the dark theme.
shadowColor: "#000",
shadowOpacity: 0.18,
shadowRadius: 32,
shadowOffset: { width: 0, height: 12 },
elevation: 12,
},
panelStyle,
]}
onLayout={onLayout}
// max-w-[340px] fits a 350px phone column; max-w-sm (384px) overflowed.
className={cn("w-full max-w-[340px]", className)}
accessibilityViewIsModal
// RN's accessibilityRole enum has no "dialog" — `role` carries the
// ARIA dialog semantics (web + supported native mappings), and
// aria-modal marks it as the modal surface. "alert" was too narrow:
// a generic dialog isn't necessarily an alert.
role="dialog"
aria-modal
{...props}
>
{/* 28pt radius + 24pt padding. Depth is the surface itself (popover
on the dim backdrop): no border, no glow. */}
<View style={{ overflow: "hidden", borderRadius: PANEL_RADIUS }}>
{material === "glass" ? (
<Glass effect="regular" className="rounded-[28px] p-6">
{staggered}
</Glass>
) : (
<View className="rounded-[28px] bg-popover p-6">{staggered}</View>
)}
</View>
</Animated.View>
</View>
);
}
);
export const DialogHeader = forwardRef<React.ElementRef<typeof View>, ViewProps & { className?: string }>(
function DialogHeader({ className, children, ...props }, ref) {
const base = useContext(BandCtx);
return (
<View ref={ref} className={cn("gap-2", className)} {...props}>
{base === null
? children
: React.Children.toArray(children).map((child, i) => (
<SwitchOn key={i} delay={bandDelay(base + i)}>
{child}
</SwitchOn>
))}
</View>
);
}
);
export const DialogTitle = forwardRef<React.ElementRef<typeof Text>, TextProps & { className?: string }>(
function DialogTitle({ className, ...props }, ref) {
return (
<Text
ref={ref}
className={cn("text-[22px] font-semibold leading-tight tracking-tight text-popover-foreground", className)}
accessibilityRole="header"
{...props}
/>
);
}
);
export const DialogDescription = forwardRef<React.ElementRef<typeof Text>, TextProps & { className?: string }>(
function DialogDescription({ className, ...props }, ref) {
return <Text ref={ref} className={cn("text-[15px] leading-snug text-muted-foreground", className)} {...props} />;
}
);
export const DialogFooter = forwardRef<React.ElementRef<typeof View>, ViewProps & { className?: string }>(
function DialogFooter({ className, ...props }, ref) {
return <View ref={ref} className={cn("mt-6 flex-row flex-wrap justify-end gap-2", className)} {...props} />;
}
);
interface DialogCloseChildProps {
onPress?: () => void;
className?: string;
ref?: React.Ref<View>;
}
export interface DialogCloseProps {
children: React.ReactElement<DialogCloseChildProps>;
className?: string;
}
export const DialogClose = forwardRef<View, DialogCloseProps>(
function DialogClose({ children, className }, ref) {
const { dismiss } = useDialog();
return React.cloneElement(children, {
// Chain: run the child's own action first, then dismiss (with haptic).
onPress: () => {
children.props.onPress?.();
dismiss();
},
className: cn(children.props.className, className),
ref: ref ?? children.props.ref,
});
}
);
DialogClose.displayName = "DialogClose";
Dialog.displayName = "Dialog";
DialogContent.displayName = "DialogContent";
DialogHeader.displayName = "DialogHeader";
DialogTitle.displayName = "DialogTitle";
DialogDescription.displayName = "DialogDescription";
DialogFooter.displayName = "DialogFooter"; import { Dialog } from "@/components/ui/dialog/dialog";
export function Example() {
return (
<Dialog />
);
} Installation
Install the dependencies
npx expo install react-native-reanimated react-native-safe-area-contextAdd the components it builds on
Copy the source from the Code tab into your project
components/ui/dialog/dialog.tsxcomponents/ui/dialog/index.tsUpdate the import paths to match your project setup.
Usage
import { Dialog, DialogContent, DialogHeader, DialogTitle, DialogDescription, DialogFooter, DialogClose } from "@/components/ui/dialog/dialog"; <Dialog /> Also exported: DialogContent, DialogHeader, DialogTitle, DialogDescription, DialogFooter, DialogClose.
Examples
"End workout?" on a live run.
import * as React from "react";
import { View } from "react-native";
import Animated, { Easing, useAnimatedStyle, useSharedValue, withTiming } from "react-native-reanimated";
import { Accent, Sheen, SwitchOn, ease, timing, useHaptic, useTheme } from "@lumioui/core";
import { Dialog, DialogClose, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogTitle } from "../dialog";
import { Button } from "../../button/button";
import { Icon } from "../../icon/icon";
import { Text } from "../../text/text";
function Stat({ value, unit, label }: { value: string; unit?: string; label: string }) {
return (
<View className="flex-1 gap-1">
<View className="flex-row items-baseline gap-1">
<Text className="text-3xl font-semibold tracking-tight tabular-nums">{value}</Text>
{unit ? <Text className="text-[15px] text-muted-foreground">{unit}</Text> : null}
</View>
<Text variant="muted">{label}</Text>
</View>
);
}
/** The dialog dims out before the run card performs (panel dim + scrim trail). */
const AFTER_DIALOG = timing.recede.duration + timing.recede.duration / 2;
/** The saved figure holds its sheen this long before the card resolves. */
const HOLD_MS = 700;
type Phase = "live" | "saving" | "saved";
/** DialogConfirm — "End workout?" on a live run. The run screen is the
* habitat; ending asks first, then the card itself performs the save: the
* dialog dims away, one red sheen crosses the 28:14 figure while the
* footprints glyph dims from accent to muted, the result holds 700ms, then
* "Saved to Activity" switches on in place. */
export function DialogConfirm() {
return (
<Accent color="red" className="w-full">
<RunCard />
</Accent>
);
}
function RunCard() {
const { colors } = useTheme();
const haptics = useHaptic();
const [open, setOpen] = React.useState(false);
const [phase, setPhase] = React.useState<Phase>("live");
const [sheen, setSheen] = React.useState(0);
const timers = React.useRef<ReturnType<typeof setTimeout>[]>([]);
React.useEffect(() => () => timers.current.forEach(clearTimeout), []);
// Accent → muted on the glyph, crossfaded rather than snapped.
const lit = useSharedValue(1);
const accentGlyph = useAnimatedStyle(() => ({ opacity: lit.value }));
const mutedGlyph = useAnimatedStyle(() => ({ opacity: 1 - lit.value }));
const setLit = (on: boolean) => {
lit.value = withTiming(on ? 1 : 0, { ...timing.normal, easing: Easing.bezier(...ease.inOut) });
};
const endAndSave = () => {
timers.current.push(
setTimeout(() => {
setPhase("saving");
setSheen((n) => n + 1);
setLit(false);
haptics.success();
}, AFTER_DIALOG),
setTimeout(() => setPhase("saved"), AFTER_DIALOG + HOLD_MS)
);
};
const startAnother = () => {
setPhase("live");
setLit(true);
};
return (
<View className="w-full gap-5 rounded-3xl bg-card p-5">
<View className="flex-row items-center justify-between">
<View className="flex-row items-center gap-2">
<View>
<Animated.View style={accentGlyph}>
<Icon name="footprints" size="sm" color="primary" />
</Animated.View>
<Animated.View style={[{ position: "absolute", top: 0, left: 0 }, mutedGlyph]}>
<Icon name="footprints" size="sm" color="mutedForeground" />
</Animated.View>
</View>
<Text className="text-[15px] font-medium">Tempo run</Text>
</View>
{phase === "saved" ? (
<SwitchOn key="saved" accessibilityLiveRegion="polite">
<Text variant="muted">Saved to Activity</Text>
</SwitchOn>
) : (
<Text variant="muted">In progress</Text>
)}
</View>
<View className="gap-1">
<View className="self-start overflow-hidden rounded-xl">
<Text className="text-5xl font-semibold tracking-tight tabular-nums">28:14</Text>
<Sheen run={sheen} color={colors.primary} strength={0.3} />
</View>
<Text variant="muted">Elapsed · Harbour Park loop</Text>
</View>
<View className="flex-row gap-4 border-t border-border pt-4">
<Stat value="5.21" unit="km" label="Distance" />
<Stat value="5:25" unit="/km" label="Avg pace" />
<Stat value="162" unit="bpm" label="Heart rate" />
</View>
{phase === "saved" ? (
<SwitchOn key="again">
<Button size="lg" variant="secondary" className="w-full" onPress={startAnother}>
Start another run
</Button>
</SwitchOn>
) : (
<View className="flex-row gap-2">
<Button
size="lg"
variant="secondary"
className="flex-1"
disabled={phase === "saving"}
icon={<Icon name="pause" size="sm" color="foreground" />}
>
Pause
</Button>
<Button size="lg" className="flex-1" disabled={phase === "saving"} onPress={() => setOpen(true)}>
End
</Button>
</View>
)}
<Dialog open={open} onOpenChange={setOpen}>
<DialogContent>
<DialogHeader>
<DialogTitle>End workout?</DialogTitle>
<DialogDescription>
You've run 5.21 km in 28:14. Ending now saves it to your log and counts it toward today's goals.
</DialogDescription>
</DialogHeader>
{/* Overlays portal out of the tree, so the accent is re-scoped here. */}
<Accent color="red">
<DialogFooter>
<DialogClose>
<Button variant="ghost">Keep going</Button>
</DialogClose>
<DialogClose>
<Button onPress={endAndSave}>End and save</Button>
</DialogClose>
</DialogFooter>
</Accent>
</DialogContent>
</Dialog>
</View>
);
} API reference
Dialog
children* React.ReactNode — open boolean Controlled open state. Omit for uncontrolled usage with defaultOpen.
—defaultOpen boolean Uncontrolled initial open state. Default false.
false onOpenChange (open: boolean) => void — DialogContent
className string — material "solid" | "glass" Surface material. "solid" (default) is the opaque popover surface, legible in light and dark over any screen. "glass" opts into liquid glass; use it only when the dialog floats over photos or video.
"solid" DialogClose
children* React.ReactElement<DialogCloseChildProps> — className string —