-
Notifications
You must be signed in to change notification settings - Fork 24
Allow passing multiple attrs args into components #117
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
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
very nice, thanks!
can you also add:
- a note about this change in the changelog?
- an example of using multiple dicts to the usage docs?
once starfederation/datastar#902 is merged, feel free to submit a PR which links to it from the docs. I think it is a great example of using a custom helper to create specific attributes for a library. I am thinking about doing something similar for htmx and alpine.js. we could potentially add htpy-htmx, htpy-alpinejs etc projects with just helpers that create useful dicts of attributes.
Someone else was running into similar problems: https://www.reddit.com/r/htmx/comments/1kantse/comment/mpxh5jv/ I really think we need to improve the docs here :) |
Okay, fixed up that list call and added a tiny bit of docs.
I didn't quite get their need, unless they were over complicating it. Was it just working around not being able to pass in multiple attribute dicts? |
b70ab00
to
5e46be7
Compare
Yes I think it looks a bit over complicated. Being able to pass multiple dicts of attributes seems like an easy way to combine them and your docs example show how. Hopefully we can get a community going of helpers that generate attribute dicts that can then be combined :) |
Allows passing more than one dict of arguments into an element. Can be useful if you have a helper function that generates a single attribute. This would let you use that helper more than once on the same element.
Also simplified to only use 2 overloads for typing
BaseElement.__init__