Popover
从组合式 SwiftUI 触发器显示原生 SwiftUI 浮窗。
#导入
从 @quickgui/solid/swift-ui 导入 Popover。
import { Host, Popover } from "@quickgui/solid/swift-ui";#用法
<Popover
isPresented={open()}
onIsPresentedChange={setOpen}
attachmentAnchor="bottom"
arrowEdge="top"
>
<Popover.Trigger render={<Button label="Open" />} />
<Popover.Content>
<QuickGUIHostView width={280} height={120}>
<SettingsPanel />
</QuickGUIHostView>
</Popover.Content>
</Popover>#结构
Popover.TriggerPopover.Content
<Popover isPresented={open()} onIsPresentedChange={setOpen}>
<Popover.Trigger render={<Button label="Open" />} />
<Popover.Content>{/* SwiftUI-hosted content */}</Popover.Content>
</Popover>#API 参考
展开条目查看说明和完整签名。短横线表示声明中未记录默认值。
Popover
查看源码Popover(props: PopoverProps): NativeNodetestIDstring—
modifiersViewModifier[]—
childrenunknown—
isPresentedboolean—
onIsPresentedChange(isPresented: boolean) => void—
Declares onIsPresentedChange (optional). Reactive JSX expressions update this property in place.
(isPresented: boolean) => void查看源码attachmentAnchorPopoverAttachmentAnchor—
Declares attachmentAnchor (optional). Reactive JSX expressions update this property in place.
PopoverAttachmentAnchor查看源码arrowEdgePopoverArrowEdge—
Declares arrowEdge (optional). Reactive JSX expressions update this property in place.
PopoverArrowEdge查看源码ref((node: NativeNode) => void) | NativeNode—
Declares ref (optional). Reactive JSX expressions update this property in place.
((node: NativeNode) => void) | NativeNode查看源码Popover.Trigger
查看源码Popover.Trigger(props: PopoverTriggerProps): NativeNoderenderJSX.Element—
Native SwiftUI component used as the trigger. This follows Base UI's composition shape: Trigger supplies behavior and `render` replaces its default element. The rendered component's own press handler runs before Trigger's behavior.
JSX.Element查看源码onPress(event: QuickGuiEvent) => void—
Called after the rendered component's own press handler and before the popover opens.
(event: QuickGuiEvent) => void查看源码ref(node: NativeNode) => void—
Receives the rendered trigger component rather than the internal structural slot.
(node: NativeNode) => void查看源码Popover.Content
查看源码Popover.Content(props: PopoverContentProps): NativeNode