context-menu
shadcn-solidjs/context-menuFreeComponent
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/context-menu.jsonSource
1import * as ContextMenuPrimitive from "@kobalte/core/context-menu";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 ContextMenuRoot and Portal render no DOM node, so unlike12// upstream there is no element to stamp a data-slot attribute on.13const ContextMenu: Component<ContextMenuPrimitive.ContextMenuRootProps> = (14 props,15) => {16 return <ContextMenuPrimitive.Root {...props} />;17};1819const ContextMenuPortal = ContextMenuPrimitive.Portal;20const ContextMenuSub = ContextMenuPrimitive.Sub;2122type ContextMenuTriggerProps<T extends ValidComponent = "div"> =23 & ContextMenuPrimitive.ContextMenuTriggerProps<T>24 & {25 class?: string | undefined;26 };2728const ContextMenuTrigger = <T extends ValidComponent = "div">(29 props: PolymorphicProps<T, ContextMenuTriggerProps<T>>,30) => {31 const [local, others] = splitProps(props as ContextMenuTriggerProps, [32 "class",33 ]);34 return (35 <ContextMenuPrimitive.Trigger36 data-slot="context-menu-trigger"37 class={cn("select-none", local.class)}38 {...others}39 />40 );41};4243type ContextMenuGroupProps<T extends ValidComponent = "div"> =44 ContextMenuPrimitive.ContextMenuGroupProps<T>;4546const ContextMenuGroup = <T extends ValidComponent = "div">(47 props: PolymorphicProps<T, ContextMenuGroupProps<T>>,48) => {49 return (50 <ContextMenuPrimitive.Group data-slot="context-menu-group" {...props} />51 );52};5354type ContextMenuRadioGroupProps<T extends ValidComponent = "div"> =55 ContextMenuPrimitive.ContextMenuRadioGroupProps<T>;5657const ContextMenuRadioGroup = <T extends ValidComponent = "div">(58 props: PolymorphicProps<T, ContextMenuRadioGroupProps<T>>,59) => {60 return (61 <ContextMenuPrimitive.RadioGroup62 data-slot="context-menu-radio-group"63 {...(props as ContextMenuRadioGroupProps)}64 />65 );66};6768type ContextMenuContentProps<T extends ValidComponent = "div"> =69 & ContextMenuPrimitive.ContextMenuContentProps<T>70 & {71 class?: string | undefined;72 };7374const ContextMenuContent = <T extends ValidComponent = "div">(75 props: PolymorphicProps<T, ContextMenuContentProps<T>>,76) => {77 const [local, others] = splitProps(props as ContextMenuContentProps, [78 "class",79 ]);80 return (81// … 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 |
