Skip to content

Feature: Add PopConfirm component #3169

Description

@ayangweb

It would be useful to have a PopConfirm component for lightweight confirmation interactions.

PopConfirm is commonly used when an action needs confirmation but does not require a full AlertDialog or modal dialog. For example, confirming destructive actions such as deleting an item.

A typical usage could look like:

[ Delete ]

        ┌──────────────────────────┐
        │  Are you sure?            │
        │                           │
        │  [Cancel] [Confirm]       │
        └──────────────────────────┘

Proposed API

The API could be similar to other component libraries:

PopConfirm::new()
    .title("Are you sure you want to delete this item?")
    .description("This action cannot be undone.")
    .confirm_text("Delete")
    .cancel_text("Cancel")
    .on_confirm(...)
    .child(Button::new("delete").label("Delete"))

The exact API can follow the existing Popover and button patterns in gpui-kit.

Why

Currently, developers need to compose Popover and other components themselves to implement this common interaction pattern.

Having a built-in PopConfirm would provide:

  • A consistent confirmation UX across applications
  • A reusable pattern for destructive or potentially irreversible actions
  • Less repetitive application-level code
  • Consistent positioning, styling, focus handling, and dismissal behavior

Relationship to AlertDialog

This component would complement AlertDialog rather than replace it:

  • PopConfirm: lightweight, contextual confirmation anchored to the triggering element
  • AlertDialog: more prominent modal confirmation for important decisions

A PopConfirm could potentially be implemented on top of the existing Popover component.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions