ConfirmPopover

A small are-you-sure that opens beside its button instead of taking over the page. A failed action stays open and says so. Overlays.

Open playground

About

ConfirmPopover is a React component in the Overlays category of smoui. It is typed, ships no stylesheet, follows your theme through CSS variables, and honors prefers-reduced-motion. Import it with import { ConfirmPopover } from "@ashutoshswamy/smoui" and set children, title, onConfirm among its 5 props.

Install

Terminal
npm i @ashutoshswamy/smoui

Usage

TSX
import { ConfirmPopover } from "@ashutoshswamy/smoui";

<ConfirmPopover
  title="Delete this project?"
  description="Its files and history go with it."
  tone="danger"
  confirmLabel="Delete"
  onConfirm={() => api.deleteProject()}
>
  Delete project
</ConfirmPopover>

Props 5

children

The button label.

ReactNode
title / description

What is being confirmed.

string
onConfirm

A promise shows a busy state. Resolve closes; reject keeps it open with an error and Retry.

() => void | Promise<unknown>
tone

Danger paints the confirm button red.

"default""danger"
confirmLabel

Default Confirm.

string