suiss/uim · React Native Component

Alert Sheet

A sheet that slides up from the bottom with a short list of actions and a separate cancel button.

Alert Sheet is an open-source mobile component from suiss/uim 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
Alert Sheet (open by default) on iOS in light mode

AlertSheet presents a set of choices related to the current context. AlertSheetContent renders through a portal (inside a full-window overlay on iOS), slides up from the bottom over a dimmed scrim, and respects the safe-area insets.

Actions sit in an AlertSheetGroup, a rounded card that draws a hairline between each child, and AlertSheetCancel sits below it as its own card with bold text. Use it for two to a few actions; for a single decision that needs confirmation, use Alert Dialog.

Installation

$ pnpm dlx @esuiss/uim@latest add alert-sheet

The CLI also adds what it builds on: Icon, Text.

Manual

  1. Install the dependencies:
npx expo install class-variance-authority cn react-native-reanimated react-native-safe-area-context react-native-screens react-native-worklets
  1. Add the pieces it builds on: Icon, Text, and the primitives components/primitives/alert-dialog.tsx, components/primitives/dialog.tsx, components/primitives/use-render.tsx.

  2. Copy the source into components/ui/alert-sheet.tsx:

uniwind/components/ui/alert-sheet.tsx
import { cva, type VariantProps } from "class-variance-authority"
import { cn } from "cn"
import * as React from "react"
import { Platform, View, type ViewProps } from "react-native"
import {
  Easing,
  FadeIn,
  FadeOut,
  ReduceMotion,
  SlideInDown,
  SlideOutDown,
} from "react-native-reanimated"
import { useSafeAreaInsets } from "react-native-safe-area-context"
import { FullWindowOverlay as RNFullWindowOverlay } from "react-native-screens"
import * as AlertSheetPrimitive from "@/components/primitives/alert-dialog"
import * as DialogPrimitive from "@/components/primitives/dialog"
  1. Update the import paths to match your project.

Usage

import { AlertSheet, AlertSheetOverlay, AlertSheetContent, AlertSheetGroup, AlertSheetHeader, AlertSheetTitle, AlertSheetDescription, AlertSheetAction, AlertSheetCancel } from "@/components/ui/alert-sheet"
<View className="items-start">
  <AlertSheet defaultOpen>
    <AlertSheetTrigger render={<Button variant="outline" />}>
      <Text>Show sheet</Text>
    </AlertSheetTrigger>
    <SheetBody />
  </AlertSheet>
</View>

Compose AlertSheetTrigger and AlertSheetContent. Inside the content, put an AlertSheetGroup with an optional AlertSheetHeader (AlertSheetTitle, AlertSheetDescription) followed by AlertSheetActions, then an AlertSheetCancel.

Every action closes the sheet when pressed. String children are wrapped in Text automatically. Use variant="destructive" on an action that deletes or removes, and disabled to dim and block it.

By default the sheet is dismissible and a tap on the scrim closes it. Set dismissible={false} to require an explicit choice.

Examples

Default

iOS
Alert Sheet on iOS in light mode

Not dismissible

dismissible={false} with a destructive and a disabled action.

iOS
Alert Sheet (not dismissible) on iOS in light mode

API Reference

AlertSheet

Root that holds the open state.

ExtendsAlertSheetPrimitive.RootProps
PropType
About
When false, the scrim no longer closes the sheet. Defaults to true.
Type
boolean
Default
true

AlertSheetOverlay

Dimmed scrim behind the sheet.

ExtendsReact.ComponentProps<typeof AlertSheetPrimitive.Backdrop>

AlertSheetContent

Bottom-anchored container that slides in and out.

ExtendsReact.ComponentProps<typeof AlertSheetPrimitive.Popup>
PropType
About
Name of the portal host to render into.
Type
string
Default
—

AlertSheetGroup

Rounded card that separates its children with hairlines.

ExtendsViewProps

AlertSheetHeader

Centered block for the title and description.

ExtendsViewProps

AlertSheetTitle

Small, bold heading for the sheet.

ExtendsReact.ComponentProps<typeof AlertSheetPrimitive.Title>

AlertSheetDescription

Supporting text below the title.

ExtendsReact.ComponentProps<typeof AlertSheetPrimitive.Description>

AlertSheetAction

Full-width action row that closes the sheet.

ExtendsAlertSheetActionProps

AlertSheetCancel

Separate cancel card with bold text.

ExtendsAlertSheetActionProps

Accessibility

  • When dismissible the popup has the dialog role, otherwise alertdialog; it is labelled by the title and marked as modal for VoiceOver.
  • Focus moves to the title when the sheet opens.
  • Actions have the button role with a disabled state.
  • Separators between actions are hidden from screen readers.

Notes

  • Padding uses the bottom and side safe-area insets, with a minimum of 8 points.
  • On iOS the content is wrapped in a full-window overlay.
  • Animations respect the system Reduce Motion setting.
  • Uses bg-surface-raised, bg-item-pressed, text-link and text-danger tokens; light and dark follow the system appearance.