Skip to content

Commit

Permalink
Tweak example
Browse files Browse the repository at this point in the history
  • Loading branch information
lukechu10 committed Sep 13, 2024
1 parent ac5c262 commit fb315d5
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions examples/attributes-passthrough/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,14 @@ use sycamore::web::MaybeDynString;
pub struct CustomButtonProps {
#[prop(setter(into))]
id: MaybeDynString,
#[prop(attributes(html, input))]
#[prop(attributes(html, button))]
attributes: Attributes,
children: Children,
}

#[component]
fn CustomButton(mut props: CustomButtonProps) -> View {
console_log!("Intercepted id attribute: {}", props.id.get_clone());
console_log!("Intercepted `id` attribute: {}", props.id.get_clone());

let children = props.children.call();
view! {
Expand All @@ -32,12 +32,15 @@ fn App() -> View {
div {
CustomButton(
id="button1",
r#type="button",
on:click=|_| console_log!("Button 1 clicked!"),
) { "Button 1" }
CustomButton(
id="button2",
r#type="button",
class="red-button",
style="background-color:red;",
prop:disabled=true,
on:click=|_| console_log!("Button 2 clicked!"),
) { "Button 2" }
}
Expand Down

0 comments on commit fb315d5

Please sign in to comment.