mirror of
https://github.com/carbon-design-system/carbon-components-svelte.git
synced 2025-09-19 20:09:35 +00:00
add closeIcon attribute to HeaderAction
This commit is contained in:
parent
a2494ad128
commit
fc9e8a6926
5 changed files with 29 additions and 2 deletions
|
@ -12,6 +12,12 @@
|
|||
*/
|
||||
export let icon = AppSwitcher20;
|
||||
|
||||
/**
|
||||
* Specify the close icon from `carbon-icons-svelte` to render
|
||||
* @type {typeof import("carbon-icons-svelte").CarbonIcon}
|
||||
*/
|
||||
export let closeIcon = Close20;
|
||||
|
||||
/**
|
||||
* Specify the text
|
||||
* Alternatively, use the named slot "text" (e.g., <div slot="text">...</div>)
|
||||
|
@ -63,7 +69,8 @@
|
|||
dispatch(isOpen ? 'open' : 'close');
|
||||
}}"
|
||||
>
|
||||
<Icon render="{icon}" />
|
||||
<Icon render="{icon}" style="{isOpen ? 'display: none' : ''}" />
|
||||
<Icon render="{closeIcon}" style="{!isOpen ? 'display: none' : ''}" />
|
||||
<slot name="text">
|
||||
{#if text}<span>{text}</span>{/if}
|
||||
</slot>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue