Struct dmat_components::components::list::ListProps
source · pub struct ListProps<TitemsSignal: SignalVec<Item = Dom> = Always<Dom>, TApplyFn: FnOnce(DomBuilder<HtmlElement>) -> DomBuilder<HtmlElement> = fn(_: DomBuilder<HtmlElement>) -> DomBuilder<HtmlElement>> {
pub items: Option<TitemsSignal>,
pub apply: Option<TApplyFn>,
}
Expand description
Renders a list of items.
Examples
use dominator::html;
use futures_signals::signal_vec::{MutableVec, SignalVecExt};
use dmat_components::components::list;
use dmat_components::list;
use dmat_components::components::list::*;
// Static list, items never change
let my_static_list = list!({.rows([
html!("span", {.text("Hello")}),
html!("span", {.text("World")}),
])});
// Dynamic list, items change according to the content of the mutable vector
let my_items = MutableVec::new_with_values(vec!["Hello", "World"]);
let my_dynamic_list = list!({
.rows_signal_vec(my_items.signal_vec_cloned()
.map(|item| html!("span", { .text(item) })))
});
Fields§
§items: Option<TitemsSignal>
§apply: Option<TApplyFn>
Implementations§
source§impl<TitemsSignal: SignalVec<Item = Dom>, TApplyFn: FnOnce(DomBuilder<HtmlElement>) -> DomBuilder<HtmlElement>> ListProps<TitemsSignal, TApplyFn>
impl<TitemsSignal: SignalVec<Item = Dom>, TApplyFn: FnOnce(DomBuilder<HtmlElement>) -> DomBuilder<HtmlElement>> ListProps<TitemsSignal, TApplyFn>
sourcepub fn items(self, v: impl Into<Vec<Dom>>) -> ListProps<Always<Dom>, TApplyFn>
pub fn items(self, v: impl Into<Vec<Dom>>) -> ListProps<Always<Dom>, TApplyFn>
The list of items to render.
Each item is wrapped in a <li>
element by the list component.
sourcepub fn items_signal_vec<TitemsSignalNew: SignalVec<Item = Dom>>(
self,
v: TitemsSignalNew
) -> ListProps<TitemsSignalNew, TApplyFn>
pub fn items_signal_vec<TitemsSignalNew: SignalVec<Item = Dom>>( self, v: TitemsSignalNew ) -> ListProps<TitemsSignalNew, TApplyFn>
The list of items to render.
Each item is wrapped in a <li>
element by the list component.
source§impl<TitemsSignal: SignalVec<Item = Dom>, TApplyFn: FnOnce(DomBuilder<HtmlElement>) -> DomBuilder<HtmlElement>> ListProps<TitemsSignal, TApplyFn>
impl<TitemsSignal: SignalVec<Item = Dom>, TApplyFn: FnOnce(DomBuilder<HtmlElement>) -> DomBuilder<HtmlElement>> ListProps<TitemsSignal, TApplyFn>
pub fn apply<TApplyFnNew: FnOnce(DomBuilder<HtmlElement>) -> DomBuilder<HtmlElement>>( self, v: TApplyFnNew ) -> ListProps<TitemsSignal, TApplyFnNew>
Trait Implementations§
source§impl<TitemsSignal: SignalVec<Item = Dom>, TApplyFn: FnOnce(DomBuilder<HtmlElement>) -> DomBuilder<HtmlElement>> ListPropsTrait for ListProps<TitemsSignal, TApplyFn>
impl<TitemsSignal: SignalVec<Item = Dom>, TApplyFn: FnOnce(DomBuilder<HtmlElement>) -> DomBuilder<HtmlElement>> ListPropsTrait for ListProps<TitemsSignal, TApplyFn>
Auto Trait Implementations§
impl<TitemsSignal, TApplyFn> RefUnwindSafe for ListProps<TitemsSignal, TApplyFn>where TApplyFn: RefUnwindSafe, TitemsSignal: RefUnwindSafe,
impl<TitemsSignal, TApplyFn> Send for ListProps<TitemsSignal, TApplyFn>where TApplyFn: Send, TitemsSignal: Send,
impl<TitemsSignal, TApplyFn> Sync for ListProps<TitemsSignal, TApplyFn>where TApplyFn: Sync, TitemsSignal: Sync,
impl<TitemsSignal, TApplyFn> Unpin for ListProps<TitemsSignal, TApplyFn>where TApplyFn: Unpin, TitemsSignal: Unpin,
impl<TitemsSignal, TApplyFn> UnwindSafe for ListProps<TitemsSignal, TApplyFn>where TApplyFn: UnwindSafe, TitemsSignal: UnwindSafe,
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more