Skip to content

Color Picker ​

Пикер цвета с панелью насыщенности, слайдером оттенка, слайдером прозрачности, полем ввода hex и предустановленными цветами.

#3b82f6
vue
<script setup>
import { ref } from 'vue'
const color = ref('#3b82f6')
</script>

<template>
  <VxColorPicker v-model="color" />
</template>

Without Input ​

vue
<template>
  <VxColorPicker v-model="color" :show-input="false" />
</template>

With Alpha ​

#3b82f680
#3b82f680
vue
<template>
  <VxColorPicker v-model="color" show-alpha />
</template>

Preset Colors ​

#ef4444
vue
<script setup>
const presets = ['#000000', '#ef4444', '#f97316', '#22c55e', '#3b82f6', '#8b5cf6', '#ec4899']
</script>

<template>
  <VxColorPicker v-model="color" :presets="presets" />
</template>

RGB Format ​

rgb(59, 130, 246)
#3b82f6
vue
<template>
  <VxColorPicker v-model="color" format="rgb" />
</template>

HSL Format ​

hsl(217, 91%, 60%)
#3b82f6
vue
<template>
  <VxColorPicker v-model="color" format="hsl" />
</template>

Sizes ​

#8b5cf6
#8b5cf6
#8b5cf6
vue
<template>
  <VxColorPicker size="sm" />
  <VxColorPicker />
  <VxColorPicker size="lg" />
</template>

Custom Trigger ​

Используйте triggerClass и triggerStyle, чтобы настроить высоту триггера, border-radius или любые другие стили.

#8b5cf6
#ef4444
#22c55e
vue
<template>
  <VxColorPicker :trigger-style="{ height: '48px', borderRadius: '24px' }" />
  <VxColorPicker :trigger-style="{ height: '40px', borderRadius: '0px' }" />
  <VxColorPicker trigger-class="my-custom-trigger" />
</template>

Disabled ​

#f97316
vue
<template>
  <VxColorPicker v-model="color" disabled />
</template>

Props ​

PropTypeDefaultDescription
modelValuestring'#000000'Значение цвета (v-model)
format'hex' | 'rgb' | 'hsl''hex'Формат вывода
disabledbooleanfalseОтключить пикер
showAlphabooleanfalseПоказывать слайдер альфа-канала
showInputbooleantrueПоказывать поле ввода hex
presetsstring[]—Образцы предустановленных цветов
size'sm' | 'default' | 'lg''default'Размер триггера
triggerClassstring | string[] | Record<string, boolean>''Кастомный CSS-класс для триггера
triggerStyleRecord<string, string>—Inline-стили триггера (height, borderRadius и т.д.)

Events ​

EventTypeDescription
update:modelValue(value: string) => voidЦвет изменён
change(value: string) => voidЦвет изменён