Skip to content

Conversation

Dresdn
Copy link
Contributor

@Dresdn Dresdn commented Apr 16, 2025

My attempt at merging attrs. Let me know if this is what you had envisioned for #189

Can update the docs too as this opens up some powerful use cases, including fully supporting Widget Attributes.

@wrabit
Copy link
Owner

wrabit commented Apr 17, 2025

Hi @Dresdn thanks for the PR. Will this also work for the case we just want to proxy the {{ attrs }} down to another component, i.e. :attrs="attrs"?

@Dresdn
Copy link
Contributor Author

Dresdn commented Apr 17, 2025

Yep! I saw somewhere (issue or discussion) you mentioned {{ atts }} just returns a dict, so works the same way. I did test this, but can add a test to the suite if it helps.

@wrabit
Copy link
Owner

wrabit commented Apr 17, 2025

@Dresdn great, an additional test for that would be good if you don't mind ensuring it covers multiple attribute types (string, dynamic, boolean, dynamic component (:is)

@cadolphs
Copy link

👍 for this PR. Let me know if there's any way I can help. Super excited both for the merging and for the passing down.

My current use-case example: Have a base.html version of a UI element and then different variations of it, all of which should pass their attrs to the base as needed.

@wrabit
Copy link
Owner

wrabit commented Apr 22, 2025

@Dresdn thanks for the work on this. Would you mind drafting document changes as you see it?

@Dresdn
Copy link
Contributor Author

Dresdn commented Apr 27, 2025

@wrabit - let me know what you think about the docs changes.

I added a Components - 5.1 section under {{ attrs }} as it seemed to make sense to explain what the "special dynamic attribute :attrs" does. Additionally, I added a new Usage Patterns example and was originally going to use a whole Form Widget to <input /> example, decided just to stick a generic "higher order component" language to keep it a little agnostic.

@wrabit wrabit merged commit 6cec1c6 into wrabit:main Apr 29, 2025
14 checks passed
@wrabit
Copy link
Owner

wrabit commented Apr 29, 2025

Looks good. I will merge the docs build fix and add a note about :attrs="attrs" use case also, thanks for the PR!

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