Struct leptos_meta::BodyProps
source · pub struct BodyProps {
pub class: Option<TextProp>,
pub attributes: Vec<(&'static str, Attribute)>,
}
Expand description
Props for the Body
component.
A component to set metadata on the document’s <body>
element from
within the application.
use leptos::*;
use leptos_meta::*;
#[component]
fn MyApp() -> impl IntoView {
provide_meta_context();
let (prefers_dark, set_prefers_dark) = create_signal(false);
let body_class = move || {
if prefers_dark.get() {
"dark".to_string()
} else {
"light".to_string()
}
};
view! {
<main>
<Body class=body_class attr:class="foo"/>
</main>
}
}
§Required Props
- attributes: [
Vec<(&'static str, Attribute)>
]- Arbitrary attributes to add to the
<body>
- Arbitrary attributes to add to the
§Optional Props
- class:
impl Into<TextProp>
- The
class
attribute on the<body>
.
- The
Fields§
§class: Option<TextProp>
The class
attribute on the <body>
.
attributes: Vec<(&'static str, Attribute)>
Arbitrary attributes to add to the <body>
Implementations§
Trait Implementations§
Auto Trait Implementations§
impl Freeze for BodyProps
impl !RefUnwindSafe for BodyProps
impl !Send for BodyProps
impl !Sync for BodyProps
impl Unpin for BodyProps
impl !UnwindSafe for BodyProps
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