Skip to main content

Aditional Settings

In order to customize your dialog you can easily change some properties if needed.

Simple Dialog Container

Properties

PropertyTypeRequiredDefaultWhat it does
primaryColorstringtruergb(3 105 161)The primary color (use only for button)
primaryHoverColorstringfalsergb(2 132 199)Ths primary hover color

Example

import { SimpleDialogContainer } from 'react-simple-dialogs'

function App() {
return (
<SimpleDialogContainer primaryColor="#d1691c" primaryHoverColor="#b56429" />
)
}

Alert Dialog

Properties

PropertyTypeRequiredDefaultWhat it does
messagestringtrueThe alert message
titlestringfalseAttentionChange the dialog title
closeLabelstringfalseCloseChange the close buttom text

Example

import { simpleAlert } from 'react-simple-dialogs'

const showAlert = async () => {
await simpleAlert({
message: "You can't do this right now.",
closeLabel: 'Ok, now close this',
title: "Oops..."
})

console.log('Alert closed')
}

Confirm Dialog

Properties

PropertyTypeRequiredDefaultWhat it does
messagestringtrueThe alert message
titlestringfalseAttentionChange the dialog title
cancelLabelstringfalseCancelChange the cancel buttom text
confirmLabelstringfalseConfirmChange the confirm buttom text

Example

import { simpleConfirm } from 'react-simple-dialogs'

const showConfirmation = async () => {
if (
await simpleConfirm({
title: "Hey!",
message: "You must accept before continue",
confirmLabel: 'Ok, I accept.',
cancelLabel: 'No, cancel this'
})
) {
console.log('Confirmed! 😄')
} else {
console.log('Not confirmed. 🥲')
}
}

Prompt Dialog

Properties

PropertyTypeRequiredDefaultWhat it does
messagestringtrueThe alert message
titlestringfalseAttentionChange the dialog title
cancelLabelstringfalseCancelChange the cancel buttom text
confirmLabelstringfalseConfirmChange the confirm buttom text
inputLabelstringfalseValueChange the dialog input label

Example

import { simplePrompt } from 'react-simple-dialogs'

const showConfirmation = async () => {
if (
await simplePrompt({
title: "We need something",
message: "You must enter your name in order to continue",
confirmLabel: "That's my name!",
cancelLabel: 'No, cancel this',
inputLabel: 'Your Name'
})
) {
console.log('Confirmed! 😄')
} else {
console.log('Not confirmed. 🥲')
}
}