Skip to content

Allow props to be set via CSS properties when not set explicitly on an element #45

@LeaVerou

Description

@LeaVerou

This would enable components to have their cake and eat it too: Use presentational attributes (which can be convenient in certain frameworks) that can also be set as a result of CSS interaction, media queries, or even have different defaults depending on certain classes.

This would be a new mixin and depends on style-observer. For NudeElement, perhaps it could be a prop setting, so that props opt in to it.

Ideally, CSS properties would also be able to override attributes when using !important, but that could end up being too slow, as the computed style would have to be looked at regardless of whether the prop is set on the element, whereas otherwise it would only need to be looked at when a prop is not set.

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions