DioxusLabs / DioxusLabs/dioxus

Support Ability To Extend Props From Other Props

Open
#3,938 2 comments 4 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

It'd be helpful to have the ability to extend from another component's props:

```rust
#[derive(Props, Clone, PartialEq)]
pub struct Comp1Props {
abc: bool,
disabled: bool,
}

// .. fn Comp1()

#[derive(Props, Clone, PartialEq)]
pub struct Comp2Props {
// extend prop attributes by specifying component fn or prop struct
#[props(extends = Comp1)]
attributes: Vec,
}

#[component]
pub fn Comp2(props: Comp2Props) -> Element {
rsx! {
Comp1 {
disabled: false, // add your own props as desired
..props.attributes, // spread any generic prop through components
}
}
}
```

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.