DioxusLabs / DioxusLabs/dioxus

Get value from ToggleData event

Open Beginner friendly
#5,666 0 comments 0 reactions 0 assignees View on GitHub
enhancement
Dominant language
Rust
Stars
39.1k
Forks
1.9k
Avg merge
4d 10h
Merged PRs (30d)
4

Description

## Feature Request

The `details` HTML element triggers a `toggle` event whenever it is opened or closed. However, one doesn't know what happened in the `ontoggle` event listener.

```rust
use dioxus::prelude::*;

#[component]
pub fn ToggleMe() -> Element {
rsx! {
details {
ontoggle: move |event| {
// now what?
},

summary {
"Open me"
}
" simple text"
}
}
}

```

## Implement Suggestion

It would be nice to have a function `.is_open()`, akin to the `.checked()` function on the input element's event.

Contributor guide

No contributing guide indexed for this repository

Research direction

Start at the ToggleData event entry point and compare its API with the existing checked() function on input events. Add a way for the ontoggle listener to determine whether details is open, and verify that the event exposes the expected state.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
frontend
Issue type
Feature
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
65/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.