Menubar
basecn/menubarFreeComponent
A visually persistent menu common in desktop applications that provides quick access to a consistent set of commands.
Live preview
live · rendered by the registry
Rendered by basecn on their own page — this is the component running, not a screenshot of it.Install it
npx shadcn@latest add https://basecn.dev/r/menubar.jsonSource
1import { Menu as MenuPrimitive } from "@base-ui/react/menu";2import { Menubar as MenubarPrimitive } from "@base-ui/react/menubar";3import { CheckIcon, ChevronRightIcon, CircleIcon } from "lucide-react";4import * as React from "react";56import { cn } from "@/lib/utils";78function Menubar({ className, ...props }: MenubarPrimitive.Props) {9 return (10 <MenubarPrimitive11 data-slot="menubar"12 className={cn(13 "bg-background flex h-9 items-center gap-1 rounded-md border p-1 shadow-xs",14 className15 )}16 {...props}17 />18 );19}2021function MenubarMenu({ ...props }: MenuPrimitive.Root.Props) {22 return <MenuPrimitive.Root data-slot="menubar-menu" {...props} />;23}2425function MenubarGroup({ ...props }: MenuPrimitive.Group.Props) {26 return <MenuPrimitive.Group data-slot="menubar-group" {...props} />;27}2829function MenubarPortal({ ...props }: MenuPrimitive.Portal.Props) {30 return <MenuPrimitive.Portal data-slot="menubar-portal" {...props} />;31}3233function MenubarRadioGroup({ ...props }: MenuPrimitive.RadioGroup.Props) {34 return (35 <MenuPrimitive.RadioGroup data-slot="menubar-radio-group" {...props} />36 );37}3839function MenubarTrigger({ className, ...props }: MenuPrimitive.Trigger.Props) {40 return (41 <MenuPrimitive.Trigger42 data-slot="menubar-trigger"43 className={cn(44 "focus:bg-accent focus:text-accent-foreground data-[popup-open]:bg-accent data-[open]:text-accent-foreground flex items-center rounded-sm px-2 py-1 text-sm font-medium outline-hidden select-none",45 className46 )}47 {...props}48 />49 );50}5152function MenubarPositioner({53 align = "start",54 alignOffset = -4,55 sideOffset = 8,56 className,57 ...props58}: MenuPrimitive.Positioner.Props) {59 return (60 <MenubarPortal>61 <MenuPrimitive.Positioner62 data-slot="menubar-positioner"63 align={align}64 alignOffset={alignOffset}65 sideOffset={sideOffset}66 className={cn("z-50", className)}67 {...props}68 />69 </MenubarPortal>70 );71}7273function MenubarContent({ className, ...props }: MenuPrimitive.Popup.Props) {74 return (75 <MenuPrimitive.Popup76 data-slot="menubar-content"77 className={cn(78// … truncated
What it pulls in
npm packages
Files it writes
More from basecn
All 56 items| Component | Registry | Kind | Access | Installs | Command |
|---|---|---|---|---|---|
| Accordionaccordion | basecn | Components | Free | 2 deps | |
| Alertalert | basecn | Components | Free | 1 dep | |
| Alert Dialogalert-dialog | basecn | Components | Free | 1 dep | |
| Aspect Ratioaspect-ratio | basecn | Components | Free | no deps | |
| Autocompleteautocomplete | basecn | Components | Free | 2 deps | |
| Avataravatar | basecn | Components | Free | 1 dep | |
| Badgebadge | basecn | Components | Free | 2 deps | |
| Breadcrumbbreadcrumb | basecn | Components | Free | 2 deps |
