Использование
Директива v-model управляет значением CommandPalette, а пропс default-value задаёт начальное значение, если состоянием управлять не нужно.
<script setup lang="ts">
import type { CommandPaletteGroup } from '@bxshefby/b24ui-nuxt'
const groups = ref<CommandPaletteGroup[]>([
{
id: 'users',
label: 'Пользователи',
items: [
{
label: 'Assistant Name',
suffix: 'assistant',
avatar: {
src: '/b24ui/avatar/assistant.png',
loading: 'lazy'
}
},
{
label: 'Bitrix24',
suffix: 'bitrix24',
avatar: {
src: 'https://github.com/bitrix24.png',
loading: 'lazy'
}
},
{
label: 'Employee Name',
suffix: 'employee',
avatar: {
src: '/b24ui/avatar/employee.png',
loading: 'lazy'
}
}
]
}
])
const value = ref({})
</script>
<template>
<B24CommandPalette v-model="value" :groups="groups" class="flex-1" />
</template>
<script setup lang="ts">
import { ref } from 'vue'
import type { CommandPaletteGroup } from '@bxshefby/b24ui-nuxt'
const groups = ref<CommandPaletteGroup[]>([
{
id: 'users',
label: 'Пользователи',
items: [
{
label: 'Assistant Name',
suffix: 'assistant',
avatar: {
src: '/b24ui/avatar/assistant.png',
loading: 'lazy'
}
},
{
label: 'Bitrix24',
suffix: 'bitrix24',
avatar: {
src: 'https://github.com/bitrix24.png',
loading: 'lazy'
}
},
{
label: 'Employee Name',
suffix: 'employee',
avatar: {
src: '/b24ui/avatar/employee.png',
loading: 'lazy'
}
}
]
}
])
const value = ref({})
</script>
<template>
<B24CommandPalette v-model="value" :groups="groups" class="flex-1" />
</template>
Группы
CommandPalette фильтрует группы и ранжирует подходящие команды по релевантности по мере ввода. Поиск мгновенный и динамический, что упрощает поиск команд. Пропс groups — массив объектов со свойствами:
id: stringlabel?: stringslot?: stringitems?: CommandPaletteItem[]ignoreFilter?: booleanpostFilter?: (searchTerm: string, items: T[]) => T[]highlightedIcon?: IconComponent
id, иначе группа игнорируется.В каждой группе есть массив items — объекты, описывающие команды. У элемента могут быть свойства:
prefix?: stringlabel?: stringsuffix?: stringicon?: IconComponentavatar?: AvatarPropschip?: ChipPropskbds?: string[] | KbdProps[]active?: booleanloading?: booleandisabled?: booleanslot?: stringplaceholder?: stringchildren?: CommandPaletteItem[]labelHtml?: stringsuffixHtml?: stringdescriptionHtml?: stringonSelect?: (e: Event) => voidclass?: anyb24ui?: { item?: ClassNameValue, itemLeadingIcon?: ClassNameValue, itemLeadingAvatarSize?: ClassNameValue, itemLeadingAvatar?: ClassNameValue, itemLeadingChipSize?: ClassNameValue, itemLeadingChip?: ClassNameValue, itemLabel?: ClassNameValue, itemLabelPrefix?: ClassNameValue, itemLabelBase?: ClassNameValue, itemLabelSuffix?: ClassNameValue, itemTrailing?: ClassNameValue, itemTrailingKbds?: ClassNameValue, itemTrailingKbdsSize?: ClassNameValue, itemTrailingHighlightedIcon?: ClassNameValue, itemTrailingIcon?: ClassNameValue }
Можно передать любое свойство компонента Link: to, target и другие.
labelHtml, suffixHtml и descriptionHtml вставляются через v-html. Обычно палитра сама вычисляет их по совпадению с поиском: всё экранируется, найденный фрагмент оборачивается в <mark>. Значение, заданное вручную, этот шаг пропускает и отрисовывается как сырой HTML. Очищайте всё, что приходит из CMS, API или от пользователей, прежде чем передавать сюда.<script setup lang="ts">
import type { CommandPaletteGroup } from '@bxshefby/b24ui-nuxt'
const groups = ref<CommandPaletteGroup[]>([
{
id: 'users',
label: 'Пользователи',
items: [
{
label: 'Assistant Name',
suffix: 'assistant',
avatar: {
src: '/b24ui/avatar/assistant.png',
loading: 'lazy'
}
},
{
label: 'Bitrix24',
suffix: 'bitrix24',
avatar: {
src: 'https://github.com/bitrix24.png',
loading: 'lazy'
}
},
{
label: 'Employee Name',
suffix: 'employee',
avatar: {
src: '/b24ui/avatar/employee.png',
loading: 'lazy'
}
}
]
}
])
const value = ref({})
</script>
<template>
<B24CommandPalette v-model="value" :groups="groups" class="flex-1" />
</template>
<script setup lang="ts">
import { ref } from 'vue'
import type { CommandPaletteGroup } from '@bxshefby/b24ui-nuxt'
const groups = ref<CommandPaletteGroup[]>([
{
id: 'users',
label: 'Пользователи',
items: [
{
label: 'Assistant Name',
suffix: 'assistant',
avatar: {
src: '/b24ui/avatar/assistant.png',
loading: 'lazy'
}
},
{
label: 'Bitrix24',
suffix: 'bitrix24',
avatar: {
src: 'https://github.com/bitrix24.png',
loading: 'lazy'
}
},
{
label: 'Employee Name',
suffix: 'employee',
avatar: {
src: '/b24ui/avatar/employee.png',
loading: 'lazy'
}
}
]
}
])
const value = ref({})
</script>
<template>
<B24CommandPalette v-model="value" :groups="groups" class="flex-1" />
</template>
Множественный выбор
Пропс multiple разрешает выбрать несколько элементов.
<script setup lang="ts">
import type { CommandPaletteGroup } from '@bxshefby/b24ui-nuxt'
const groups = ref<CommandPaletteGroup[]>([
{
id: 'users',
label: 'Пользователи',
items: [
{
label: 'Assistant Name',
suffix: 'assistant',
avatar: {
src: '/b24ui/avatar/assistant.png',
loading: 'lazy'
}
},
{
label: 'Bitrix24',
suffix: 'bitrix24',
avatar: {
src: 'https://github.com/bitrix24.png',
loading: 'lazy'
}
},
{
label: 'Employee Name',
suffix: 'employee',
avatar: {
src: '/b24ui/avatar/employee.png',
loading: 'lazy'
}
}
]
}
])
const value = ref([])
</script>
<template>
<B24CommandPalette multiple v-model="value" :groups="groups" class="flex-1" />
</template>
<script setup lang="ts">
import { ref } from 'vue'
import type { CommandPaletteGroup } from '@bxshefby/b24ui-nuxt'
const groups = ref<CommandPaletteGroup[]>([
{
id: 'users',
label: 'Пользователи',
items: [
{
label: 'Assistant Name',
suffix: 'assistant',
avatar: {
src: '/b24ui/avatar/assistant.png',
loading: 'lazy'
}
},
{
label: 'Bitrix24',
suffix: 'bitrix24',
avatar: {
src: 'https://github.com/bitrix24.png',
loading: 'lazy'
}
},
{
label: 'Employee Name',
suffix: 'employee',
avatar: {
src: '/b24ui/avatar/employee.png',
loading: 'lazy'
}
}
]
}
])
const value = ref([])
</script>
<template>
<B24CommandPalette multiple v-model="value" :groups="groups" class="flex-1" />
</template>
default-value или в директиву v-model массив.Плейсхолдер
Пропс placeholder меняет текст плейсхолдера.
<script setup lang="ts">
import type { CommandPaletteGroup } from '@bxshefby/b24ui-nuxt'
const groups = ref<CommandPaletteGroup[]>([
{
id: 'apps',
items: [
{
label: 'Календарь'
},
{
label: 'Музыка'
},
{
label: 'Карты'
}
]
}
])
</script>
<template>
<B24CommandPalette placeholder="Найти приложение..." :groups="groups" class="flex-1" />
</template>
<script setup lang="ts">
import { ref } from 'vue'
import type { CommandPaletteGroup } from '@bxshefby/b24ui-nuxt'
const groups = ref<CommandPaletteGroup[]>([
{
id: 'apps',
items: [
{
label: 'Календарь'
},
{
label: 'Музыка'
},
{
label: 'Карты'
}
]
}
])
</script>
<template>
<B24CommandPalette placeholder="Найти приложение..." :groups="groups" class="flex-1" />
</template>
Размер
Пропс size меняет размер CommandPalette.
<script setup lang="ts">
import type { CommandPaletteGroup } from '@bxshefby/b24ui-nuxt'
const groups = ref<CommandPaletteGroup[]>([
{
id: 'apps',
items: [
{
label: 'Календарь'
},
{
label: 'Музыка'
},
{
label: 'Карты'
}
]
}
])
</script>
<template>
<B24CommandPalette size="xl" :groups="groups" class="flex-1" />
</template>
<script setup lang="ts">
import { ref } from 'vue'
import type { CommandPaletteGroup } from '@bxshefby/b24ui-nuxt'
const groups = ref<CommandPaletteGroup[]>([
{
id: 'apps',
items: [
{
label: 'Календарь'
},
{
label: 'Музыка'
},
{
label: 'Карты'
}
]
}
])
</script>
<template>
<B24CommandPalette size="xl" :groups="groups" class="flex-1" />
</template>
Иконка
Пропс icon задаёт иконку в поле ввода.
<script setup lang="ts">
import RocketIcon from '@bitrix24/b24icons-vue/main/RocketIcon'
import type { CommandPaletteGroup } from '@bxshefby/b24ui-nuxt'
const groups = ref<CommandPaletteGroup[]>([
{
id: 'apps',
items: [
{
label: 'Календарь'
},
{
label: 'Музыка'
},
{
label: 'Карты'
}
]
}
])
</script>
<template>
<B24CommandPalette :icon="RocketIcon" :groups="groups" class="flex-1" />
</template>
<script setup lang="ts">
import { ref } from 'vue'
import RocketIcon from '@bitrix24/b24icons-vue/main/RocketIcon'
import type { CommandPaletteGroup } from '@bxshefby/b24ui-nuxt'
const groups = ref<CommandPaletteGroup[]>([
{
id: 'apps',
items: [
{
label: 'Календарь'
},
{
label: 'Музыка'
},
{
label: 'Карты'
}
]
}
])
</script>
<template>
<B24CommandPalette :icon="RocketIcon" :groups="groups" class="flex-1" />
</template>
Иконка выбранного элемента
Пропс selected-icon задаёт иконку выбранного элемента.
<script setup lang="ts">
import RocketIcon from '@bitrix24/b24icons-vue/main/RocketIcon'
import type { CommandPaletteGroup } from '@bxshefby/b24ui-nuxt'
const groups = ref<CommandPaletteGroup[]>([
{
id: 'users',
label: 'Пользователи',
items: [
{
label: 'Assistant Name',
suffix: 'assistant',
avatar: {
src: '/b24ui/avatar/assistant.png',
loading: 'lazy'
}
},
{
label: 'Bitrix24',
suffix: 'bitrix24',
avatar: {
src: 'https://github.com/bitrix24.png',
loading: 'lazy'
}
},
{
label: 'Employee Name',
suffix: 'employee',
avatar: {
src: '/b24ui/avatar/employee.png',
loading: 'lazy'
}
}
]
}
])
const value = ref([
{
label: 'Bitrix24',
suffix: 'bitrix24',
avatar: {
src: 'https://github.com/bitrix24.png',
loading: 'lazy'
}
}
])
</script>
<template>
<B24CommandPalette multiple v-model="value" :selected-icon="RocketIcon" :groups="groups" class="flex-1" />
</template>
<script setup lang="ts">
import { ref } from 'vue'
import RocketIcon from '@bitrix24/b24icons-vue/main/RocketIcon'
import type { CommandPaletteGroup } from '@bxshefby/b24ui-nuxt'
const groups = ref<CommandPaletteGroup[]>([
{
id: 'users',
label: 'Пользователи',
items: [
{
label: 'Assistant Name',
suffix: 'assistant',
avatar: {
src: '/b24ui/avatar/assistant.png',
loading: 'lazy'
}
},
{
label: 'Bitrix24',
suffix: 'bitrix24',
avatar: {
src: 'https://github.com/bitrix24.png',
loading: 'lazy'
}
},
{
label: 'Employee Name',
suffix: 'employee',
avatar: {
src: '/b24ui/avatar/employee.png',
loading: 'lazy'
}
}
]
}
])
const value = ref([
{
label: 'Bitrix24',
suffix: 'bitrix24',
avatar: {
src: 'https://github.com/bitrix24.png',
loading: 'lazy'
}
}
])
</script>
<template>
<B24CommandPalette multiple v-model="value" :selected-icon="RocketIcon" :groups="groups" class="flex-1" />
</template>
Иконка справа
Пропс trailing-icon задаёт иконку справа у элементов с подменю.
<script setup lang="ts">
import RocketIcon from '@bitrix24/b24icons-vue/main/RocketIcon'
import type { CommandPaletteGroup } from '@bxshefby/b24ui-nuxt'
const groups = ref<CommandPaletteGroup[]>([
{
id: 'actions',
items: [
{
label: 'Поделиться',
children: [
{
label: 'Почта'
},
{
label: 'Копировать'
},
{
label: 'Ссылка'
}
]
}
]
}
])
</script>
<template>
<B24CommandPalette :trailing-icon="RocketIcon" :groups="groups" class="flex-1" />
</template>
<script setup lang="ts">
import { ref } from 'vue'
import RocketIcon from '@bitrix24/b24icons-vue/main/RocketIcon'
import type { CommandPaletteGroup } from '@bxshefby/b24ui-nuxt'
const groups = ref<CommandPaletteGroup[]>([
{
id: 'actions',
items: [
{
label: 'Поделиться',
children: [
{
label: 'Почта'
},
{
label: 'Копировать'
},
{
label: 'Ссылка'
}
]
}
]
}
])
</script>
<template>
<B24CommandPalette :trailing-icon="RocketIcon" :groups="groups" class="flex-1" />
</template>
Загрузка
Пропс loading показывает в CommandPalette иконку загрузки.
<script setup lang="ts">
import type { CommandPaletteGroup } from '@bxshefby/b24ui-nuxt'
const groups = ref<CommandPaletteGroup[]>([
{
id: 'apps',
items: [
{
label: 'Календарь'
},
{
label: 'Музыка'
},
{
label: 'Карты'
}
]
}
])
</script>
<template>
<B24CommandPalette loading :groups="groups" class="flex-1" />
</template>
<script setup lang="ts">
import { ref } from 'vue'
import type { CommandPaletteGroup } from '@bxshefby/b24ui-nuxt'
const groups = ref<CommandPaletteGroup[]>([
{
id: 'apps',
items: [
{
label: 'Календарь'
},
{
label: 'Музыка'
},
{
label: 'Карты'
}
]
}
])
</script>
<template>
<B24CommandPalette loading :groups="groups" class="flex-1" />
</template>
Закрытие
Пропс close показывает кнопку Button, которая закрывает CommandPalette.
update:open.<script setup lang="ts">
import type { CommandPaletteGroup } from '@bxshefby/b24ui-nuxt'
const groups = ref<CommandPaletteGroup[]>([
{
id: 'apps',
items: [
{
label: 'Календарь'
},
{
label: 'Музыка'
},
{
label: 'Карты'
}
]
}
])
</script>
<template>
<B24CommandPalette close :groups="groups" class="flex-1" />
</template>
<script setup lang="ts">
import { ref } from 'vue'
import type { CommandPaletteGroup } from '@bxshefby/b24ui-nuxt'
const groups = ref<CommandPaletteGroup[]>([
{
id: 'apps',
items: [
{
label: 'Календарь'
},
{
label: 'Музыка'
},
{
label: 'Карты'
}
]
}
])
</script>
<template>
<B24CommandPalette close :groups="groups" class="flex-1" />
</template>
Кнопку можно настроить любым свойством компонента Button.
<script setup lang="ts">
import type { CommandPaletteGroup } from '@bxshefby/b24ui-nuxt'
const groups = ref<CommandPaletteGroup[]>([
{
id: 'apps',
items: [
{
label: 'Календарь'
},
{
label: 'Музыка'
},
{
label: 'Карты'
}
]
}
])
</script>
<template>
<B24CommandPalette
:close="{
color: 'air-primary',
rounded: true,
size: 'md'
}"
:groups="groups"
class="flex-1"
/>
</template>
<script setup lang="ts">
import { ref } from 'vue'
import type { CommandPaletteGroup } from '@bxshefby/b24ui-nuxt'
const groups = ref<CommandPaletteGroup[]>([
{
id: 'apps',
items: [
{
label: 'Календарь'
},
{
label: 'Музыка'
},
{
label: 'Карты'
}
]
}
])
</script>
<template>
<B24CommandPalette
:close="{
color: 'air-primary',
rounded: true,
size: 'md'
}"
:groups="groups"
class="flex-1"
/>
</template>
Иконка закрытия
Пропс close-icon задаёт иконку кнопки закрытия.
<script setup lang="ts">
import RocketIcon from '@bitrix24/b24icons-vue/main/RocketIcon'
import type { CommandPaletteGroup } from '@bxshefby/b24ui-nuxt'
const groups = ref<CommandPaletteGroup[]>([
{
id: 'apps',
items: [
{
label: 'Календарь'
},
{
label: 'Музыка'
},
{
label: 'Карты'
}
]
}
])
</script>
<template>
<B24CommandPalette close :close-icon="RocketIcon" :groups="groups" class="flex-1" />
</template>
<script setup lang="ts">
import { ref } from 'vue'
import RocketIcon from '@bitrix24/b24icons-vue/main/RocketIcon'
import type { CommandPaletteGroup } from '@bxshefby/b24ui-nuxt'
const groups = ref<CommandPaletteGroup[]>([
{
id: 'apps',
items: [
{
label: 'Календарь'
},
{
label: 'Музыка'
},
{
label: 'Карты'
}
]
}
])
</script>
<template>
<B24CommandPalette close :close-icon="RocketIcon" :groups="groups" class="flex-1" />
</template>
Кнопка «Назад»
Пропс back настраивает кнопку «Назад», которая показывается при переходе в подменю, или скрывает её (значение false).
Кнопку можно настроить любым свойством компонента Button.
<script setup lang="ts">
import type { CommandPaletteGroup } from '@bxshefby/b24ui-nuxt'
const groups = ref<CommandPaletteGroup[]>([
{
id: 'actions',
items: [
{
label: 'Поделиться',
children: [
{
label: 'Почта'
},
{
label: 'Копировать'
},
{
label: 'Ссылка'
}
]
}
]
}
])
</script>
<template>
<B24CommandPalette
:back="{
color: 'air-primary'
}"
:groups="groups"
class="flex-1"
/>
</template>
<script setup lang="ts">
import { ref } from 'vue'
import type { CommandPaletteGroup } from '@bxshefby/b24ui-nuxt'
const groups = ref<CommandPaletteGroup[]>([
{
id: 'actions',
items: [
{
label: 'Поделиться',
children: [
{
label: 'Почта'
},
{
label: 'Копировать'
},
{
label: 'Ссылка'
}
]
}
]
}
])
</script>
<template>
<B24CommandPalette
:back="{
color: 'air-primary'
}"
:groups="groups"
class="flex-1"
/>
</template>
Иконка кнопки «Назад»
Пропс back-icon задаёт иконку кнопки «Назад».
<script setup lang="ts">
import RocketIcon from '@bitrix24/b24icons-vue/main/RocketIcon'
import type { CommandPaletteGroup } from '@bxshefby/b24ui-nuxt'
const groups = ref<CommandPaletteGroup[]>([
{
id: 'actions',
items: [
{
label: 'Поделиться',
children: [
{
label: 'Почта'
},
{
label: 'Копировать'
},
{
label: 'Ссылка'
}
]
}
]
}
])
</script>
<template>
<B24CommandPalette :back-icon="RocketIcon" :groups="groups" class="flex-1" />
</template>
<script setup lang="ts">
import { ref } from 'vue'
import RocketIcon from '@bitrix24/b24icons-vue/main/RocketIcon'
import type { CommandPaletteGroup } from '@bxshefby/b24ui-nuxt'
const groups = ref<CommandPaletteGroup[]>([
{
id: 'actions',
items: [
{
label: 'Поделиться',
children: [
{
label: 'Почта'
},
{
label: 'Копировать'
},
{
label: 'Ссылка'
}
]
}
]
}
])
</script>
<template>
<B24CommandPalette :back-icon="RocketIcon" :groups="groups" class="flex-1" />
</template>
Отключение
Пропс disabled отключает CommandPalette.
<script setup lang="ts">
import type { CommandPaletteGroup } from '@bxshefby/b24ui-nuxt'
const groups = ref<CommandPaletteGroup[]>([
{
id: 'apps',
items: [
{
label: 'Календарь'
},
{
label: 'Музыка'
},
{
label: 'Карты'
}
]
}
])
</script>
<template>
<B24CommandPalette disabled :groups="groups" class="flex-1" />
</template>
<script setup lang="ts">
import { ref } from 'vue'
import type { CommandPaletteGroup } from '@bxshefby/b24ui-nuxt'
const groups = ref<CommandPaletteGroup[]>([
{
id: 'apps',
items: [
{
label: 'Календарь'
},
{
label: 'Музыка'
},
{
label: 'Карты'
}
]
}
])
</script>
<template>
<B24CommandPalette disabled :groups="groups" class="flex-1" />
</template>
Примеры
Управление выбранными элементами
Выбранными элементами можно управлять через пропс default-value или директиву v-model, через поле onSelect у каждого элемента или через событие @update:model-value.
value-key выбирает поле элемента, которое используется как значение вместо самого объекта. Пропс by сравнивает объекты по полю, а не по ссылке.Управление поисковым запросом
Директива v-model:search-term управляет поисковым запросом.
@update:model-value сбрасывает поисковый запрос при выборе элемента.Вложенные элементы
Иерархические меню создаются свойством children у элементов. Если у элемента есть children, он автоматически показывает шеврон, и по нему можно перейти в подменю.
- поисковый запрос сбрасывается;
- в поле ввода появляется кнопка «Назад»;
- к предыдущей группе можно вернуться клавишей ⌫.
Элементы из API
Элементы можно получать из API и использовать в CommandPalette.
useLazyFetch с server: false загружает данные на клиенте и не блокирует первую отрисовку. Состояние загрузки проверяет и pending, и idle, чтобы индикатор загрузки показывался до запроса и во время него.Игнорирование фильтра
Поле ignoreFilter со значением true у группы отключает встроенный поиск, и вы используете свою логику поиска.
refDebounced откладывает вызовы API. Состояние загрузки проверяет и pending, и idle, чтобы индикатор загрузки показывался до запроса и во время него.ignore-filter со значением true отключает встроенный поиск сразу для всех групп. Группа может вернуть его, указав ignoreFilter: false.Фильтрация после поиска
Поле postFilter у группы фильтрует элементы после поиска.
Свои настройки Fuse
Пропс fuse переопределяет параметры useFuse. По умолчанию они такие:
{
fuseOptions: {
ignoreLocation: true,
threshold: 0.1,
keys: ['label', 'description', 'suffix']
},
resultLimit: 12,
matchAllWhenSearchEmpty: true
}
fuseOptions — параметры Fuse.js, resultLimit — максимальное число результатов, а matchAllWhenSearchEmpty — булево значение: показывать все элементы, если поисковый запрос пуст.Например, { fuseOptions: { includeMatches: true } } подсвечивает искомый текст в элементах.
Виртуализация
Пропс virtualize включает виртуализацию для больших списков: булево значение или объект с параметрами вроде { estimateSize: 32, overscan: 12 }.
Внутри Popover
CommandPalette можно использовать внутри содержимого Popover.
Внутри Modal
CommandPalette можно использовать внутри содержимого Modal.
useLazyFetch с immediate: false загружает данные только при открытии Modal.Внутри Drawer
CommandPalette можно использовать внутри содержимого Drawer.
useLazyFetch с immediate: false загружает данные только при открытии Drawer.Отслеживание состояния открытия
Если задан пропс close, на нажатие кнопки можно реагировать событием update:open.
Modal.Слот footer
Слот #footer добавляет свой контент внизу CommandPalette: например, подсказку по горячим клавишам или дополнительные действия.
Свой слот
Свойство slot настраивает отдельный элемент или группу.
Вам будут доступны слоты:
#{{ item.slot }}#{{ item.slot }}-leading#{{ item.slot }}-label#{{ item.slot }}-trailing#{{ group.slot }}#{{ group.slot }}-leading#{{ group.slot }}-label#{{ group.slot }}-trailing
API
Пропсы
Слоты
События
Тема
export default {
slots: {
root: 'flex flex-col min-h-0 min-w-0 divide-y divide-(--ui-color-divider-default)',
input: '',
close: '',
back: 'p-0 -ms-1.5 me-1',
content: 'relative overflow-hidden flex flex-col focus:outline-none',
footer: 'p-1',
viewport: 'relative scroll-py-1 overflow-y-auto scrollbar-thin flex-1 focus:outline-none',
group: 'p-1 isolate',
empty: 'text-center text-description',
label: 'text-label',
item: 'group relative w-full flex items-center select-none outline-none before:absolute before:z-[-1] before:inset-px before:rounded-(--ui-border-radius-sm) data-disabled:cursor-not-allowed data-disabled:opacity-30',
itemLeadingIcon: 'shrink-0',
itemLeadingAvatar: 'shrink-0',
itemLeadingAvatarSize: '',
itemLeadingChip: 'shrink-0',
itemLeadingChipSize: '',
itemTrailing: 'ms-auto inline-flex items-center',
itemTrailingIcon: 'shrink-0 text-(--ui-color-accent-main-primary)',
itemTrailingHighlightedIcon: 'shrink-0 text-label hidden group-data-highlighted:inline-flex',
itemTrailingKbds: 'hidden lg:inline-flex items-center shrink-0',
itemTrailingKbdsSize: '',
itemWrapper: 'flex-1 flex flex-col text-start min-w-0 overflow-hidden',
itemLabel: 'truncate space-x-1 text-label',
itemLabelBase: 'text-label [&>mark]:text-(--ui-color-black-base) [&>mark]:bg-(--ui-color-collab-accent-less-1)',
itemLabelPrefix: 'text-legend',
itemLabelSuffix: 'truncate text-description [&>mark]:text-(--ui-color-black-base) [&>mark]:bg-(--ui-color-collab-accent-less-1)',
itemDescription: 'truncate -mt-[6px] text-description text-(length:--ui-font-size-sm) [&>mark]:text-(--ui-color-black-base) [&>mark]:bg-(--ui-color-collab-accent-less-1)'
},
variants: {
virtualize: {
true: {
viewport: 'p-1 isolate'
},
false: {
viewport: ''
}
},
size: {
xss: {
input: 'ps-[20px] pe-[20px]',
empty: 'py-3 text-(length:--ui-font-size-4xs)',
label: 'p-1 text-[10px]/3 gap-1',
item: 'p-1 text-(length:--ui-font-size-4xs) gap-1',
itemLeadingIcon: 'size-4',
itemLeadingAvatarSize: '3xs',
itemLeadingChip: 'size-4',
itemLeadingChipSize: 'sm',
itemTrailing: 'gap-1',
itemTrailingIcon: 'size-4',
itemTrailingHighlightedIcon: 'size-4',
itemTrailingKbds: 'gap-0.5',
itemTrailingKbdsSize: 'sm'
},
xs: {
input: 'ps-[22px] pe-[22px]',
empty: 'py-3 text-(length:--ui-font-size-xs)',
label: 'p-1 text-[10px]/3 gap-1',
item: 'p-1 text-(length:--ui-font-size-xs) gap-1',
itemLeadingIcon: 'size-4',
itemLeadingAvatarSize: '3xs',
itemLeadingChip: 'size-4',
itemLeadingChipSize: 'sm',
itemTrailing: 'gap-1',
itemTrailingIcon: 'size-4',
itemTrailingHighlightedIcon: 'size-4',
itemTrailingKbds: 'gap-0.5',
itemTrailingKbdsSize: 'sm'
},
sm: {
input: 'ps-[28px] pe-[28px]',
empty: 'py-4 text-(length:--ui-font-size-sm)',
label: 'p-1.5 text-[10px]/3 gap-1.5',
item: 'p-1.5 text-(length:--ui-font-size-sm) gap-1.5',
itemLeadingIcon: 'size-4',
itemLeadingAvatarSize: '3xs',
itemLeadingChip: 'size-4',
itemLeadingChipSize: 'sm',
itemTrailing: 'gap-1.5',
itemTrailingIcon: 'size-4',
itemTrailingHighlightedIcon: 'size-4',
itemTrailingKbds: 'gap-0.5',
itemTrailingKbdsSize: 'sm'
},
md: {
input: 'ps-[40px] pe-[44px]',
empty: 'py-6 text-(length:--ui-font-size-sm)',
label: 'p-[6px] text-(length:--ui-font-size-xs) gap-[6px]',
item: 'p-[6px] text-(length:--ui-font-size-md) gap-[6px]',
itemLeadingIcon: 'size-[20px]',
itemLeadingAvatarSize: '2xs',
itemLeadingChip: 'size-[20px]',
itemLeadingChipSize: 'md',
itemTrailing: 'gap-[6px]',
itemTrailingIcon: 'size-[20px]',
itemTrailingHighlightedIcon: 'size-[20px]',
itemTrailingKbds: 'gap-0.5',
itemTrailingKbdsSize: 'md'
},
lg: {
input: 'ps-[40px] pe-[44px]',
empty: 'py-7 text-(length:--ui-font-size-sm)',
label: 'p-2 text-(length:--ui-font-size-lg) gap-2',
item: 'p-2 text-(length:--ui-font-size-lg) gap-2',
itemLeadingIcon: 'size-5',
itemLeadingAvatarSize: '2xs',
itemLeadingChip: 'size-5',
itemLeadingChipSize: 'md',
itemTrailing: 'gap-2',
itemTrailingIcon: 'size-5',
itemTrailingHighlightedIcon: 'size-5',
itemTrailingKbds: 'gap-0.5',
itemTrailingKbdsSize: 'md'
},
xl: {
input: 'ps-[40px] pe-[44px]',
empty: 'py-8 text-(length:--ui-font-size-lg)',
label: 'p-2 text-(length:--ui-font-size-2xl) gap-2',
item: 'p-2 text-(length:--ui-font-size-2xl) gap-2',
itemLeadingIcon: 'size-6',
itemLeadingAvatarSize: 'xs',
itemLeadingChip: 'size-6',
itemLeadingChipSize: 'lg',
itemTrailing: 'gap-2',
itemTrailingIcon: 'size-6',
itemTrailingHighlightedIcon: 'size-6',
itemTrailingKbds: 'gap-0.5',
itemTrailingKbdsSize: 'lg'
}
},
active: {
true: {
item: 'text-label before:bg-(--ui-color-base-8)',
itemLeadingIcon: 'text-legend'
},
false: {
item: 'text-legend data-highlighted:not-data-disabled:text-legend data-highlighted:not-data-disabled:before:bg-(--ui-color-bg-content-secondary) transition-colors before:transition-colors',
itemLeadingIcon: 'text-legend group-data-highlighted:not-group-data-disabled:text-legend transition-colors'
}
},
loading: {
true: {
itemLeadingIcon: 'animate-spin'
}
}
},
defaultVariants: {
size: 'md'
}
}