BlockDex

Components

Registries

Free blocks

Method

BlockDex

Components

Registries

Free blocks

Method

Open API

BlockDex

Components

Registries

Free blocks

Method

Open API

Components/solid-ui/context-menu

Context Menu

solid-ui/context-menu
FreeComponent

A context menu component

Live preview

live · rendered by the registry
Rendered by solid-ui on their own page — this is the component running, not a screenshot of it.

Install it

npx shadcn@latest add https://www.solid-ui.com/r/context-menu.json

Source

src/registry/ui/context-menu.tsxwww.solid-ui.com/r/context-menu.json · first 6 KB
1import type { Component, ComponentProps, JSX, ValidComponent } from "solid-js"
2import { splitProps } from "solid-js"
3
4import * as ContextMenuPrimitive from "@kobalte/core/context-menu"
5import type { PolymorphicProps } from "@kobalte/core/polymorphic"
6
7import { cn } from "~/lib/utils"
8
9const ContextMenuTrigger = ContextMenuPrimitive.Trigger
10const ContextMenuPortal = ContextMenuPrimitive.Portal
11const ContextMenuSub = ContextMenuPrimitive.Sub
12const ContextMenuGroup = ContextMenuPrimitive.Group
13const ContextMenuRadioGroup = ContextMenuPrimitive.RadioGroup
14
15const ContextMenu: Component<ContextMenuPrimitive.ContextMenuRootProps> = (props) => {
16 return <ContextMenuPrimitive.Root gutter={4} {...props} />
17}
18
19type ContextMenuContentProps<T extends ValidComponent = "div"> =
20 ContextMenuPrimitive.ContextMenuContentProps<T> & {
21 class?: string | undefined
22 }
23
24const ContextMenuContent = <T extends ValidComponent = "div">(
25 props: PolymorphicProps<T, ContextMenuContentProps<T>>
26) => {
27 const [local, others] = splitProps(props as ContextMenuContentProps, ["class"])
28 return (
29 <ContextMenuPrimitive.Portal>
30 <ContextMenuPrimitive.Content
31 class={cn(
32 "z-50 min-w-32 origin-[var(--kb-menu-content-transform-origin)] overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-md animate-in",
33 local.class
34 )}
35 {...others}
36 />
37 </ContextMenuPrimitive.Portal>
38 )
39}
40
41type ContextMenuItemProps<T extends ValidComponent = "div"> =
42 ContextMenuPrimitive.ContextMenuItemProps<T> & {
43 class?: string | undefined
44 }
45
46const ContextMenuItem = <T extends ValidComponent = "div">(
47 props: PolymorphicProps<T, ContextMenuItemProps<T>>
48) => {
49 const [local, others] = splitProps(props as ContextMenuItemProps, ["class"])
50 return (
51 <ContextMenuPrimitive.Item
52 class={cn(
53 "relative flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",
54 local.class
55 )}
56 {...others}
57 />
58 )
59}
60
61const ContextMenuShortcut: Component<ComponentProps<"span">> = (props) => {
62 const [local, others] = splitProps(props, ["class"])
63 return <span class={cn("ml-auto text-xs tracking-widest opacity-60", local.class)} {...others} />
64}
65
66type ContextMenuSeparatorProps<T extends ValidComponent = "hr"> =
67// … truncated

What it pulls in

npm packages

  • solid-js
  • @kobalte/core

Files it writes

  • src/registry/ui/context-menu.tsx

Facts

Registry
solid-ui
Type
registry:ui
Access
Free
Files written
1
Licence
MIT
First indexed
2026-08-03
Last confirmed
yesterday

Go to the source

Docs on solid-ui www.solid-ui.com stefan-karger/solid-ui on GitHub Raw registry item This item as JSON

More from solid-ui

All 55 items
Same registry, same kind — the ones you would have found next
ComponentRegistryKindAccessInstallsCommand
Accordionaccordionsolid-uiComponentsFree2 deps
Alertalertsolid-uiComponentsFree3 deps
Alert Dialogalert-dialogsolid-uiComponentsFree2 deps
Aspect Ratioaspect-ratiosolid-uiComponentsFree1 dep
Avataravatarsolid-uiComponentsFree2 deps
Badgebadgesolid-uiComponentsFree2 deps
Badge Deltabadge-deltasolid-uiComponentsFree2 deps
Bar Listbar-listsolid-uiComponentsFree1 dep
BlockDex

Built by

Kynth Studio

Index

Components
Registries
Method
Open API

Guides

shadcn component libraries
Best shadcn registries
Free shadcn blocks

Reference

Corpus counts
Crawl health
hello@kynth.studio
Privacy
Terms

BlockDex

BlockDex

Built by

Kynth Studio

Index

Components
Registries
Method
Open API

Guides

shadcn component libraries
Best shadcn registries
Free shadcn blocks

Reference

Corpus counts
Crawl health
hello@kynth.studio
Privacy
Terms

BlockDex

BlockDex

Built by

Kynth Studio

Index

Components
Registries
Method
Open API

Guides

shadcn component libraries
Best shadcn registries
Free shadcn blocks

Reference

Corpus counts
Crawl health
hello@kynth.studio
Privacy
Terms

BlockDex