Yew
Dioxus
Leptos
Edit Component
cargo add coders --features yew
use coders::yew::{Code, Block, Header, Title, CopyTrigger, Content, LanguageBadge};
use coders::{Color, Language, Size, Variant};
use yew::prelude::*;
use coders::yew::Code;
use coders::{Color, Size, Variant};
use yew::prelude::*;
#[function_component(Example)]
pub fn example() -> Html {
html! {
<Code color={Color::Accent} variant={Variant::Subtle} size={Size::Sm}>
{"console.log(\"Hello, world!\")"}
</Code>
}
}
use coders::yew::{Block, Content, Header, Title, CopyTrigger};
use coders::Language;
use yew::prelude::*;
#[function_component(Example)]
pub fn example() -> Html {
html! {
<Block code="fn main() {\n println!(\"Hello, world!\");\n}" language={Language::Rust}>
<Header>
<Title>{"main.rs"}</Title>
<CopyTrigger />
</Header>
<Content />
</Block>
}
}
Prop Default Type Description
colorColor::DefaultColorColor palette applied to the component
variantVariant::SubtleVariantVisual style variant
sizeSize::SmSizeFont size and padding
class""&'static strAdditional CSS class names
style""&'static strInline CSS override
id""&'static strHTML id attribute
aria_label""&'static strAccessible label
data_testid""&'static strTest identifier
Prop Default Type Description
code- &'static strRaw code content (required)
languageLanguage::PlainLanguageLanguage hint for badge
class""&'static strAdditional CSS class names
style""&'static strInline CSS override
id""&'static strHTML id attribute
aria_label"Code block"&'static strAccessible region label
data_testid""&'static strTest identifier
Prop Default Type Description
copy_label"Copy"&'static strLabel before copying
copied_label"Copied!"&'static strLabel after copy
reset_ms2000u32Reset delay in milliseconds
aria_label"Copy code to clipboard"&'static strAccessible label
Default, Red, Orange, Yellow, Green, Teal, Blue, Cyan, Accent, Pink, Success, Warning, Danger
Solid, Subtle, Outline, Surface, Plain
Xs, Sm, Md, Lg, Custom(&'static str)
Plain, Rust, JavaScript, TypeScript, Python, Html, Css, Json, Bash, Toml, Sql, Go, Java, Cpp, C, Kotlin, Swift, Ruby, Php, Yaml, Custom(&'static str)
OneDark (default) , Dracula, NightOwl, GithubDark, GithubLight, Solarized, Monokai, Nord, Custom(ThemeColors)
You can import Code RS directly into your project to customize and modify it using the opensass cli :
os add coders yew
Edit Component
cargo add coders --features dio
use coders::dioxus::{Code, Block, Header, Title, CopyTrigger, Content, LanguageBadge};
use coders::{Color, Language, Size, Variant};
use dioxus::prelude::*;
use coders::dioxus::Code;
use coders::{Color, Size, Variant};
use dioxus::prelude::*;
fn Example() -> Element {
rsx! {
Code {
color: Color::Accent,
variant: Variant::Subtle,
size: Size::Sm,
"console.log()"
}
}
}
use coders::dioxus::{Block, Content, Header, Title, CopyTrigger};
use coders::Language;
use dioxus::prelude::*;
fn Example() -> Element {
rsx! {
Block {
code: "fn main() {{}}",
language: Language::Rust,
Header {
Title { "main.rs" }
CopyTrigger {}
}
Content {}
}
}
}
Prop Default Type Description
colorColor::DefaultColorColor palette applied to the component
variantVariant::SubtleVariantVisual style variant
sizeSize::SmSizeFont size and padding
class""&'static strAdditional CSS class names
style""&'static strInline CSS override
id""&'static strHTML id attribute
aria_label""&'static strAccessible label
data_testid""&'static strTest identifier
Prop Default Type Description
code- &'static strRaw code content (required)
languageLanguage::PlainLanguageLanguage hint for badge
class""&'static strAdditional CSS class names
style""&'static strInline CSS override
id""&'static strHTML id attribute
aria_label"Code block"&'static strAccessible region label
data_testid""&'static strTest identifier
Prop Default Type Description
copy_label"Copy"&'static strLabel before copying
copied_label"Copied!"&'static strLabel after copy
reset_ms2000u32Reset delay in milliseconds
aria_label"Copy code to clipboard"&'static strAccessible label
Default, Red, Orange, Yellow, Green, Teal, Blue, Cyan, Accent, Pink, Success, Warning, Danger
Solid, Subtle, Outline, Surface, Plain
Xs, Sm, Md, Lg, Custom(&'static str)
Plain, Rust, JavaScript, TypeScript, Python, Html, Css, Json, Bash, Toml, Sql, Go, Java, Cpp, C, Kotlin, Swift, Ruby, Php, Yaml, Custom(&'static str)
OneDark (default) , Dracula, NightOwl, GithubDark, GithubLight, Solarized, Monokai, Nord, Custom(ThemeColors)
You can import Code RS directly into your project to customize and modify it using the opensass cli :
os add coders dio
Edit Component
cargo add coders --features lep
use coders::leptos::{Code, Block, Header, Title, CopyTrigger, Content, LanguageBadge};
use coders::{Color, Language, Size, Variant};
use leptos::prelude::*;
use coders::leptos::Code;
use coders::{Color, Size, Variant};
use leptos::prelude::*;
#[component]
pub fn Example() -> impl IntoView {
view! {
<Code color=Color::Accent variant=Variant::Subtle size=Size::Sm>
"console.log(\"Hello, world!\")"
</Code>
}
}
use coders::leptos::{Block, Content, Header, Title, CopyTrigger};
use coders::Language;
use leptos::prelude::*;
#[component]
pub fn Example() -> impl IntoView {
view! {
<Block code="fn main() {\n println!(\"Hello, world!\");\n}" language={Language::Rust}>
<Header>
<Title>"main.rs"</Title>
<CopyTrigger />
</Header>
<Content />
</Block>
}
}
Prop Default Type Description
colorColor::DefaultColorColor palette applied to the component
variantVariant::SubtleVariantVisual style variant
sizeSize::SmSizeFont size and padding
class""&'static strAdditional CSS class names
style""&'static strInline CSS override
id""&'static strHTML id attribute
aria_label""&'static strAccessible label
data_testid""&'static strTest identifier
Prop Default Type Description
code- &'static strRaw code content (required)
languageLanguage::PlainLanguageLanguage hint for badge
class""&'static strAdditional CSS class names
style""&'static strInline CSS override
id""&'static strHTML id attribute
aria_label"Code block"&'static strAccessible region label
data_testid""&'static strTest identifier
Prop Default Type Description
copy_label"Copy"&'static strLabel before copying
copied_label"Copied!"&'static strLabel after copy
reset_ms2000u32Reset delay in milliseconds
aria_label"Copy code to clipboard"&'static strAccessible label
Default, Red, Orange, Yellow, Green, Teal, Blue, Cyan, Accent, Pink, Success, Warning, Danger
Solid, Subtle, Outline, Surface, Plain
Xs, Sm, Md, Lg, Custom(&'static str)
Plain, Rust, JavaScript, TypeScript, Python, Html, Css, Json, Bash, Toml, Sql, Go, Java, Cpp, C, Kotlin, Swift, Ruby, Php, Yaml, Custom(&'static str)
OneDark (default) , Dracula, NightOwl, GithubDark, GithubLight, Solarized, Monokai, Nord, Custom(ThemeColors)
You can import Code RS directly into your project to customize and modify it using the opensass cli :
os add coders lep