qat

Colour field

ColorField. It is copied into your app’s ui/ by qatjs add color: the code is yours to edit.

Example

Colour #0A66C2

Example.qx9 lines, 1 reactive nameOpen in the playground
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 state

Add it

shell1 line
npx qatjs add color

ColorField

As a custom element: <ui-color-field>.

ColorField: props
PropTypeAttribute
labelQatNodeproperty only
valuestringyes
swatchesstring[]property only
helpQatNodeproperty only
errorQatNodeproperty only
disabledbooleanyes
invalidTextstringyes
pickLabelstringyes
ColorField: events
EventDetail
on:update:valueCustomEvent<string>

Keys

KeyDoes
Tabto each preset, a button (aria-pressed)
Entertake a typed hex value