menubar
shadcn-solidjs/menubarFreeComponent
shadcn-solidjs publishes no description for this item.
Live preview
live · rendered by the registry
Rendered by shadcn-solidjs on their own page — this is the component running, not a screenshot of it.Install it
npx shadcn@latest add https://shadcn-solidjs.com/r/menubar.jsonSource
1import * as MenubarPrimitive from "@kobalte/core/menubar";2import type { PolymorphicProps } from "@kobalte/core/polymorphic";34import { cn } from "~/lib/utils.ts";5import IconCheck from "~icons/lucide/check";6import IconChevronRight from "~icons/lucide/chevron-right";78import type { Component, ComponentProps, JSX, ValidComponent } from "solid-js";9import { splitProps } from "solid-js";1011// Kobalte's Portal and Sub render no DOM node, so unlike upstream there is12// no element to stamp a data-slot attribute on.13const MenubarPortal = MenubarPrimitive.Portal;14const MenubarSub = MenubarPrimitive.Sub;1516type MenubarRootProps<T extends ValidComponent = "div"> =17 & MenubarPrimitive.MenubarRootProps<T>18 & {19 class?: string | undefined;20 };2122const Menubar = <T extends ValidComponent = "div">(23 props: PolymorphicProps<T, MenubarRootProps<T>>,24) => {25 const [local, others] = splitProps(props as MenubarRootProps, ["class"]);26 return (27 <MenubarPrimitive.Root28 data-slot="menubar"29 class={cn("h-8 gap-0.5 rounded-lg border p-[3px] flex items-center", local.class)}30 {...others}31 />32 );33};3435// Kobalte's MenubarMenu renders no DOM node either; the popper offsets live36// here instead of on the content, matching upstream's sideOffset={8} and37// alignOffset={-4} (Kobalte's popper defaults to gutter 0, shift 0).38const MenubarMenu: Component<MenubarPrimitive.MenubarMenuProps> = (props) => {39 return <MenubarPrimitive.Menu gutter={8} shift={-4} {...props} />;40};4142type MenubarGroupProps<T extends ValidComponent = "div"> =43 MenubarPrimitive.MenubarGroupProps<T>;4445const MenubarGroup = <T extends ValidComponent = "div">(46 props: PolymorphicProps<T, MenubarGroupProps<T>>,47) => {48 return <MenubarPrimitive.Group data-slot="menubar-group" {...props} />;49};5051type MenubarRadioGroupProps<T extends ValidComponent = "div"> =52 MenubarPrimitive.MenubarRadioGroupProps<T>;5354const MenubarRadioGroup = <T extends ValidComponent = "div">(55 props: PolymorphicProps<T, MenubarRadioGroupProps<T>>,56) => {57 return (58 <MenubarPrimitive.RadioGroup59 data-slot="menubar-radio-group"60 {...(props as MenubarRadioGroupProps)}61 />62 );63};6465type MenubarTriggerProps<T extends ValidComponent = "button"> =66 & MenubarPrimitive.MenubarTriggerProps<T>67 & {68 class?: string | undefined;69 };7071const MenubarTrigger = <T extends ValidComponent = "button">(72 props: PolymorphicProps<T, MenubarTriggerProps<T>>,73) => {74// … truncated
What it pulls in
npm packages
More from shadcn-solidjs
All 85 items| Component | Registry | Kind | Access | Installs | Command |
|---|---|---|---|---|---|
| accordionaccordion | shadcn-solidjs | Components | Free | 1 dep | |
| alertalert | shadcn-solidjs | Components | Free | 2 deps | |
| alert-dialogalert-dialog | shadcn-solidjs | Components | Free | 2 deps | |
| aspect-ratioaspect-ratio | shadcn-solidjs | Components | Free | no deps | |
| attachmentattachment | shadcn-solidjs | Components | Free | 2 deps | |
| avataravatar | shadcn-solidjs | Components | Free | 1 dep | |
| badgebadge | shadcn-solidjs | Components | Free | 2 deps | |
| breadcrumbbreadcrumb | shadcn-solidjs | Components | Free | 1 dep |
