-
So I'm hesitant to post this as a GitHub issue as I'm not sure if this is a Leptos issue or skill issue. Anyways. #[component]
fn App() -> impl IntoView {
let tile_active = create_rw_signal(false);
// val.state: RwSignal<bool>
view! {
<For
children = move |mut val| {
view! {
<footer>
<span
role="button"
class:secondary = move || val.state.get()
disabled = move || tile_active.get() && !val.state.get() // HERE
// prop:disabled = move || tile_active.get() && !val.state.get() // has unexpected behaviour
on:click = move |_| {
val.toggle_timer();
tile_active.update(|n| *n = !*n);
log::info!("Time: {}", val.secs_on());
}>
{move || if val.state.get() {"Stop"} else {"Start"}}
</span>
</footer>
}
}
/>
} So here, the resulting HTML, when the signal is true, is |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 5 replies
-
I'm not quite sure what styling changes you're expecting to see when setting the P.S. |
Beta Was this translation helpful? Give feedback.
By "appears in the HTML" do you mean "appears in HTML rendered by the server" or "appears in the browser's devtools representation of the DOM, which they format like HTML"? These are not the same thing. I meant that
prop:
does not appear in HTML rendered by the server, because it only exists in the browser. I don't know when/why different browser devtools choose to represent DOM properties as HTML attributes in their DOM inspectors. The relationship between HTML attributes and DOM properties is somewhat complicated for historical reasons. Here's a good overview.disabled=
will always set an attribute nameddisabled
on an HTML elementprop:disabled=
will always set a DOM property nameddis…