Conditional Rendering
Lui.If
Conditional rendering:
Lui.If(showPanel.Value,
() => Lui.Div("p-4 bg-slate-800", Lui.Text("Visible")),
() => Lui.Div("hidden")
)When false and no else branch is provided, LUI renders a hidden placeholder to keep unkeyed sibling indices stable.
Lui.ForEach
List rendering:
Lui.ForEach(items.Value, item =>
Lui.Div("p-3 bg-slate-800",
Lui.Text(item.Name)
).Key(item.Id)
)Always key list items when possible.
Overloads:
Lui.ForEach<T>(IEnumerable<T> items, Func<T, LuiNode> render)
Lui.ForEach<T>(IEnumerable<T> items, Func<T, int, LuiNode> render)Last updated on