ui/PopoverButton.svelte

Button + popover composition for the common toggle-on-click pattern.

Wraps a Popover instance with a <button>, a positioned content area, and scale transitions. Spreads extra props onto the button element. Pass popover_content for the popover body, and either children for simple button content or button for a fully custom trigger — both receive the Popover instance.

<PopoverButton position="bottom" align="center"> {#snippet popover_content(popover)} <div class="box p_md"> <button type="button" onclick={() => popover.hide()}>close</button> </div> {/snippet} open menu </PopoverButton>
<!-- custom trigger via the `button` snippet --> <PopoverButton position="right" align="start" disable_outside_click> {#snippet popover_content(popover)} <form onsubmit={() => popover.hide()}> <input name="search" /> <button type="submit">go</button> </form> {/snippet} {#snippet button(popover)} <button type="button" class="icon_button" {@attach popover.trigger()}> search </button> {/snippet} </PopoverButton>

see also

  • ``ConfirmButton`` for a higher-level wrapper with confirmation semantics

view source

Declarations
#

PopoverButton
#

ui/PopoverButton.svelte view source

accepts children

import PopoverButton from '@fuzdev/fuz_app/ui/PopoverButton.svelte';

position?

optional default 'bottom'

align?

optional default 'center'

disable_outside_click?

type boolean
optional default false

popover_class?

type string
optional

popover_attrs?

type HTMLAttributes<HTMLDivElement>
optional

popover_content

type Snippet<[popover: Popover]>
snippet parameters
popover Popover

popover_container_attrs?

type HTMLAttributes<HTMLDivElement>
optional

button?

type Snippet<[popover: Popover]>
optional
snippet parameters
popover Popover

children?

type Snippet<[popover: Popover]>
optional
snippet parameters
popover Popover

external types

OmitStrict<SvelteHTMLElements['button'], 'children'>

Depends on
#

Imported by
#