Colour field
ColorField. It is copied into your app’s ui/ by qatjs add color: the code is yours to edit.
Example
Colour #0A66C2
import ColorField from './ui/color/color.qx'
export default function Example() {
let colour = state('#0A66C2')
return (
<ColorField label="Label colour" swatches={['#0A66C2', '#0F6E49', '#B22E36', '#8A4F00']} bind:value={colour} />
<p>Colour {colour}</p>
)
}colour stateAdd it
npx qatjs add colorColorField
As a custom element: <ui-color-field>.
| Prop | Type | Attribute |
|---|---|---|
label | QatNode | property only |
value | string | yes |
swatches | string[] | property only |
help | QatNode | property only |
error | QatNode | property only |
disabled | boolean | yes |
invalidText | string | yes |
pickLabel | string | yes |
| Event | Detail |
|---|---|
on:update:value | CustomEvent<string> |
Keys
| Key | Does |
|---|---|
| Tab | to each preset, a button (aria-pressed) |
| Enter | take a typed hex value |