Skip to content

feat: support optionally setting attributes on components using toggle#218

Closed
dvaergiller wants to merge 1 commit into
vidhanio:mainfrom
dvaergiller:toggled-component-attributes
Closed

feat: support optionally setting attributes on components using toggle#218
dvaergiller wants to merge 1 commit into
vidhanio:mainfrom
dvaergiller:toggled-component-attributes

Conversation

@dvaergiller

@dvaergiller dvaergiller commented Jun 10, 2026

Copy link
Copy Markdown
Contributor

Allow name=[expr] toggle syntax for component attributes in both maud! and rsx!, mirroring the existing element-attribute toggle (e.g. a href=[None]). When the bracketed expression is None the member is left at its default; Some(v) sets it to v.

This lets a component user set optional attributes without checking each attribute and optionally setting them, and it makes the syntax for components a bit more aligned with regular hypertext tags (since regular tags already have this).

Allow `name=[expr]` toggle syntax for component attributes in both
`maud!` and `rsx!`, mirroring the existing element-attribute toggle
(e.g. `a href=[None]`). When the bracketed expression is `None` the
member is left at its default; `Some(v)` sets it to `v`.

This lets a component user set optionsl attributes without checking each
attribute and optionally setting them.
@dvaergiller

Copy link
Copy Markdown
Contributor Author

I think there might be a better solution to align component attributes to regular element attributes. Closing this for now.

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.

1 participant