Struct silkenweb::ElementBuilder[][src]

pub struct ElementBuilder { /* fields omitted */ }

Build an HTML element.

Implementations

impl ElementBuilder[src]

pub fn new(tag: impl AsRef<str>) -> ElementBuilder[src]

pub fn attribute<T>(
    self,
    name: impl AsRef<str>,
    value: impl AttributeValue<T>
) -> ElementBuilder
[src]

Set an attribute. Attribute values can be reactive.

pub fn child(self, child: impl Into<Element>) -> ElementBuilder[src]

Add a child element after existing children. The child element can be reactive.

pub fn text(self, child: impl Text) -> ElementBuilder[src]

Add a text node after existing children. The text node can be reactive.

pub fn effect<T>(self, child: impl Effect<T>) -> ElementBuilder[src]

Apply an effect after the next render. For example, to set the focus of an element:

element.effect(|elem: &HtmlInputElement| elem.focus().unwrap());

Effects can be reactive. For example, to set the visibibilty of an item based on a hidden boolean signal:

let hidden = Signal::new(false);
let is_hidden = hidden.read();

element.effect(is_hidden.map(|&hidden| move |elem: &HtmlInputElement| elem.set_hidden(hidden)));

pub fn on(
    self,
    name: &'static str,
    f: impl FnMut(JsValue) + 'static
) -> ElementBuilder
[src]

Register an event handler.

name is the name of the event. See the MDN Events page for a list.

f is the callback when the event fires and will be passed the javascript Event object.

Trait Implementations

impl Builder for ElementBuilder[src]

type Target = Element

impl DomElement for ElementBuilder[src]

impl From<ABuilder> for ElementBuilder[src]

impl From<AbbrBuilder> for ElementBuilder[src]

impl From<AddressBuilder> for ElementBuilder[src]

impl From<AreaBuilder> for ElementBuilder[src]

impl From<ArticleBuilder> for ElementBuilder[src]

impl From<AsideBuilder> for ElementBuilder[src]

impl From<AudioBuilder> for ElementBuilder[src]

impl From<BBuilder> for ElementBuilder[src]

impl From<BaseBuilder> for ElementBuilder[src]

impl From<BdiBuilder> for ElementBuilder[src]

impl From<BdoBuilder> for ElementBuilder[src]

impl From<BlockquoteBuilder> for ElementBuilder[src]

impl From<BrBuilder> for ElementBuilder[src]

impl From<ButtonBuilder> for ElementBuilder[src]

impl From<CanvasBuilder> for ElementBuilder[src]

impl From<CaptionBuilder> for ElementBuilder[src]

impl From<CiteBuilder> for ElementBuilder[src]

impl From<CodeBuilder> for ElementBuilder[src]

impl From<ColBuilder> for ElementBuilder[src]

impl From<ColgroupBuilder> for ElementBuilder[src]

impl From<DataBuilder> for ElementBuilder[src]

impl From<DatalistBuilder> for ElementBuilder[src]

impl From<DdBuilder> for ElementBuilder[src]

impl From<DelBuilder> for ElementBuilder[src]

impl From<DetailsBuilder> for ElementBuilder[src]

impl From<DfnBuilder> for ElementBuilder[src]

impl From<DialogBuilder> for ElementBuilder[src]

impl From<DivBuilder> for ElementBuilder[src]

impl From<DlBuilder> for ElementBuilder[src]

impl From<DtBuilder> for ElementBuilder[src]

impl From<ElementBuilder> for Element[src]

impl From<EmBuilder> for ElementBuilder[src]

impl From<EmbedBuilder> for ElementBuilder[src]

impl From<FieldsetBuilder> for ElementBuilder[src]

impl From<FigcaptionBuilder> for ElementBuilder[src]

impl From<FigureBuilder> for ElementBuilder[src]

impl From<FooterBuilder> for ElementBuilder[src]

impl From<FormBuilder> for ElementBuilder[src]

impl From<H1Builder> for ElementBuilder[src]

impl From<H2Builder> for ElementBuilder[src]

impl From<H3Builder> for ElementBuilder[src]

impl From<H4Builder> for ElementBuilder[src]

impl From<H5Builder> for ElementBuilder[src]

impl From<H6Builder> for ElementBuilder[src]

impl From<HeadBuilder> for ElementBuilder[src]

impl From<HeaderBuilder> for ElementBuilder[src]

impl From<HgroupBuilder> for ElementBuilder[src]

impl From<HrBuilder> for ElementBuilder[src]

impl From<IBuilder> for ElementBuilder[src]

impl From<IframeBuilder> for ElementBuilder[src]

impl From<ImgBuilder> for ElementBuilder[src]

impl From<InputBuilder> for ElementBuilder[src]

impl From<InsBuilder> for ElementBuilder[src]

impl From<KbdBuilder> for ElementBuilder[src]

impl From<LabelBuilder> for ElementBuilder[src]

impl From<LegendBuilder> for ElementBuilder[src]

impl From<LiBuilder> for ElementBuilder[src]

impl From<LinkBuilder> for ElementBuilder[src]

impl From<MainBuilder> for ElementBuilder[src]

impl From<MapBuilder> for ElementBuilder[src]

impl From<MarkBuilder> for ElementBuilder[src]

impl From<MenuBuilder> for ElementBuilder[src]

impl From<MetaBuilder> for ElementBuilder[src]

impl From<MeterBuilder> for ElementBuilder[src]

impl From<NavBuilder> for ElementBuilder[src]

impl From<NoscriptBuilder> for ElementBuilder[src]

impl From<ObjectBuilder> for ElementBuilder[src]

impl From<OlBuilder> for ElementBuilder[src]

impl From<OptgroupBuilder> for ElementBuilder[src]

impl From<OptionBuilder> for ElementBuilder[src]

impl From<OutputBuilder> for ElementBuilder[src]

impl From<PBuilder> for ElementBuilder[src]

impl From<ParamBuilder> for ElementBuilder[src]

impl From<PictureBuilder> for ElementBuilder[src]

impl From<PreBuilder> for ElementBuilder[src]

impl From<ProgressBuilder> for ElementBuilder[src]

impl From<QBuilder> for ElementBuilder[src]

impl From<RbBuilder> for ElementBuilder[src]

impl From<RpBuilder> for ElementBuilder[src]

impl From<RtBuilder> for ElementBuilder[src]

impl From<RtcBuilder> for ElementBuilder[src]

impl From<RubyBuilder> for ElementBuilder[src]

impl From<SBuilder> for ElementBuilder[src]

impl From<SampBuilder> for ElementBuilder[src]

impl From<ScriptBuilder> for ElementBuilder[src]

impl From<SectionBuilder> for ElementBuilder[src]

impl From<SelectBuilder> for ElementBuilder[src]

impl From<SmallBuilder> for ElementBuilder[src]

impl From<SourceBuilder> for ElementBuilder[src]

impl From<SpanBuilder> for ElementBuilder[src]

impl From<StrongBuilder> for ElementBuilder[src]

impl From<StyleBuilder> for ElementBuilder[src]

impl From<SubBuilder> for ElementBuilder[src]

impl From<SummaryBuilder> for ElementBuilder[src]

impl From<SupBuilder> for ElementBuilder[src]

impl From<TableBuilder> for ElementBuilder[src]

impl From<TbodyBuilder> for ElementBuilder[src]

impl From<TdBuilder> for ElementBuilder[src]

impl From<TextareaBuilder> for ElementBuilder[src]

impl From<TfootBuilder> for ElementBuilder[src]

impl From<ThBuilder> for ElementBuilder[src]

impl From<TheadBuilder> for ElementBuilder[src]

impl From<TimeBuilder> for ElementBuilder[src]

impl From<TitleBuilder> for ElementBuilder[src]

impl From<TrBuilder> for ElementBuilder[src]

impl From<TrackBuilder> for ElementBuilder[src]

impl From<UBuilder> for ElementBuilder[src]

impl From<UlBuilder> for ElementBuilder[src]

impl From<VarBuilder> for ElementBuilder[src]

impl From<VideoBuilder> for ElementBuilder[src]

impl From<WbrBuilder> for ElementBuilder[src]

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.