Native colour input drawn as a round or square swatch.
Structure
| Class | Example |
|---|---|
| .mdst-input | |
|
.mdst-input type="color" .mdst-input type="text" |
|
Variants
| Class | Example |
|---|---|
| .mdst-input--square |
States
| Attribute | Example |
|---|---|
| disabled |
The class is optional inside .mdst-ui. A bare
<input type="color"> there gets the same styles, and
.mdst-input--square works without .mdst-input. To show the hex value, put a .mdst-input next to it and keep the two in sync with a few
lines of your own JavaScript.
Usage
<input type="color" class="mdst-input" value="#000000" />
<!-- Square, following --mdst-radius -->
<input type="color" class="mdst-input mdst-input--square" value="#F4E3C1" />
<!-- With the hex value beside it -->
<div style="display: flex; gap: 0.5rem; align-items: center">
<input type="color" class="mdst-input" value="#4A3F1F" />
<input type="text" class="mdst-input" value="#4A3F1F" style="width: 7rem" />
</div>