Struct leptos_meta::BodyProps
source · pub struct BodyProps {
pub class: Option<TextProp>,
pub attributes: Option<MaybeSignal<AdditionalAttributes>>,
}
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(cx: Scope) -> impl IntoView {
provide_meta_context(cx);
let (prefers_dark, set_prefers_dark) = create_signal(cx, false);
let body_class = move || {
if prefers_dark.get() {
"dark".to_string()
} else {
"light".to_string()
}
};
view! { cx,
<main>
<Body class=body_class/>
</main>
}
}
Required Props
- cx: [
Scope
]
Optional Props
- class:
impl Into<TextProp>
- The
class
attribute on the<body>
.
- The
- attributes:
impl Into<MaybeSignal<AdditionalAttributes>>
- Arbitrary attributes to add to the
<html>
- Arbitrary attributes to add to the
Fields§
§class: Option<TextProp>
The class
attribute on the <body>
.
attributes: Option<MaybeSignal<AdditionalAttributes>>
Arbitrary attributes to add to the <html>
Implementations§
Trait Implementations§
Auto Trait Implementations§
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