0.3.1 • Published 7 months ago

chakra-ui-confirm v0.3.1

Weekly downloads
-
License
MIT
Repository
github
Last release
7 months ago

chakra-ui-confirm

A simple confirmation dialog for Chakra UI.

Installation

npm install chakra-ui-confirm

Usage

Wrap your app inside the ConfirmProvider component.

import { useConfirm } from "chakra-ui-confirm";

const App = () => {
  const confirm = useConfirm();

  const handleClick = async () => {
    confirm({
      title: "Are you sure?",
      description: "This action cannot be undone.",
    })
      .then(() => {
        console.log("Confrimed");
      })
      .catch(() => {
        console.log("Canceled");
      });
  };

  return (
    <ConfirmProvider>
      <button onClick={handleClick}>Delete</button>
    </ConfirmProvider>
  );
};

Options

  • title (string): The title of the confirmation dialog.
  • description (string): The description of the confirmation dialog.
0.3.1

7 months ago

0.1.4

1 year ago

0.1.3

1 year ago

0.1.2

1 year ago

0.1.1

1 year ago

0.1.0

1 year ago