carbon-components-svelte/src/UIShell/HamburgerMenu.svelte
metonym ba58ba8f00
refactor: use icons from carbon-icons-svelte@11 (#1227)
* chore: update ignore rules, remove unused files

* refactor(icons): use icons from carbon-icons-svelte@11

* docs(time-picker): fix default value

* chore: upgrade carbon-icons-svelte to v11

* docs: update examples to use icons from carbon-icons-svelte@11

* docs: update number of icons [ci skip]
2022-04-03 11:57:28 -07:00

45 lines
1.1 KiB
Svelte

<script>
/**
* Specify the ARIA label for the button
* @type {string}
*/
export let ariaLabel = undefined;
/** Set to `true` to toggle the open state */
export let isOpen = false;
/**
* Specify the icon to render for the closed state.
* Defaults to `<Menu size={20} />`
* @type {typeof import("svelte").SvelteComponent}
*/
export let iconMenu = Menu;
/**
* Specify the icon to render for the opened state.
* Defaults to `<Close size={20} />`
* @type {typeof import("svelte").SvelteComponent}
*/
export let iconClose = Close;
/** Obtain a reference to the HTML button element */
export let ref = null;
import Close from "../icons/Close.svelte";
import Menu from "../icons/Menu.svelte";
</script>
<button
bind:this="{ref}"
type="button"
title="{ariaLabel}"
aria-label="{ariaLabel}"
class:bx--header__action="{true}"
class:bx--header__menu-trigger="{true}"
class:bx--header__menu-toggle="{true}"
{...$$restProps}
on:click
on:click="{() => (isOpen = !isOpen)}"
>
<svelte:component this="{isOpen ? iconClose : iconMenu}" size="{20}" />
</button>