Skip to content

SColorPicker <s-color-picker>

ts
import { SColorPicker } from 'polaris-vue-elements'

Example

Value: #008060

vue
<script setup>
import { ref } from 'vue'
import { SColorPicker } from 'polaris-vue-elements'

const value = ref('#008060')
</script>

<template>
  <SColorPicker v-model="value" />
  <p>Value: {{ value }}</p>
</template>

v-model

v-model on <SColorPicker> binds to the value property and listens for the input DOM event.

template
<SColorPicker v-model="value" />

is equivalent to:

template
<SColorPicker :value="value" @input="value = $event.target.value" />

Props

PropTypeDescription
alphabooleanAllow user to select an alpha value.
defaultValuestringThe default value for the field.
idstringA unique identifier for the element.
namestringAn identifier for the field that is unique within the nearest containing form.
valuestringThe currently selected color. Supported formats include: - HSL

Events

EventType
changeCustomEvent
inputCustomEvent

Listen for these with @change-style listeners on <SColorPicker>.