react-confirm-prompt

React Confirm Prompt

ReactConfirmPrompt is a versatile and user-friendly React component designed to create confirm dialogs with ease. It is fully responsive, highly customizable, and simple to integrate into your React applications. Whether you need to confirm user actions, prompt for decisions, or display alerts, ReactConfirmBox provides a seamless solution to enhance user interactions. v1.1.1 of React Confirm Promt is now released!
VS

Installation

1npm i react-confirm-prompt

Usage

1import { showConfirm } from "react-confirm-prompt"; 2 3function App() { 4 function handleShowConfirm() { 5//showConfirm function 6 showConfirm("Are you sure?").then((answer) => { 7 if(answer) { 8 alert("You clicked Confirm"); 9 } else { 10 alert("You clicked Cancel"); 11 } 12 }); 13 14 } 15 return ( 16 <> 17 <button onClick={() => handleShowConfirm()}>Show Confirm</button> 18 </> 19 ); 20} 21export default App;

The Playground

Explore the React Confirm Promt Playground! Easily customize your confirm dialogs and get the code snippets you need using our intuitive UI. Experiment with different options and see the results in real-time.

Title

Description

Type

Animation

Theme Color

#

Hover Color

#

Hover Text Color

#

Icon Color

#

Confirm button

Lable text

Text Color

#

Button Color

#

Cancel button

Lable text

Text Color

#

Button Color

#

1showConfirm("Are you sure?", 2 { 3 description : "This action cannot be undone. All values associated with this field will be lost.", 4 } 5);

Adding Custom Icons

You can easily customize your confirm dialogs by adding custom icons.

First, visit the react-icons official website to install react-icons in your project. Once installed, import the specific icon you want to use.

Next, you can add the custom icon to your confirm box by passing it as a React Element to the icon parameter.

1import { AiFillHeart } from "react-icons/ai"; 2import { showConfirm } from "react-confirm-prompt"; 3 4showConfirm("Are you sure?", { icon: <AiFillHeart /> });

Options

You can customize the confirm box with the following options,

OptionDescriptiontype(s)
descriptiondescription for conirmation boxstring
typepre-defined types(themes) of confirmation box. 'info' is the defualt valuestring ("info", "warning", "success", "question")
animationconfirm box animations. 'scale' is the defualt valuestring ("none", "scale", "fade", "blur", "slide-up", "slide-down", "slide-right", "slide-left")
confirmLabelcustom text that should display in confirm buttonstring
confirmColorconfirm button colorstring (hex or rgb color codes)
confirmTextColorconfirm button text colorstring (hex or rgb color codes)
cancelLabelcustom text that should display in cancel buttonstring
cancelColorcancel button colorstring (hex or rgb color codes)
cancelTextColorcancel button text colorstring (hex or rgb color codes)
hideCancelhiding cancel buttonboolean
disableBlurdisabling background click cancellationboolean
colordefine color for both icon & confirm buttonstring (hex or rgb color codes)
hoverColordefine button hover colorstring (hex or rgb color codes)
hoverTextColordefine button's hover text colorstring (hex or rgb color codes)
icondefine custom iconJSX.Element
iconColordefine icon colorstring (hex or rgb color codes)
hideBackgroundhiding dark backgroundboolean
hideShadowhiding confirm box shadowboolean
Copyright © 2025 nipun-dezoysa