Skip to content

ColorSelect

A dropdown selector where each option displays a colored swatch alongside its label. Ideal for category or tag selection where color coding matters.

Usage

vue
<script setup>
import { ref } from 'vue'
import { ColorSelect } from 'praxis-vue-ui'

const statuses = [
  { id: 1, name: 'Active', color: '22c55e' },
  { id: 2, name: 'Pending', color: 'f59e0b' },
  { id: 3, name: 'Inactive', color: 'ef4444' },
]
const selected = ref(null)
</script>

<template>
  <ColorSelect
    v-model="selected"
    :options="statuses"
    label="Status"
  />
</template>

Props

PropTypeDefaultDescription
modelValueunknownnullSelected value. Use with v-model.
optionsrequiredobject[]Options with name and color (hex without #) properties.
labelstringundefinedField label.
placeholderstring'Select...'Dropdown placeholder.
disabledbooleanfalseDisables the select.
reduce(option) => unknownoption => option.idValue extractor.

Emits

EventPayloadDescription
update:modelValueunknownEmitted on selection change.

Built with VitePress