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

CataUiDropdown

A versatile dropdown component that displays a list of actions when clicked. Supports various button styles, sizes, and customizable options.

<CataUiDropdown :actions="dropdownActions" />
<CataUiDropdown :actions="dropdownActions" actionsAlignment="left" />
<CataUiDropdown :actions="dropdownActions" type="secondary" />
<CataUiDropdown :actions="dropdownActions" type="tertiary" />
<CataUiDropdown :actions="dropdownActions" type="dots" size="small" />
<CataUiDropdown :actions="dropdownActions" :disabled="true" />
<CataUiDropdown :actions="dropdownActions" label="Menu" />
<CataUiDropdown :actions="dropdownActions" :autoClose="true" />
<CataUiDropdown :actions="dropdownActions" :loading="true" />

Props

PropDescriptionTypeDefaultRequiredOptions
actionsThe list of actions to display in the dropdown menuArraytrue
actionsAlignmentAlignment of the dropdown menu relative to the buttonString'right'false'left', 'right'
autoCloseWhen true, dropdown automatically closes when clicking any actionBooleanfalsefalse
disabledWhen true, disables the dropdown button interactionBooleanfalsefalse
iconIcon displayed on the dropdown button (see Icons)String'bi-chevron-down'falseAny valid icon name
labelText label shown on the dropdown button (not available with type="dots")String''false
loadingWhen true, shows a loading spinner overlay on the dropdown menuBooleanfalsefalse
popperOptionsCustom options for PopperJS positioning libraryObjectnullfalseSee PopperJS documentation
sizeControls the size of the dropdown buttonString'large'false'small', 'large'
typeVisual style of the dropdown buttonString'primary'false'primary', 'secondary', 'tertiary', 'dots'

Emits

EmitDescription
actionClickedTriggered when an action in the dropdown menu is clicked
closeTriggered when the dropdown menu closes
openTriggered when the dropdown menu opens

Action Item Properties

PropertyDescriptionTypeRequired
idUnique identifier for the action itemAnyYes
autoCloseWhen true, closes dropdown when this action is clickedBooleanNo
disabledWhen true, the action item is disabled and not clickableBooleanNo
dividerWhen true, renders a divider line instead of an action buttonBooleanNo
iconIcon shown before the label (see Icons)StringNo
iconColorCustom color for the iconStringNo
imageURL to an image to display instead of an iconStringNo
labelText displayed for the action itemStringNo

Data Structure Example

const dropdownActions = [
    {
        id: 1,
        icon: 'bi-person-fill',
        label: 'User Profile',
        disabled: false,
        divider: false,
        autoClose: true,
    },
    {
        id: 2,
        icon: 'bi-gear-fill',
        label: 'Settings',
        disabled: false,
        divider: false,
    },
    {
        id: 3,
        divider: true,
    },
    {
        id: 4,
        image: '/images/custom-icon.png',
        label: 'Custom Action',
        disabled: false,
    },
    {
        id: 5,
        icon: 'bi-box-arrow-right',
        label: 'Log Out',
        iconColor: 'var(--color-danger-500)',
        disabled: false,
    },
]

Usage Examples

Basic Usage with Events

<template>
<CataUiDropdown 
    :actions="actions" 
    @actionClicked="handleAction"
    @open="handleOpen" 
    @close="handleClose" />
</template>

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

const actions = ref([
  { id: 'edit', icon: 'bi-pencil', label: 'Edit' },
  { id: 'delete', icon: 'bi-trash', label: 'Delete' }
]);

function handleAction(action) {
  console.log(`Action ${action.id} was clicked`);
}

function handleOpen() {
  console.log('Dropdown opened');
}

function handleClose() {
  console.log('Dropdown closed');
}
</script>

Custom Dropdown with Popper Options

<template>
  <CataUiDropdown
    label="Filter Options"
    icon="bi-funnel"
    :actions="filterActions"
    type="secondary"
    actionsAlignment="left"
    size="small"
    :autoClose="true"
    :popperOptions="popperOptions" />
</template>

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

const filterActions = ref([
  { id: 'all', label: 'All Items' },
  { id: 'active', label: 'Active Only' },
  { id: 'archived', label: 'Archived' }
]);

const popperOptions = {
  placement: 'bottom-start',
  modifiers: [
    {
      name: 'offset',
      options: {
        offset: [0, 8],
      },
    },
  ],
};
</script>
Prev
CataUiDraggable
Next
CataUiDropover