svelte-hamburgers
Version:
Svelte Hamburgers is a component based on the popular hamburgers.css
63 lines (62 loc) • 1.9 kB
TypeScript
import type { MouseEventHandler } from 'svelte/elements';
import type { HamburgerType } from './types';
/**
* A Svelte component implementation of [hamburgers.css](https://jonsuh.com/hamburgers)
* by Jonathan Suh
*
* ```svelte
* <script lang="ts">
* import { Hamburger } from 'svelte-hamburgers';
*
* let open = $state(false);
* </script>
*
* <Hamburger bind:open />
* ```
*
* The `open` variable can be then used to handle your menu, for example:
*
* ```svelte
* {#if open}
* Show your menu here!
* {/if}
* ```
*
* [View the full docs](https://svelte-hamburgers.willow.codes).
*/
declare const Hamburger: import("svelte").Component<{
/**
* Controls and represents whether the hamburger is open
* @default false
*/
open?: boolean;
/**
* The type of the hamburger
* @default "spin"
* @see https://svelte-hamburgers.willow.codes#types
*/
type?: HamburgerType;
/**
* Can be used to add a tooltip, also controls the default value of the `ariaLabel` prop
* @default "Hamburger menu"
* @see https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/title
*/
title?: string;
/**
* A label that describes the hamburger menu.
* Defaults to the value of the `title` prop, which defaults to `Hamburger menu`.
* @see https://www.w3.org/TR/wai-aria-1.1/#aria-label
*/
ariaLabel?: string;
/**
* This identifies the element(s) whos presence is controlled by the hamburger menu
* @see https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-controls
* @see https://www.w3.org/TR/wai-aria-1.1/#aria-controls
*/
ariaControls?: string;
/**
* Fires when the hamburger is clicked. This event won't propagate.
*/
onclick?: MouseEventHandler<HTMLButtonElement>;
}, {}, "open">;
export default Hamburger;