mirror of
https://github.com/hanzoai/svelte.git
synced 2026-10-01 00:41:47 +00:00
24 lines
549 B
Svelte
24 lines
549 B
Svelte
<!-- DialogTrigger — a button that opens the dialog. -->
|
|
<script lang="ts">
|
|
import { getDisclosure, DIALOG } from './internal/context'
|
|
|
|
let className: string | undefined = undefined
|
|
export { className as class }
|
|
|
|
const { openIt, open, contentId, triggerId } = getDisclosure(DIALOG, 'DialogTrigger')
|
|
</script>
|
|
|
|
<button
|
|
type="button"
|
|
id={triggerId}
|
|
aria-haspopup="dialog"
|
|
aria-expanded={$open}
|
|
aria-controls={contentId}
|
|
data-slot="dialog-trigger"
|
|
class={className}
|
|
on:click={openIt}
|
|
{...$$restProps}
|
|
>
|
|
<slot />
|
|
</button>
|