pub fn layout_primitive() -> LayoutPrimitiveBuilderExpand description
§layout_primitive
Attach a layout policy, render policy, modifier chain, and optional child slot to the current component node.
§Usage
Build framework or internal components that need to define custom node layout and rendering behavior.
§Parameters
layout_policy- pure layout policy used for measuring and placing the current noderender_policy- render policy used to record draw and compute commands for the current nodemodifier- node-local modifier chain attached before child content is emittedchild- optional child slot rendered as this node’s content subtree
§Examples
use tessera_ui::{
Modifier, NoopRenderPolicy, RenderSlot,
layout::{DefaultLayoutPolicy, layout_primitive},
};
#[tessera_ui::tessera]
fn primitive_example(modifier: Modifier, child: RenderSlot) {
layout_primitive()
.layout_policy(DefaultLayoutPolicy)
.render_policy(NoopRenderPolicy)
.modifier(modifier)
.child(move || child.render());
}