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

CataUiIconSwitch

A toggle component that switches between different icons, typically used for toggling between different view modes or states.

<CataUiIconSwitch :icons="iconsData" v-model="iconsModel" />

Props

PropDescriptionTypeDefaultRequired
iconsAn array of icon objectsArrayYes
v-modelThe icon object for the active iconObjectYes

Events

EventDescriptionParameters
update:modelValueEmitted when the selected icon changesThe newly selected icon object

Data structure

The component expects the icons array to contain objects with the following properties:

PropertyDescriptionTypeRequiredDefault
iconThe icon identifier (Bootstrap icon name)StringYes
idA unique identifier for the iconAnyYes
sizeThe size of the iconStringNo'18px'
titleTooltip text when hovering over the iconStringNo''
const iconsData = [
    {
        id: 1,
        icon: 'bi-justify',
        size: '18px',  // Optional - sets the icon size
        title: 'List view' // Optional - adds tooltip when hovering
    },
    { 
        id: 2,
        icon: 'bi-grid',
        size: '18px',  // Optional - sets the icon size
        title: 'Grid view' // Optional - adds tooltip when hovering
    },
];

const iconsModel = ref(iconsData[0]);

Example with all properties

<template>
  <CataUiIconSwitch :icons="viewOptions" v-model="currentView" />
</template>

<script setup>
import { ref } from 'vue';

const viewOptions = [
  {
    id: 'list',
    icon: 'bi-list-ul',
    size: '20px',
    title: 'List View'
  },
  {
    id: 'grid',
    icon: 'bi-grid-3x3-gap',
    size: '20px',
    title: 'Grid View'
  },
  {
    id: 'calendar',
    icon: 'bi-calendar3',
    size: '20px',
    title: 'Calendar View'
  }
];

const currentView = ref(viewOptions[0]);
</script>
Prev
CataUiIcon
Next
CataUiInput