Form
InputColor
A text box for a colour: the swatch opens the picker, the hex is typed, and empty is null.
WAI-ARIA testedNew in 0.2.17
Import
main.ts
import { InputColor } from '@vitral/vue';Basic
Six digits take as they are typed; a short #rgb when the box is left. ArrowDown opens the picker, Escape comes back to the box.
Value: #2f5597
Swatches
A palette under the picker, for the colours a value usually comes from.
Sizes and states
API
Read from packages/vue/src/components/InputColor/types.ts, so it says what the component actually accepts.
Props
| Name | Type | Description |
|---|---|---|
| alpha | boolean | Offer an opacity slider; the value then carries it as eight hex digits (`'#33669980'`). Off by default: the value is `'#rrggbb'`. |
| defaultColor | string | The colour the panel starts on while the value is empty. Defaults to `'#ff0000'`. |
| swatches | string[] | Colours offered under the picker, one press each: the palette the value usually comes from. |
| clearable | boolean | Shows a button that empties the field while it holds a colour. |
| placeholder | string | — |
| size | Size | — |
| variant | InputVariant | Defaults to the plugin's `inputVariant`. |
| invalid | boolean | — |
| disabled | boolean | — |
| readonly | boolean | — |
| fluid | boolean | — |
| placement | OverlayPlacement | — |
| appendTo | string | `'body'` (the default), `'self'` to render in place, or a selector. |
Plus pt, dt and unstyled from BaseProps, see pass-through and unstyled mode.
Emits
| Event | Payload | Description |
|---|---|---|
| focus | event: FocusEvent | — |
| blur | event: FocusEvent | — |
| clear | — | — |
| show | — | — |
| hide | — | — |