UI LibraryUI Library
Guide
Components
Styling
Repo
Guide
Components
Styling
Repo
  • Guide

    • Introduction
    • Getting Started
  • Components

    • CataUiAccordion
    • CataUiAccordionItem
    • CataUiAlert
    • CataUiAnchorMenu
    • CataUiBadge
    • CataUiButton
    • CataUiCollapse
    • CataUiDraggable
    • CataUiDropdown
    • CataUiDropover
    • CataUiFileTree
    • CataUiIcon
    • CataUiIconSwitch
    • CataUiInput
    • CataUiInputCheckbox
    • CataUiInputColor
    • CataUiInputDate
    • CataUiInputGroup
    • CataUiInputRadio
    • CataUiInputSearch
    • CataUiInputSelect
    • CataUiMasonry
    • CataUiMasonryTile
    • CataUiLogo
    • CataUiModal
    • CataUiPaginate
    • CataUiProgress
    • CataUiSpinner
    • CataUiStatusLabel
    • CataUiSwitch
    • CataUiTable
    • CataUiTableAG
    • CataUiTableFooter
    • CataUiTabs
    • CataUiTabSwitch
    • CataUiTooltip
  • Styling

    • Colors
    • Icons
    • Typography
    • Utils

CataUiInputSelect

A customizable select dropdown component that supports single and multiple selection, color/image previews, search functionality, and more.

Colors
Select
Multi
<CataUiInputSelect label="Colors" :options="optionsColor" v-model="color" />
<CataUiInputSelect tooltip="Tooltip" label="Select" :options="options" v-model="myValue" />
<CataUiInputSelect label="Multi" multipleSelect selectAllEnabled :options="options" v-model="multi" />

Props

PropDescriptionTypeDefaultRequired
allowEmptyAllows deselection in single select modeBooleantruefalse
disabledDisables the dropdown and its itemsBooleanfalsefalse
errorDisplays the string as an error messageString''false
labelThe text label displayed above the inputString''false
loadingShows a loading spinner when options are being loadedBooleanfalsefalse
multipleSelectEnables multiple selection (v-model must be array)Booleanfalsefalse
optionsArray of objects with value, label, and optional previewValueArraytrue
requiredDisplays a required indicator (*) next to the labelBooleanfalsefalse
selectAllEnabledEnables "Select All" and "Remove All" buttons in multipleSelect modeBooleanfalsefalse
tooltipTooltip text displayed when hovering over an info iconString''false
v-modelSelected value(s) - bound using two-way bindingArray/String/Number/nulltrue

Features

  • Single and Multiple Selection: Choose between single-item or multiple-item selection modes
  • Search Functionality: Automatically enables search for large option lists (more than 10 items)
  • Visualization: Support for color previews (hex values) and image previews
  • Select All/Remove All: Optional buttons for bulk selection/deselection in multiple mode
  • Keyboard Navigation: Full keyboard support for accessibility
  • Custom Styling: Supports standard error states, disabled states, and loading indicators

Options Format

The component accepts an array of option objects with the following structure:

// Basic options
const options = [
    {
        value: 'analytics', // This value will be used in v-model
        label: 'Analytics', // This text will be displayed in the dropdown
    },
    // More options...
]

// Options with visual previews
const optionsWithPreview = [
    {
        value: 'red',
        label: 'Red',
        previewValue: '#f00' // Hex color value for color preview
    },
    {
        value: 'logo',
        label: 'Company Logo',
        previewValue: '/images/logo.png' // Image path for image preview
    },
]

Usage Examples

<template>
    <!-- Basic single select -->
    <CataUiInputSelect 
        label="Select Item" 
        :options="options" 
        v-model="selectedValue" />
    
    <!-- With color previews -->
    <CataUiInputSelect 
        label="Colors" 
        :options="colorOptions" 
        v-model="selectedColor" />
    
    <!-- Multiple select with all options -->
    <CataUiInputSelect 
        label="Select Multiple Items" 
        multipleSelect 
        selectAllEnabled 
        :options="options" 
        v-model="selectedItems" />
        
    <!-- With loading state -->
    <CataUiInputSelect 
        label="Loading Example" 
        :options="loadingOptions" 
        v-model="selectedValue"
        :loading="isLoading" />
        
    <!-- With error state -->
    <CataUiInputSelect 
        label="Required Field" 
        :options="options" 
        v-model="selectedValue"
        required
        :error="validationError" />
</template>

<script setup>
    import { ref } from 'vue';
    
    // For single select
    const selectedValue = ref('');
    
    // For color select
    const selectedColor = ref('');
    
    // For multiple select (must be an array)
    const selectedItems = ref([]);
    
    // Basic options example
    const options = [
        { value: 'brief', label: 'Brief' },
        { value: 'analytics', label: 'Analytics' },
        { value: 'toolbox', label: 'Toolbox' },
        { value: 'visualize', label: 'Visualize' },
    ];
    
    // Options with color/image previews
    const colorOptions = [
        { value: 'white', label: 'White', previewValue: '#fff' },
        { value: 'catalyst', label: 'Catalyst', previewValue: '/images/nav.png' },
        { value: 'red', label: 'Red', previewValue: '#f00' },
        { value: 'yellow', label: 'Yellow', previewValue: '#ff0' },
    ];
    
    // Example loading and validation states
    const isLoading = ref(false);
    const validationError = ref('This field is required');
</script>

Events

The component uses Vue's v-model for two-way data binding, so it automatically emits the 'update:modelValue' event when the selection changes.

Slots

The component doesn't provide custom slots - all content is generated based on the provided options array.

Prev
CataUiInputSearch
Next
CataUiMasonry