Components

Mega Select

Mega Select component.

Client Only

Installation

pnpm dlx @docyrus/cli add @docyrus/ui-mega-select
UI Primitives(4 components)
npx shadcn@latest add avatar button scroll-area skeleton

Usage

import {
  MegaSelect
} from "@docyrus/ui/components/mega-select";
import type {
  MegaSelectProps,
  MegaSelectSize,
  MegaSelectVariant,
  MegaSelectProviderProps,
  MegaSelectItemProps,
  MegaSelectSearchProps,
  MegaSelectCategoriesProps,
  MegaSelectGridProps,
  MegaSelectDetailProps,
  MegaSelectItem,
  MegaSelectCategory,
  MapToMegaSelectItemsConfig,
  MegaSelectContextValue
} from "@docyrus/ui/components/mega-select";

<MegaSelect
  columns="auto"
/>

Variants

VariantDescription
defaultDefault style
elevatedElevated — shadow-lg
flatFlat — border-transparent shadow-none

Sizes

SizeDescription
thinthin — w-90
defaultDefault — w-140
largelarge — w-195
fullfull — w-full

Columns

ColumnsDescription
autoAuto — grid-cols-[repeat(auto-fill,minmax(220px,1fr))]

API Reference

PropTypeDefault
columns"auto""default"
classNamestring—

Components

ComponentDescription
MegaSelectPublic export
MegaSelectProviderInternal — mega-select-context.tsx

Type Exports

TypeDescription
MegaSelectProps—
MegaSelectSize—
MegaSelectVariant—
MegaSelectProviderProps—
MegaSelectItemProps—
MegaSelectSearchProps—
MegaSelectCategoriesProps—
MegaSelectGridProps—
MegaSelectDetailProps—
MegaSelectItem—
MegaSelectCategory—
MapToMegaSelectItemsConfig—
MegaSelectContextValue—

Type Reference

MegaSelectProps

FieldTypeDescription

MegaSelectSize

"thin" | "default" | "large" | "full"

MegaSelectVariant

"default" | "elevated" | "flat"

MegaSelectProviderProps

FieldTypeDescription
childrenReactNode—
itemsMegaSelectItem<T>[]—
categoriesMegaSelectCategory[]—
valuestring | null—
defaultValuestring—
disabledboolean—
loadingboolean—
forceOpenDetailboolean—
restrictedValuestring—
defaultColorstring—
defaultIconstring—
searchableboolean—
onChoose(value: string, item: MegaSelectItem<T>) => void—
onSelectionChange(value: string | null, item: MegaSelectItem<T> | null) => void—
onClose() => void—

MegaSelectItemProps

FieldTypeDescription

MegaSelectSearchProps

"onChange"

MegaSelectGridProps

FieldTypeDescription

MegaSelectItem

FieldTypeDescription
idstring—
labelstring—
descriptionstring—
iconstring—
imagestring—
colorstring—
categoryIdstring—
contentReactNode—
disabledboolean—
dataT—

MegaSelectCategory

FieldTypeDescription
idstring—
labelstring—
iconstring—

MapToMegaSelectItemsConfig

FieldTypeDescription
idkeyof R—
labelkeyof R—
descriptionkeyof R—
iconkeyof R—
imagekeyof R—
colorkeyof R—
categoryIdkeyof R—

MegaSelectContextValue

FieldTypeDescription
itemsMegaSelectItem<T>[]—
filteredItemsMegaSelectItem<T>[]—
categoriesMegaSelectCategory[]—
selectedIdstring | null—
setSelectedId(id: string | null) => void—
searchQuerystring—
setSearchQuery(query: string) => void—
activeCategorystring | null—
setActiveCategory(categoryId: string | null) => void—
detailItemMegaSelectItem<T> | null—
setDetailItem(item: MegaSelectItem<T> | null) => void—
disabledboolean—
loadingboolean—
forceOpenDetailboolean—
restrictedValuestring | undefined—
defaultColorstring | undefined—
defaultIconstring | undefined—
searchableboolean—
onChoose(value: string, item: MegaSelectItem<T>) => void—
onSelectionChange(value: string | null, item: MegaSelectItem<T> | null) => void—
onClose() => void—

On this page