DioxusLabs / DioxusLabs/dioxus

Feature: Let Parents Modify & Typely Strict Their Children (with `Element<T>` or similar)

Open
#4,001 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

Sup boys!

This has been on my mind for a while but totally slipped my TODO list, classic. So while working on some Open Sass components like [`radio-rs`](https://github.com/opensass/radio-rs), I noticed there's no easy way for parent to programmatically modify their children and restrict their types.

Yew has this handy dandy [`ChildrenWithProps`](https://docs.rs/yew/latest/yew/html/type.ChildrenWithProps.html) type that lets you strictly type children *and* poke at their props, which is kinda powerful (and makes Yew feel a bit like it has superpowers over Dioxus in this specific area 😅).

It'd be amazing if you could get a `Element` or something similar in Dioxus that lets us:

- Strictly type children.
- Programmatically modify them from a parent component.

Right now, the only workaround I come up with is to [manually construct the Element](https://github.com/opensass/radio-rs/blob/afad83c6eddea4ffa6728125078ae557a76e6127/src/dioxus.rs#L62)… but then I couldn't get the browser to rerender it properly. I think it needs a portal or something similar, know what i mean?

So yeah, feature request: Kindly provide us with an easy way to strictly type and modify children elements!

Thanks!

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.