MCPcopy Create free account
hub / github.com/DioxusLabs/dioxus-components / PopoverRoot

Function PopoverRoot

primitives/src/popover.rs:104–127  ·  view source on GitHub ↗
(props: PopoverRootProps)

Source from the content-addressed store, hash-verified

102/// - `data-state`: Indicates if the popover is open or closed. Values are `open` or `closed`.
103#[component]
104pub fn PopoverRoot(props: PopoverRootProps) -> Element {
105 let labelledby = use_unique_id();
106 let gen_root_id = use_unique_id();
107 let root_id = use_id_or(gen_root_id, props.id);
108
109 let (open, set_open) = use_controlled(props.open, props.default_open, props.on_open_change);
110
111 use_context_provider(|| PopoverCtx {
112 open,
113 set_open,
114 is_modal: props.is_modal,
115 labelledby,
116 root_id,
117 });
118
119 rsx! {
120 div {
121 id: root_id,
122 "data-state": if open() { "open" } else { "closed" },
123 ..props.attributes,
124 {props.children}
125 }
126 }
127}
128
129/// The props for the [`PopoverContent`] component.
130#[derive(Props, Clone, PartialEq)]

Callers

nothing calls this directly

Calls 3

use_unique_idFunction · 0.85
use_id_orFunction · 0.85
use_controlledFunction · 0.85

Tested by

no test coverage detected