SystemPopover
在独立的原生子窗口中显示 QuickGUI 内容,可超出所属窗口边界。
#导入
从 github.com/egoist/quickgui/go/ui 导入 ui。
import (
"github.com/egoist/quickgui/go/ui"
)#用法
func SystemPopoverExample() *ui.Element {
popover := ui.NewSystemPopover()
return popover.Root().Children(
popover.Trigger().Child("Account"),
popover.Content(ui.PopoverContentProps{Width: 240, Height: 120, Placement: "bottom-start"}).Child("Account settings"),
)
}#结构
systemPopover.RootsystemPopover.TriggersystemPopover.Content
#API 参考
展开条目查看说明和完整签名。短横线表示声明中未记录默认值。
NewSystemPopover
查看源码ui.NewSystemPopover(props ...PopoverRootProps) *SystemPopoverComponentNewSystemPopover declares a SystemPopover instance. Optional props provide initial settings.
ChildrenComponent—
Content mounted inside the component. Compound child callbacks run after the parent context exists.
Component查看源码Openfunc() bool—
DefaultOpenbool—
OnOpenChangefunc(bool, PopoverOpenChangeDetails)—
DismissOnEscape*bool—
DismissOnPointerOutside*bool—
Modal*bool—
OpenOnHover*bool—
Delayany—
CloseDelayany—
OnPlacementChangefunc(AnchorPlacementDetails, *native.Event)—
Callback for placement change. The signature below lists the event payload.
func(AnchorPlacementDetails, *native.Event)查看源码SidePopoverSide—
AlignPopoverAlign—
SideOffset*float64—
AlignOffset*float64—
CollisionPadding*float64—
Sticky*bool—
Anchor*native.Node—
SystemPopover.Open
查看源码systemPopover.Open(value any) *SystemPopoverComponentControlled visibility of the panel or overlay. Pair with the open-change callback.
SystemPopover.DefaultOpen
查看源码systemPopover.DefaultOpen(value bool) *SystemPopoverComponentInitial visibility when the component owns its open state.
SystemPopover.OnOpenChange
查看源码systemPopover.OnOpenChange(value func(bool, PopoverOpenChangeDetails)) *SystemPopoverComponentReports a requested visibility change, including dismissal.
SystemPopover.DismissOnEscape
查看源码systemPopover.DismissOnEscape(value bool) *SystemPopoverComponentAllows Escape to dismiss the surface.
SystemPopover.DismissOnPointerOutside
查看源码systemPopover.DismissOnPointerOutside(value bool) *SystemPopoverComponentAllows a pointer press outside the surface to dismiss it.
SystemPopover.Modal
查看源码systemPopover.Modal(value bool) *SystemPopoverComponentContains focus and blocks interaction behind the surface.
SystemPopover.OpenOnHover
查看源码systemPopover.OpenOnHover(value bool) *SystemPopoverComponentOpens the surface when its trigger is hovered.
SystemPopover.Delay
查看源码systemPopover.Delay(value any) *SystemPopoverComponentCore-owned delay in milliseconds before opening.
SystemPopover.CloseDelay
查看源码systemPopover.CloseDelay(value any) *SystemPopoverComponentCore-owned delay in milliseconds before closing.
SystemPopover.OnPlacementChange
查看源码systemPopover.OnPlacementChange(value func(AnchorPlacementDetails, *native.Event)) *SystemPopoverComponentCallback for placement change. The signature below lists the event payload.
SystemPopover.Side
查看源码systemPopover.Side(value PopoverSide) *SystemPopoverComponentPreferred placement side before collision handling.
SystemPopover.Align
查看源码systemPopover.Align(value PopoverAlign) *SystemPopoverComponentPreferred alignment on the placement cross-axis.
SystemPopover.SideOffset
查看源码systemPopover.SideOffset(value float64) *SystemPopoverComponentDistance from the anchor on the chosen side, in logical pixels.
SystemPopover.AlignOffset
查看源码systemPopover.AlignOffset(value float64) *SystemPopoverComponentOffset along the anchor’s cross axis, in logical pixels.
SystemPopover.CollisionPadding
查看源码systemPopover.CollisionPadding(value float64) *SystemPopoverComponentSpace reserved between the positioned surface and the available viewport edges.
SystemPopover.Sticky
查看源码systemPopover.Sticky(value bool) *SystemPopoverComponentKeeps the positioned surface attached to its anchor within available bounds.
SystemPopover.Anchor
查看源码systemPopover.Anchor(value *native.Node) *SystemPopoverComponentElement used as the placement anchor for this surface.
SystemPopover.Root
查看源码systemPopover.Root() *ElementConfigures root for this part. The declared type and source define the accepted value.
SystemPopover.Trigger
查看源码systemPopover.Trigger(options ...PopoverTriggerProps) *ElementConfigures trigger for this part. The declared type and source define the accepted value.
Reffunc(*native.Node)—
Receives the retained native node after construction. Keep imperative work in event or lifecycle callbacks.
func(*native.Node)查看源码Styleany—
Reusable layout, typography, color, and interaction-state styles. Build with ui.Style() and compose with Merge.
any查看源码ChildrenPartChildren—
Content mounted inside the component. Compound child callbacks run after the parent context exists.
PartChildren查看源码Disabledany—
Prevents activation and exposes the disabled state to accessibility. Compound parts inherit a disabled root.
any查看源码Rolestring—
FocusOnPointerany—
Groupany—
AriaLabelany—
TabIndex*float64—
Controls sequential keyboard focus order. Omit to retain the component’s default focus behavior.
*float64查看源码OnClickfunc(*native.Event)—
Called after QuickGUI resolves an activation, including supported keyboard activation.
func(*native.Event)查看源码OnDoubleClickfunc(*native.Event)—
OnContextMenufunc(*native.Event)—
OnPointerfunc(*native.Event)—
OnMouseEnterfunc(*native.Event)—
OnMouseLeavefunc(*native.Event)—
OnMouseDownfunc(*native.Event)—
OnMouseUpfunc(*native.Event)—
OnKeyDownfunc(*native.Event)—
OnKeyUpfunc(*native.Event)—
OnFocusfunc(*native.Event)—
OnBlurfunc(*native.Event)—
OpenOnHover*bool—
Delayany—
CloseDelayany—
SystemPopover.Content
查看源码systemPopover.Content(options ...PopoverContentProps) *ElementConfigures content for this part. The declared type and source define the accepted value.
Reffunc(*native.Node)—
Receives the retained native node after construction. Keep imperative work in event or lifecycle callbacks.
func(*native.Node)查看源码Styleany—
Reusable layout, typography, color, and interaction-state styles. Build with ui.Style() and compose with Merge.
any查看源码ChildrenPartChildren—
Content mounted inside the component. Compound child callbacks run after the parent context exists.
PartChildren查看源码Disabledany—
Prevents activation and exposes the disabled state to accessibility. Compound parts inherit a disabled root.
any查看源码Rolestring—
FocusOnPointerany—
Groupany—
AriaLabelany—
TabIndex*float64—
Controls sequential keyboard focus order. Omit to retain the component’s default focus behavior.
*float64查看源码OnClickfunc(*native.Event)—
Called after QuickGUI resolves an activation, including supported keyboard activation.
func(*native.Event)查看源码OnDoubleClickfunc(*native.Event)—
OnContextMenufunc(*native.Event)—
OnPointerfunc(*native.Event)—
OnMouseEnterfunc(*native.Event)—
OnMouseLeavefunc(*native.Event)—
OnMouseDownfunc(*native.Event)—
OnMouseUpfunc(*native.Event)—
OnKeyDownfunc(*native.Event)—
OnKeyUpfunc(*native.Event)—
OnFocusfunc(*native.Event)—
OnBlurfunc(*native.Event)—
Widthfloat64—
Heightfloat64—
Placementstring—
Gap*float64—
ViewportMargin*float64—
Element
查看源码part.Child(content).Style(style)Every part returns a fluent element. Strings, numbers, elements, and deferred child factories compose directly.
ChildChild(child any) *Element—
Child appends content and returns this element. Content can be an element, native node, scalar, accessor, or node-returning construction callback.
Child(child any) *Element查看源码ChildrenChildren(children ...any) *Element—
Children appends multiple children in order without replacing existing content. It also accepts []any, []*Element, and []*native.Node slices as arguments. Read the retained child nodes through element.Node.Children.
Children(children ...any) *Element查看源码StyleStyle(style StyleBuilder) *Element—
Style merges a reusable style. Scalar accessors retain independent native bindings.
Style(style StyleBuilder) *Element查看源码OnClickOnClick(handler func()) *Element—
RefRef(handler func(*native.Node)) *Element—
Ref exposes the native handle once at this point in the declaration chain.
Ref(handler func(*native.Node)) *Element查看源码