pub struct BodyProps {}
Expand description
Props for the Body
component.
A component to set metadata on the document’s <body>
element from
within the application.
This component takes no props, but can take any number of spread attributes
following the {..}
operator.
use leptos::prelude::*;
use leptos_meta::*;
#[component]
fn MyApp() -> impl IntoView {
provide_meta_context();
let (prefers_dark, set_prefers_dark) = signal(false);
let body_class = move || {
if prefers_dark.get() {
"dark".to_string()
} else {
"light".to_string()
}
};
view! {
<main>
<Body {..} class=body_class id="body"/>
</main>
}
}
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
source§impl<T> IntoEither for T
impl<T> IntoEither for T
source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moresource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moresource§impl<T> StorageAccess<T> for T
impl<T> StorageAccess<T> for T
source§fn as_borrowed(&self) -> &T
fn as_borrowed(&self) -> &T
Borrows the value.
source§fn into_taken(self) -> T
fn into_taken(self) -> T
Takes the value.