Dropdown
fluid-functionalism/dropdownFreeComponent
Dropdown menu with proximity hover, animated selection indicator, inline panel or triggered popup with collision-aware positioning, typeahead, and close-on-select. Includes MenuItem. Radix flavor.
Install it
npx shadcn@latest add https://fluidfunctionalism.com/r/dropdown.jsonSource
1"use client";23import {4 useRef,5 useState,6 useEffect,7 useCallback,8 useMemo,9 createContext,10 useContext,11 forwardRef,12 cloneElement,13 type ReactNode,14 type ReactElement,15 type HTMLAttributes,16 type ComponentPropsWithoutRef,17} from "react";18import { motion, AnimatePresence } from "framer-motion";19import * as DropdownMenuPrimitive from "@radix-ui/react-dropdown-menu";20import { cn } from "@/lib/utils";21import { spring, exitFallbackMs } from "@/lib/springs";22import { useProximityHover } from "@/hooks/use-proximity-hover";23import { shapeMap } from "@/lib/shape-context";24import { Elevated } from "@/lib/elevated";25import {26 DropdownContext,27 useDropdown,28 useDropdownMaybe,29 type DropdownContextValue,30 type MenuItemRenderOptions,31} from "@/registry/default/menu-item";3233// Dropdown opts out of the global pill/rounded shape context — popover surfaces34// look cleaner with the smaller "rounded" radii regardless of how the rest of35// the UI is shaped (the heavy pill bubbling distorts perceived padding at this36// scale and produces the corner-shadow asymmetry).37const shape = shapeMap.rounded;3839// ---------------------------------------------------------------------------40// Panel context — shared by the inline Dropdown and the popup DropdownContent.41//42// The context object itself lives in menu-item.tsx so MenuItem resolves43// whichever dropdown provider actually wraps it, even when dropdowns built44// on different primitives render side by side. Re-exported here so the45// public dropdown API is unchanged.46// ---------------------------------------------------------------------------4748export { useDropdown, useDropdownMaybe };49export type { DropdownContextValue, MenuItemRenderOptions };5051// ---------------------------------------------------------------------------52// Dropdown (inline panel)53//54// An always-rendered panel — no trigger, positioning, or dismissal. Because it55// sits statically in the page it does NOT claim popup menu semantics: the56// container is a plain role="group" (pass `aria-label` to name it). The real57// role="menu" lives on the popup DropdownContent below, which Radix wires to58// a trigger. Consumers who hand-roll a trigger around the inline panel get59// grouping semantics rather than a falsely-announced popup menu.60// ---------------------------------------------------------------------------6162interface DropdownProps extends HTMLAttributes<HTMLDivElement> {63 children: ReactNode;64 checkedIndex?: number;65}6667// … truncated
What it pulls in
npm packages
Other registry items
Files it writes
More from fluid-functionalism
All 53 items| Component | Registry | Kind | Access | Installs | Command |
|---|---|---|---|---|---|
| Accordionaccordion | fluid-functionalism | Components | Free | 3 deps | |
| Accordion (Base UI)accordion-base | fluid-functionalism | Components | Free | 3 deps | |
| Ask User Questionsask-user-questions | fluid-functionalism | Components | Free | 2 deps | |
| Badgebadge | fluid-functionalism | Components | Free | 1 dep | |
| Buttonbutton | fluid-functionalism | Components | Free | 4 deps | |
| Button (Base UI)button-base | fluid-functionalism | Components | Free | 4 deps | |
| Cardcard | fluid-functionalism | Components | Free | 1 dep | |
| Chat Messagechat-message | fluid-functionalism | Components | Free | 1 dep |
