Allow modals to have button icons

This commit is contained in:
Gregor Wassmann 2022-01-29 00:04:39 +01:00
commit 414793b2a4
8 changed files with 96 additions and 31 deletions

View file

@ -6073,6 +6073,16 @@
"constant": false,
"reactive": false
},
{
"name": "primaryButtonIcon",
"kind": "let",
"description": "Specify the primary button icon",
"type": "typeof import(\"svelte\").SvelteComponent",
"isFunction": false,
"isFunctionDeclaration": false,
"constant": false,
"reactive": false
},
{
"name": "shouldSubmitOnEnter",
"kind": "let",
@ -6237,6 +6247,16 @@
"constant": false,
"reactive": false
},
{
"name": "primaryButtonIcon",
"kind": "let",
"description": "Specify the primary button icon",
"type": "typeof import(\"svelte\").SvelteComponent",
"isFunction": false,
"isFunctionDeclaration": false,
"constant": false,
"reactive": false
},
{
"name": "primaryButtonDisabled",
"kind": "let",

View file

@ -42,3 +42,6 @@ Use the `secondaryButtons` prop to render two secondary buttons for a "3-button
<FileSource src="/framed/Modal/ModalPreventOutsideClick" />
### Button with icon
<FileSource src="/framed/Modal/ModalButtonWithIcon" />

View file

@ -0,0 +1,14 @@
<script>
import { Modal } from "carbon-components-svelte";
import Send16 from "carbon-icons-svelte/lib/Send16";
</script>
<Modal
open
modalHeading="Invite someone"
primaryButtonText="Send invitation"
primaryButtonIcon="{Send16}"
secondaryButtonText="Cancel"
>
<p>Do you really want to invite someone?</p>
</Modal>