mirror of
https://github.com/hanzoai/svelte.git
synced 2026-10-01 00:41:47 +00:00
25 lines
605 B
Svelte
25 lines
605 B
Svelte
<!-- DropdownMenuTrigger — button toggling the menu. -->
|
|
<script lang="ts">
|
|
import { getDisclosure, DROPDOWN } from './internal/context'
|
|
|
|
let className: string | undefined = undefined
|
|
export { className as class }
|
|
|
|
const { toggle, open, contentId, triggerId } = getDisclosure(DROPDOWN, 'DropdownMenuTrigger')
|
|
</script>
|
|
|
|
<button
|
|
type="button"
|
|
id={triggerId}
|
|
aria-haspopup="menu"
|
|
aria-expanded={$open}
|
|
aria-controls={contentId}
|
|
data-state={$open ? 'open' : 'closed'}
|
|
data-slot="dropdown-menu-trigger"
|
|
class={className}
|
|
on:click={toggle}
|
|
{...$$restProps}
|
|
>
|
|
<slot />
|
|
</button>
|