suiss/uim · Pattern

Confirm

A bottom alert sheet that asks the user to confirm or cancel an action.

Confirm is an open-source mobile pattern from suiss/uim: components composed into a flow for React Native and Expo, with SwiftUI and Jetpack Compose versions built from the same design tokens. The @esuiss/uim CLI copies its source into your project, so you own the code.

iOS
Confirm (open by default) on iOS in light mode

Confirm wraps AlertSheet with dismissible set to false by default, so the sheet closes only through one of its buttons.

ConfirmContent rearranges its children: the header and every non-cancel button from ConfirmFooter go into one rounded group, and ConfirmCancel is placed below it as a separate button. Use it before destructive or irreversible actions.

Installation

$ pnpm dlx @esuiss/uim@latest add confirm

The CLI also adds what it builds on: Alert Sheet.

Manual

  1. Install the dependencies:
npx expo install cn
  1. Add the pieces it builds on: Alert Sheet.

  2. Copy the source into components/patterns/confirm.tsx:

uniwind/components/patterns/confirm.tsx
import { cn } from "cn"
import * as React from "react"
import { View, type ViewProps } from "react-native"
import {
  AlertSheet,
  AlertSheetAction,
  AlertSheetCancel,
  AlertSheetContent,
  AlertSheetDescription,
  AlertSheetGroup,
  AlertSheetHeader,
  AlertSheetTitle,
  AlertSheetTrigger,
} from "@/components/ui/alert-sheet"

function Confirm({
  1. Update the import paths to match your project.

Usage

import { Confirm, ConfirmTrigger, ConfirmContent, ConfirmHeader, ConfirmFooter, ConfirmTitle, ConfirmDescription, ConfirmAction, ConfirmCancel } from "@/components/patterns/confirm"
<ConfirmDemo defaultOpen />

Put ConfirmTitle and ConfirmDescription in a ConfirmHeader, and the buttons in a ConfirmFooter inside ConfirmContent. Any ConfirmAction goes into the group; ConfirmCancel is moved out of it.

The root accepts open, defaultOpen and onOpenChange. Pass dismissible to let outside presses close it. Set variant="destructive" on ConfirmAction for delete-style actions.

Examples

Default

iOS
Confirm on iOS in light mode

API Reference

Confirm

The root that owns the open state.

ExtendsReact.ComponentProps<typeof AlertSheet>

ConfirmTrigger

The element that opens the sheet.

ExtendsReact.ComponentProps<typeof AlertSheetTrigger>

ConfirmContent

The sheet that groups the header and actions and places Cancel below.

ExtendsReact.ComponentProps<typeof AlertSheetContent>

ConfirmHeader

Holds the title and description.

ExtendsReact.ComponentProps<typeof AlertSheetHeader>

ConfirmFooter

Holds the action and cancel buttons.

ExtendsViewProps

ConfirmTitle

The question being asked.

ExtendsReact.ComponentProps<typeof AlertSheetTitle>

ConfirmDescription

Supporting text about the consequences.

ExtendsReact.ComponentProps<typeof AlertSheetDescription>

ConfirmAction

A confirming action, rendered as an AlertSheetAction.

ExtendsReact.ComponentProps<typeof AlertSheetAction>

ConfirmCancel

The cancel button, shown separately below the group.

ExtendsReact.ComponentProps<typeof AlertSheetCancel>

Accessibility

  • With the default dismissible={false}, the sheet uses the alert dialog primitive, so it closes only through its buttons.

Notes

  • Action text uses text-link, or text-danger for the destructive variant.
  • On iOS the sheet renders in a full-window overlay so it appears above native screens.