Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

components as props #2124

Merged
merged 4 commits into from
Nov 3, 2023
Merged

components as props #2124

merged 4 commits into from
Nov 3, 2023

Conversation

Lendemor
Copy link
Collaborator

@Lendemor Lendemor commented Nov 3, 2023

Proper feature to use components as props based on #2017

Auto detect props annotated with type Optional[Component]

Automatically add the imports required for the component prop to work.

Does NOT work with state Var, only compilation time component props are valid.

As example, see the changes in iconbutton.py : This is all that is needed to have components as props.

masenf
masenf previously approved these changes Nov 3, 2023
reflex/components/component.py Outdated Show resolved Hide resolved
masenf
masenf previously approved these changes Nov 3, 2023
Copy link
Contributor

@picklelo picklelo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code looks good - can we just add some docstrings for the new methods

reflex/components/component.py Show resolved Hide resolved
@picklelo picklelo merged commit eb52edb into main Nov 3, 2023
37 checks passed
@masenf masenf deleted the lendemor/components_as_props branch December 6, 2023 22:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants