ui/popover.svelte.ts view source
import {Popover} from '@fuzdev/fuz_app/ui/popover.svelte.js'; Class that manages state and provides actions for popovers.
visible
Whether the popover is currently visible.
type boolean
position
Position of the popover relative to its trigger.
type Position
align
Alignment along the position edge.
type Alignment
offset
Distance from the position.
type string
disable_outside_click
Whether to disable closing when clicking outside.
type boolean
popover_class
Custom class for the popover.
type string
constructor
type new (params?: PopoverParameters | undefined): Popover
params?
update
Updates the popover configuration. Swaps popover_class on the live
content element when supplied and re-syncs the outside-click handler
if disable_outside_click changed.
type (params: PopoverParameters): void
params
voidmutates
this
show
Shows the popover, registering the outside-click handler and updating
aria-expanded on the trigger. No-ops when already visible.
type (): void
voidmutates
this
hide
Hides the popover, removing the outside-click handler. No-ops when already hidden.
type (): void
voidmutates
this
toggle
Toggles the popover visibility, or sets it to the given value.
type (visible?: boolean): void
visible?
desired visibility (defaults to the inverse of current)
boolean!this.visiblevoidmutates
this
container
Attachment for the container element.
type Attachment<HTMLElement>
trigger
Attachment factory for the trigger element that shows/hides the popover.
type (params?: PopoverParameters | undefined) => Attachment<HTMLElement>
content
Attachment factory for the popover content element.
type (params?: PopoverContentParameters | undefined) => Attachment<HTMLElement>