mirror of
https://github.com/carbon-design-system/carbon-components-svelte.git
synced 2025-09-18 03:26:36 +00:00
docs(modal): add multiple secondary button example for ComposedModal
This commit is contained in:
parent
177250e8df
commit
8bf2cf4839
2 changed files with 34 additions and 0 deletions
|
@ -9,3 +9,9 @@ components: ["ComposedModal", "ModalHeader", "ModalBody", "ModalFooter"]
|
|||
### Composed modal
|
||||
|
||||
<FileSource src="/framed/Modal/ComposedModal" />
|
||||
|
||||
### Multiple secondary buttons
|
||||
|
||||
Use the `secondaryButtons` prop in `ModalFooter` to render two secondary buttons for a "3-button modal". The prop is a 2-tuple type that supersedes `secondaryButtonText`.
|
||||
|
||||
<FileSource src="/framed/Modal/3ButtonComposedModal" />
|
28
docs/src/pages/framed/Modal/3ButtonComposedModal.svelte
Normal file
28
docs/src/pages/framed/Modal/3ButtonComposedModal.svelte
Normal file
|
@ -0,0 +1,28 @@
|
|||
<script>
|
||||
import {
|
||||
ComposedModal,
|
||||
ModalHeader,
|
||||
ModalBody,
|
||||
ModalFooter,
|
||||
Checkbox,
|
||||
} from "carbon-components-svelte";
|
||||
|
||||
let open = true;
|
||||
let checked = false;
|
||||
</script>
|
||||
|
||||
<ComposedModal bind:open>
|
||||
<ModalHeader label="Changes" title="Confirm changes" />
|
||||
<ModalBody hasForm>
|
||||
<Checkbox labelText="I have reviewed the changes" bind:checked />
|
||||
</ModalBody>
|
||||
<ModalFooter
|
||||
primaryButtonText="Proceed"
|
||||
primaryButtonDisabled="{!checked}"
|
||||
secondaryButtons="{[{ text: 'Cancel' }, { text: 'Review' }]}"
|
||||
on:click:button--secondary="{({ detail }) => {
|
||||
if (detail.text === 'Cancel') open = false;
|
||||
if (detail.text === 'Review') console.log('Review');
|
||||
}}"
|
||||
/>
|
||||
</ComposedModal>
|
Loading…
Add table
Add a link
Reference in a new issue