leptos_struct_table/components/cell/mod.rs
1#![allow(unused_variables)]
2
3use crate::CellValue;
4
5use leptos::*;
6
7/// The default cell renderer. Uses the `<td>` element.
8#[component]
9pub fn DefaultTableCellRenderer<T, F>(
10 /// The class attribute for the cell element. Generated by the classes provider.
11 class: String,
12 /// The value to display.
13 #[prop(into)]
14 value: MaybeSignal<T>,
15 /// Event handler called when the cell is changed. In this default renderer this will never happen.
16 on_change: F,
17 /// The index of the column. Starts at 0.
18 index: usize,
19 options: T::RenderOptions,
20) -> impl IntoView
21where
22 T: CellValue + Clone + 'static,
23 F: Fn(T) + 'static,
24{
25 view! {
26 <td class=class>{value.get().render_value(&options)}</td>
27 }
28}