BlockDex

Components

Registries

Free blocks

Method

BlockDex

Components

Registries

Free blocks

Method

Open API

BlockDex

Components

Registries

Free blocks

Method

Open API

Components/shadcn/ui/sidebar

sidebar

agentmesh/sidebar
FreeComponent

shadcn/ui publishes no description for this item.

Live preview

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

Install it

npx shadcn@latest add https://raw.githubusercontent.com/ombhanushaliii/agentmesh/main/example/ui/apps/v4/public/r/styles/base-vega/sidebar.json

Source

registry/base-vega/ui/sidebar.tsxraw.githubusercontent.com/ombhanushaliii/agentmesh/main/example/ui/apps/v4/public/r/styles/base-vega/sidebar.json · first 6 KB
1"use client"
2
3import * as React from "react"
4import { mergeProps } from "@base-ui/react/merge-props"
5import { useRender } from "@base-ui/react/use-render"
6import { cva, type VariantProps } from "class-variance-authority"
7
8import { useIsMobile } from "@/registry/base-vega/hooks/use-mobile"
9import { cn } from "@/registry/base-vega/lib/utils"
10import { Button } from "@/registry/base-vega/ui/button"
11import { Input } from "@/registry/base-vega/ui/input"
12import { Separator } from "@/registry/base-vega/ui/separator"
13import {
14 Sheet,
15 SheetContent,
16 SheetDescription,
17 SheetHeader,
18 SheetTitle,
19} from "@/registry/base-vega/ui/sheet"
20import { Skeleton } from "@/registry/base-vega/ui/skeleton"
21import {
22 Tooltip,
23 TooltipContent,
24 TooltipTrigger,
25} from "@/registry/base-vega/ui/tooltip"
26import { IconPlaceholder } from "@/app/(create)/components/icon-placeholder"
27
28const SIDEBAR_COOKIE_NAME = "sidebar_state"
29const SIDEBAR_COOKIE_MAX_AGE = 60 * 60 * 24 * 7
30const SIDEBAR_WIDTH = "16rem"
31const SIDEBAR_WIDTH_MOBILE = "18rem"
32const SIDEBAR_WIDTH_ICON = "3rem"
33const SIDEBAR_KEYBOARD_SHORTCUT = "b"
34
35type SidebarContextProps = {
36 state: "expanded" | "collapsed"
37 open: boolean
38 setOpen: (open: boolean) => void
39 openMobile: boolean
40 setOpenMobile: (open: boolean) => void
41 isMobile: boolean
42 toggleSidebar: () => void
43}
44
45const SidebarContext = React.createContext<SidebarContextProps | null>(null)
46
47function useSidebar() {
48 const context = React.useContext(SidebarContext)
49 if (!context) {
50 throw new Error("useSidebar must be used within a SidebarProvider.")
51 }
52
53 return context
54}
55
56function SidebarProvider({
57 defaultOpen = true,
58 open: openProp,
59 onOpenChange: setOpenProp,
60 className,
61 style,
62 children,
63 ...props
64}: React.ComponentProps<"div"> & {
65 defaultOpen?: boolean
66 open?: boolean
67 onOpenChange?: (open: boolean) => void
68}) {
69 const isMobile = useIsMobile()
70 const [openMobile, setOpenMobile] = React.useState(false)
71
72 // This is the internal state of the sidebar.
73 // We use openProp and setOpenProp for control from outside the component.
74 const [_open, _setOpen] = React.useState(defaultOpen)
75 const open = openProp ?? _open
76 const setOpen = React.useCallback(
77 (value: boolean | ((value: boolean) => boolean)) => {
78 const openState = typeof value === "function" ? value(open) : value
79 if (setOpenProp) {
80 setOpenProp(openState)
81 } else {
82 _setOpen(openState)
83 }
84
85// … truncated

What it pulls in

Other registry items

  • button
  • input
  • separator
  • sheet
  • skeleton
  • tooltip
  • use-mobile

Files it writes

  • registry/base-vega/ui/sidebar.tsx

Facts

Registry
shadcn/ui
Type
registry:ui
Access
Free
Files written
1
Licence
the repository states none
First indexed
2026-08-01
Last confirmed
2 days ago

Go to the source

Docs on shadcn/ui ombhanushaliii/agentmesh on GitHub Raw registry item This item as JSON

More from shadcn/ui

All 201 items
Same registry, same kind — the ones you would have found next
ComponentRegistryKindAccessInstallsCommand
accordionaccordionshadcn/uiComponentsFreeno deps
alertalertshadcn/uiComponentsFreeno deps
alert-dialogalert-dialogshadcn/uiComponentsFreeno deps
aspect-ratioaspect-ratioshadcn/uiComponentsFreeno deps
avataravatarshadcn/uiComponentsFreeno deps
badgebadgeshadcn/uiComponentsFreeno deps
breadcrumbbreadcrumbshadcn/uiComponentsFreeno deps
buttonbuttonshadcn/uiComponentsFreeno deps
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