Sort Dropdown Glass
shadcn-glass-ui/sort-dropdown-glassFreeComponent
Atomic sorting control built on DropdownMenuGlass primitives for data table and list sorting. * Provides intuitive sort field selection with visual indicators for active sort and direction. * * ## Features
Install it
npx shadcn@latest add https://raw.githubusercontent.com/artyhoo/shadcn-glass-ui-library/main/public/r/sort-dropdown-glass.jsonSource
1/**2 * SortDropdownGlass Component3 *4 * Atomic sorting control built on DropdownMenuGlass primitives for data table and list sorting.5 * Provides intuitive sort field selection with visual indicators for active sort and direction.6 *7 * ## Features8 * - **4 Sort Fields:** commits, stars, name, contribution (configurable via `options` prop)9 * - **2 Sort Orders:** ascending (asc) and descending (desc) with arrow indicators10 * - **Responsive Design:** Compact mode for mobile, full mode for desktop11 * - **Visual Indicators:** Check icon for selected field, arrow icons for sort direction12 * - **Theme-Aware:** Unified glass styling via DropdownMenuGlass13 * - **Smart Toggle:** Click same field to toggle order, click different field to switch14 * - **Accessible:** ARIA menu pattern with keyboard navigation15 * - **Compound API:** Built on shadcn/ui DropdownMenuGlass pattern16 * - **Customizable Options:** Filter available sort fields via `options` prop17 *18 * ## CSS Variables19 * Uses DropdownMenuGlass CSS variables (defined in `dropdown-content-styles.ts`):20 * - `--dropdown-bg` - Dropdown trigger and content background21 * - `--dropdown-border` - Dropdown border color22 * - `--dropdown-glow` - Hover glow effect23 * - `--dropdown-item-text` - Menu item text color24 * - `--select-item-selected-bg` - Selected item background25 * - `--text-accent` - Arrow icon color26 * - `--text-muted` - Chevron icon color27 *28 * @example Basic usage29 * ```tsx30 * import { SortDropdownGlass } from 'shadcn-glass-ui'31 *32 * function DataTable() {33 * const [sortBy, setSortBy] = useState<SortField>('commits')34 * const [sortOrder, setSortOrder] = useState<SortOrder>('desc')35 *36 * return (37 * <SortDropdownGlass38 * sortBy={sortBy}39 * sortOrder={sortOrder}40 * onSortChange={(field, order) => {41 * setSortBy(field)42 * setSortOrder(order)43 * }}44 * />45 * )46 * }47 * ```48 *49 * @example Compact mode for mobile50 * ```tsx51 * <SortDropdownGlass52 * sortBy="stars"53 * sortOrder="asc"54 * onSortChange={handleSortChange}55 * compact={true}56 * />57 * ```58 *59 * @example Limited sort options60 * ```tsx61 * <SortDropdownGlass62 * sortBy="name"63 * sortOrder="asc"64 * onSortChange={handleSortChange}65 * options={['name', 'stars']}66 * />67 * ```68 *69 * @example With custom styling70 * ```tsx71 * <SortDropdownGlass72 * sortBy="contribution"73 * sortOrder="desc"74 * onSortChange={handleSortChange}75 * className="md:ml-auto"76 * />77 * ```78 *79 * @accessibility80// … truncated
More from shadcn-glass-ui
All 76 items| Component | Registry | Kind | Access | Installs | Command |
|---|---|---|---|---|---|
| Alert Glassalert-glass | shadcn-glass-ui | Components | Free | no deps | |
| Animated Background Glassanimated-background-glass | shadcn-glass-ui | Components | Free | no deps | |
| Avatar Glassavatar-glass | shadcn-glass-ui | Components | Free | no deps | |
| Badge Glassbadge-glass | shadcn-glass-ui | Components | Free | no deps | |
| Base Progress Glassbase-progress-glass | shadcn-glass-ui | Components | Free | no deps | |
| Button Glassbutton-glass | shadcn-glass-ui | Components | Free | no deps | |
| Card Glasscard-glass | shadcn-glass-ui | Components | Free | no deps | |
| Checkbox Glasscheckbox-glass | shadcn-glass-ui | Components | Free | no deps |
