DioxusLabs / DioxusLabs/dioxus

Event Handler Parameters

Open
#1,462 3 comments 0 reactions 0 assignees View on GitHub
enhancement html
Dominant language
Rust
Stars
39.1k
Forks
1.9k
Avg merge
4d 10h
Merged PRs (30d)
4

Description

## Specific Demand

Some events require metadata in addition to the event callback. One example of this is the [intersection observer](https://developer.mozilla.org/en-US/docs/Web/API/Intersection_Observer_API). Currently there is no system to create events in dioxus that take parameters.

## Implement Suggestion

We can add parameters for event handlers:
```rust
div {
// I think this one looks nicer
onvisible(60): move |_| todo!(),
onvisible[60]: move |_| todo!(),
// This may be more clear if the event handler accepts multiple parameters
onvisible.precent(60): move |_| todo!(),
}
```

```rust
YourComponent {
// I think this one looks nicer
onpointscored(60): move |_| todo!(),
}
```

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.