struct
Props
pub struct Props {
/* private fields */
}The attributes and event handlers a parent passes to a component. Reads are reactive, so derived values update when the parent re-renders.
Methods
new
pub fn new(values: BTreeMap<String, Value>) -> PropsProps holding values, with no event handlers yet and a fresh id.
provide
pub fn provide<T: 'static>(&self, key: &str, value: T)Provide value under key to every component rendered inside this one — including slot content written by the caller. Call it in setup; share state by providing signals (or a struct of them).
context
pub fn context<T: Clone + 'static>(&self, key: &str) -> Option<T>The nearest ancestor's value for key, if it has the type T.
handler_names
pub fn handler_names(&self) -> Vec<String>Names of the event handlers the parent passed (@name: …).
id
pub fn id(&self) -> StringA document-unique id for this component instance — use it to build id/aria-controls/aria-labelledby references.
get
pub fn get(&self, name: &str) -> Option<Value>The value of prop name, if the parent passed it. Reading it inside an effect or computed value subscribes to it.
num
pub fn num(&self, name: &str) -> Option<f64>Prop name as a number (numeric text counts), if it is one.
emit
pub fn emit(&self, name: &str, event: &Event) -> boolInvoke the parent's handler for name (from @name: handler).
emitter
pub fn emitter(&self) -> EmitterA handle that can emit this component's events later — it holds only the handlers, so storing it in shared context makes no cycles.
set_values
pub fn set_values(&self, values: BTreeMap<String, Value>) -> boolReplace the values; returns whether anything changed.
set_handlers
pub fn set_handlers(&self, handlers: Vec<(String, Handler)>)Replace the parent's event handlers (@name: …), by event name.