ui/ConfirmButton.svelte

Confirmation popover wrapping PopoverButton.

Clicking the trigger opens a popover with a confirm button. On confirm, calls onconfirm and hides the popover (controlled by hide_on_confirm). Defaults to position="left".

Trigger content: pass label for a simple string, or a children snippet for custom content (the two are mutually exclusive — DEV errors when both are set). pending: boolean overlays a spinner and disables the trigger, mirroring PendingButton semantics so the label stays put while an async operation runs.

<ConfirmButton onconfirm={() => delete_item(item.id)} title="delete item" label="delete" pending={state.remove.loading(item.id)} />
<!-- custom trigger content via the children snippet --> <ConfirmButton onconfirm={() => grant(item.id, role)} title="offer {role}" pending={state.grant.loading(key)} > {#snippet children(_popover, _confirm)}+ {role}{/snippet} </ConfirmButton>
<!-- custom confirm button content --> <ConfirmButton onconfirm={handle_revoke} class="icon_button plain" title="revoke"> revoke {#snippet popover_button_content()}revoke{/snippet} </ConfirmButton>
view source

Declarations
#

ConfirmButton
#

ui/ConfirmButton.svelte view source

accepts children

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

onconfirm

type (popover: Popover) => void
snippet parameters
popover Popover

popover_button_attrs?

type HTMLButtonAttributes
optional

hide_on_confirm?

type boolean
optional default true

popover_content?

Unlike on PopoverButton this is optional and has a confirm arg

type Snippet<[popover: Popover, confirm: () => void]>
optional
snippet parameters
popover Popover
confirm () => void

popover_button_content?

Content for the popover button

type Snippet<[popover: Popover, confirm: () => void]>
optional
snippet parameters
popover Popover
confirm () => void

children?

Unlike on PopoverButton this has a confirm arg

type Snippet<[popover: Popover, confirm: () => void]>
optional
snippet parameters
popover Popover
confirm () => void

label?

Simple string content for the trigger. Mutually exclusive with children.

type string
optional

pending?

When true, the trigger is disabled and a spinner overlays the content (mirrors PendingButton). The label / children stay rendered underneath so the button keeps its size.

type boolean
optional default false

position?

optional default 'left'

align?

optional

disable_outside_click?

type boolean
optional

popover_class?

type string
optional

popover_attrs?

type HTMLAttributes<HTMLDivElement>
optional

popover_container_attrs?

type HTMLAttributes<HTMLDivElement>
optional

button?

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

disabled?

type boolean | null
optional

external types

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

Depends on
#

Imported by
#