Type Definition leptos::AttributeValue

source ·
pub type AttributeValue = Box<dyn IntoAttribute>;
Expand description

A type for taking anything that implements IntoAttribute.

use leptos::*;

#[component]
pub fn MyHeading(
    cx: Scope,
    text: String,
    #[prop(optional, into)] class: Option<AttributeValue>,
) -> impl IntoView {
    view! {
      cx,
      <h1 class=class>{text}</h1>
    }
}