pub fn Script(props: ScriptProps) -> impl IntoView
Expand description
Injects an HTMLScriptElement
into the document
head, accepting any of the valid attributes for that tag.
use leptos::prelude::*;
use leptos_meta::*;
#[component]
fn MyApp() -> impl IntoView {
provide_meta_context();
view! {
<main>
<Script>
"console.log('Hello, world!');"
</Script>
</main>
}
}
§Optional Props
- id: [
impl Into<Oco<'static, str>>
](Oco<’static, str>)- An ID for the
<script>
tag.
- An ID for the
- async_: [
impl Into<Oco<'static, str>>
](Oco<’static, str>)- The
async
attribute.
- The
- crossorigin: [
impl Into<Oco<'static, str>>
](Oco<’static, str>)- The
crossorigin
attribute.
- The
- defer: [
impl Into<Oco<'static, str>>
](Oco<’static, str>)- The
defer
attribute.
- The
- fetchpriority: [
impl Into<Oco<'static, str>>
](Oco<’static, str>)- The
fetchpriority
attribute.
- The
- integrity: [
impl Into<Oco<'static, str>>
](Oco<’static, str>)- The
integrity
attribute.
- The
- nomodule: [
impl Into<Oco<'static, str>>
](Oco<’static, str>)- The
nomodule
attribute.
- The
- nonce: [
impl Into<Oco<'static, str>>
](Oco<’static, str>)- The
nonce
attribute.
- The
- referrerpolicy: [
impl Into<Oco<'static, str>>
](Oco<’static, str>)- The
referrerpolicy
attribute.
- The
- src: [
impl Into<Oco<'static, str>>
](Oco<’static, str>)- The
src
attribute.
- The
- type_: [
impl Into<Oco<'static, str>>
](Oco<’static, str>)- The
type
attribute.
- The
- blocking: [
impl Into<Oco<'static, str>>
](Oco<’static, str>)- The
blocking
attribute.
- The
- children:
Children
- The content of the
<script>
tag.
- The content of the