Vue3 ColorPicker

Vue3 ColorPicker

·

2 min read

Vue ColorPicker is an input component to select a color. It supports Vue 3 with PrimeVue 3 and Vue 2 with PrimeVue 2.

Setup

Refer to PrimeVue setup documentation for download and installation steps for your environment such as Vue CLI, Vite or browser.

Import

import ColorPicker from 'primevue/colorpicker';

Getting Started

A model can be bound using the standard v-model directive. Default color format to use in value binding is "hex" and other possible values are "rgb" and "hsb".

<ColorPicker v-model="color" />
export default {
    data() {
        return {
            color: '1976D2'
        }
    }
}

Inline and Overlay

ColorPicker is displayed as an overlay with a preview option by default where second alternative is the inline mode.

<ColorPicker v-model="color" :inline="true" />

Theming

ColorPicker supports various themes featuring Material, Bootstrap, Fluent as well as your own custom themes via the Designer tool.

Resources

Visit the PrimeVue ColorPicker showcase for demos and documentation.