docs(modal): add multiple modals example (#980)

Refs: #975
This commit is contained in:
Eric Liu 2022-01-08 09:41:00 -08:00 committed by GitHub
commit 3ca0297b5e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 42 additions and 0 deletions

View file

@ -0,0 +1,38 @@
<script>
import { Button, Modal } from "carbon-components-svelte";
let openCreate = false;
let openDelete = false;
</script>
<Button on:click="{() => (openCreate = true)}">Create database</Button>
<Button kind="danger-tertiary" on:click="{() => (openDelete = true)}">
Delete database
</Button>
<Modal
bind:open="{openCreate}"
modalHeading="Create database"
primaryButtonText="Confirm"
secondaryButtonText="Cancel"
on:click:button--secondary="{() => (openCreate = false)}"
on:open
on:close
on:submit
>
<p>Create a new Cloudant database in the US South region.</p>
</Modal>
<Modal
danger
bind:open="{openDelete}"
modalHeading="Delete database"
primaryButtonText="Delete"
secondaryButtonText="Cancel"
on:click:button--secondary="{() => (openDelete = false)}"
on:open
on:close
on:submit
>
<p>This is a permanent action and cannot be undone.</p>
</Modal>