leptos_struct_table/components/
tbody.rs

1use leptos::html::{AnyElement, Tbody};
2use leptos::*;
3
4/// Default tbody renderer. Please note that this is **NOT** a `#[component]`.
5///
6/// # Arguments
7///
8/// * `content` - The content of the renderer. It's like the children of this view.
9/// * `class` - The class attribute that is passed to the root element
10/// * `node_ref` - The `NodeRef` referencing the root tbody element.
11///
12/// This render function has to render exactly one root element.
13#[allow(non_snake_case)]
14pub fn DefaultTableBodyRenderer(
15    content: Fragment,
16    class: Signal<String>,
17    node_ref: NodeRef<AnyElement>,
18) -> impl IntoView {
19    let tbody_ref = create_node_ref::<Tbody>();
20    tbody_ref.on_load(move |e| node_ref.load(&e.into_any()));
21
22    view! { <tbody class=class node_ref=tbody_ref>{content}</tbody> }
23}