color-js / color-js/elements

`color` vs `value` attribute

Open
#73 5 comments 0 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
30
Forks
4
PR merge metrics
No merged PRs in 30d

Description

When rewriting ``, I opted for a `color` attribute. However, I’m not so sure it was a good idea. `value` is far more common across HTML elements, and there are libraries and frameworks that work out of the box with elements that follow the convention of `.value` property + `input` event for user-initiated changes (e.g. Vue’s `v-model`). Also, `color` is a `Color`, so conceptually since the attribute is specifying a string, `value` seems more fitting.

So what about:
- `value` attribute, which gets reflected into a `value` property
- `color` property that contains a `Color` instance if `this.value` is a valid color, or `null` otherwise.

This would be across all components whose value is a color (``, ``, ``).

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.