UI Dropdown Menu Item
remocn/dropdown-menu-itemFreeComponent
A dropdown menu action row whose idle/hover/press state is a pure function of the timeline; the row background and label color are keyframed presets. Composed inside the DropdownMenu panel.
Install it
npx shadcn@latest add https://www.remocn.dev/r/dropdown-menu-item.jsonSource
1"use client";23import { mixOklch, type RemocnTheme, useRemocnTheme } from "@/lib/remocn-ui";45export type DropdownMenuItemState = "idle" | "hover" | "press";67export interface DropdownMenuItemStyle {8 background: string;9 labelColor: string;10 scale: number;11}1213export interface DropdownMenuItemStyleContext {14 idleBg: string;15 hoverBg: string;16 pressBg: string;17 idleFg: string;18}1920export function dropdownMenuItemStyleContext(21 theme: RemocnTheme,22): DropdownMenuItemStyleContext {23 return {24 idleBg: theme.popover,25 hoverBg: theme.accent,26 pressBg: mixOklch(theme.accent, theme.foreground, 0.08),27 idleFg: theme.popoverForeground,28 };29}3031export function dropdownMenuItemStyle(32 state: DropdownMenuItemState,33 ctx: DropdownMenuItemStyleContext,34): DropdownMenuItemStyle {35 switch (state) {36 case "hover":37 return { background: ctx.hoverBg, labelColor: ctx.idleFg, scale: 1 };38 case "press":39 return { background: ctx.pressBg, labelColor: ctx.idleFg, scale: 0.98 };40 default:41 return { background: ctx.idleBg, labelColor: ctx.idleFg, scale: 1 };42 }43}4445const ROW_WIDTH = 240;4647export interface DropdownMenuItemRowProps {48 style?: DropdownMenuItemStyle;49 state?: DropdownMenuItemState;50 label?: string;51 width?: number;52 theme?: Partial<RemocnTheme>;53}5455export function DropdownMenuItemRow({56 style,57 state = "idle",58 label = "Profile",59 width = ROW_WIDTH,60 theme: themeOverride,61}: DropdownMenuItemRowProps) {62 const theme = useRemocnTheme(themeOverride, "light");63 const ctx = dropdownMenuItemStyleContext(theme);64 const v = style ?? dropdownMenuItemStyle(state, ctx);6566 return (67 <div68 style={{69 display: "flex",70 alignItems: "center",71 width,72 padding: "8px 12px",73 borderRadius: theme.radius,74 background: v.background,75 color: v.labelColor,76 transform: `scale(${v.scale})`,77 fontSize: 14,78 letterSpacing: "-0.01em",79 boxSizing: "border-box",80 }}81 >82 <span>{label}</span>83 </div>84 );85}8687export interface DropdownMenuItemProps extends DropdownMenuItemRowProps {88 className?: string;89}9091export function DropdownMenuItem({92 style,93 state = "idle",94 label = "Profile",95 width = ROW_WIDTH,96 theme: themeOverride,97 className,98}: DropdownMenuItemProps) {99 return (100 <div101 className={className}102 style={{103 position: "absolute",104 inset: 0,105 display: "flex",106 alignItems: "center",107// … truncated
What it pulls in
npm packages
Other registry items
Files it writes
More from remocn
All 282 items| Component | Registry | Kind | Access | Installs | Command |
|---|---|---|---|---|---|
| UI Accordionaccordion | remocn | Components | Free | 1 dep · 2 files | |
| UI AI Prompt Flowai-prompt-flow | remocn | Components | Free | 1 dep | |
| UI Alert Dialogalert-dialog | remocn | Components | Free | 1 dep · 2 files | |
| Animated Bar Chartanimated-bar-chart | remocn | Components | Free | 1 dep | |
| Animated Line Chartanimated-line-chart | remocn | Components | Free | 1 dep | |
| ASCII Dissolveascii-dissolve | remocn | Components | Free | 2 deps | |
| ASCII Renderascii-render | remocn | Components | Free | 1 dep | |
| Backdropbackdrop | remocn | Components | Free | 1 dep |
