core/popover/options.go
Functions
func Content
func Content(w widget.Widget) Option {
return func(c *config) {
c.content = w
}
}
func ContentSize
ContentSize sets a fixed size for the popover content area.
If not set, the content widget's natural size is used.
func ContentSize(width, height float32) Option {
return func(c *config) {
c.contentWidth = width
c.contentHeight = height
}
}
func Delay
Delay sets the hover delay before showing a tooltip. Defaults to 500ms.
Only applies to [Tooltip], not [Popover].
func Delay(d time.Duration) Option {
return func(c *config) {
c.delay = d
}
}
func Disabled
Disabled sets the popover's disabled state. Disabled popovers do not open.
func Disabled(d bool) Option {
return func(c *config) {
c.disabled = d
}
}
func DisabledFn
DisabledFn sets a dynamic function that determines whether the popover
is disabled. When set, this takes precedence over the static value.
func DisabledFn(fn func() bool) Option {
return func(c *config) {
c.disabledFn = fn
}
}
func DismissOnClickOutside
DismissOnClickOutside controls whether clicking outside the popover
content dismisses it. Defaults to true.
func DismissOnClickOutside(dismiss bool) Option {
return func(c *config) {
c.dismissOnClickOut = dismiss
}
}
func Gap
Gap sets the spacing between the trigger and the overlay in logical pixels.
Defaults to 4.
func Gap(g float32) Option {
return func(c *config) {
c.gap = g
}
}
func MaxWidth
MaxWidth sets the maximum width for tooltip text wrapping.
Defaults to 300 logical pixels.
func MaxWidth(w float32) Option {
return func(c *config) {
c.maxWidth = w
}
}
func OnHide
OnHide sets a callback invoked when the popover or tooltip is hidden.
func OnHide(fn func()) Option {
return func(c *config) {
c.onHide = fn
}
}
func OnShow
OnShow sets a callback invoked when the popover or tooltip becomes visible.
func OnShow(fn func()) Option {
return func(c *config) {
c.onShow = fn
}
}
func PainterOpt
PainterOpt sets the painter used to render the popover or tooltip.
func PainterOpt(p Painter) Option {
return func(c *config) {
c.painter = p
}
}
func PlacementOpt
PlacementOpt sets the preferred placement relative to the trigger.
func PlacementOpt(p Placement) Option {
return func(c *config) {
c.placement = p
}
}
func ResolvedDisabled
ResolvedDisabled returns the current disabled state, preferring the
dynamic function over the static bool.
func (c *config) ResolvedDisabled() bool {
if c.disabledFn != nil {
return c.disabledFn()
}
return c.disabled
}
func TooltipText
TooltipText sets the text displayed in a tooltip.
func TooltipText(text string) Option {
return func(c *config) {
c.tooltipText = text
}
}
func TriggerWidget
TriggerWidget sets the widget that anchors the popover/tooltip.
func TriggerWidget(w widget.Widget) Option {
return func(c *config) {
c.trigger = w
}
}
func VisibleSignal
VisibleSignal binds the visible state to a reactive signal for two-way
data binding. When the signal is set externally, the popover shows/hides.
func VisibleSignal(sig state.Signal[bool]) Option {
return func(c *config) {
c.visibleSignal = sig
}
}
Content sets the widget displayed inside the popover.