Skip to content

Commit

Permalink
adding custom docs
Browse files Browse the repository at this point in the history
  • Loading branch information
alekangelov committed Aug 26, 2021
1 parent 37ef22e commit 29839dc
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
7 changes: 5 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ function Prompt() {
}
```

### Confirm
### Confirm with custom buttons

```jsx
function Confirm() {
Expand All @@ -141,7 +141,10 @@ function Confirm() {
<button
onClick={async () => {
try {
await confirm("Read some of the things we've written")
await confirm("Read some of the things we've written", {
okLabel: "I'm custom 🤯",
cancelLabel: "I'm custom too 😎"
})
setState('Yay, so you read all that')
} catch (e) {
setState("Oh, we're sorry about that :(")
Expand Down
2 changes: 1 addition & 1 deletion example/src/App.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -271,7 +271,7 @@ function Confirm() {
const [code, setCode] = useState(false)
const codestring = `async () => {
try {
await confirm("Read some of the things we've written")
await confirm("Read some of the things we've written", {okLabel: "I'm custom 😎", cancelLabel: "I'm custom 😭"})
setState('Yay, so you read all that')
} catch (e) {
setState("Oh, we're sorry about that :(")
Expand Down

0 comments on commit 29839dc

Please sign in to comment.