BlockDex

Components

Registries

Free blocks

Method

BlockDex

Components

Registries

Free blocks

Method

Open API

BlockDex

Components

Registries

Free blocks

Method

Open API

Components/ora-ui/sidebar

sidebar

ora-ui/sidebar
FreeComponent

ora-ui publishes no description for this item.

Live preview

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

Install it

npx shadcn@latest add https://ora-ui.com/r/sidebar.json

Source

registry/ui/sidebar.tsxora-ui.com/r/sidebar.json
1'use client';
2
3import * as React from 'react';
4import { Slot } from '@radix-ui/react-slot';
5
6import { cn } from '@/registry/lib/utils';
7
8/* ---------- Context ---------- */
9
10interface SidebarContextValue {
11 collapsed: boolean;
12 setCollapsed: (collapsed: boolean) => void;
13}
14
15const SidebarContext = React.createContext<SidebarContextValue | null>(null);
16
17function useSidebar() {
18 const context = React.useContext(SidebarContext);
19 if (!context) {
20 throw new Error('useSidebar must be used within a SidebarProvider');
21 }
22 return context;
23}
24
25/* ---------- Provider ---------- */
26
27interface SidebarProviderProps {
28 children: React.ReactNode;
29 defaultCollapsed?: boolean;
30}
31
32function SidebarProvider({ children, defaultCollapsed = false }: SidebarProviderProps) {
33 const [collapsed, setCollapsed] = React.useState(defaultCollapsed);
34
35 return (
36 <SidebarContext.Provider value={{ collapsed, setCollapsed }}>
37 {children}
38 </SidebarContext.Provider>
39 );
40}
41
42/* ---------- Sidebar ---------- */
43
44interface SidebarProps extends React.HTMLAttributes<HTMLElement> {
45 children: React.ReactNode;
46}
47
48function Sidebar({ className, children, ...props }: SidebarProps) {
49 const { collapsed } = useSidebar();
50
51 return (
52 <aside
53 data-slot="sidebar"
54 data-collapsed={collapsed}
55 className={cn(
56 'flex h-full w-64 shrink-0 flex-col border-r border-line-subtle bg-background',
57 collapsed && 'w-0 overflow-hidden',
58 className
59 )}
60 {...props}
61 >
62 {children}
63 </aside>
64 );
65}
66
67/* ---------- SidebarHeader ---------- */
68
69function SidebarHeader({ className, ...props }: React.HTMLAttributes<HTMLDivElement>) {
70 return (
71 <div
72 data-slot="sidebar-header"
73 className={cn('flex shrink-0 flex-col gap-2 px-3 py-4', className)}
74 {...props}
75 />
76 );
77}
78
79/* ---------- SidebarContent ---------- */
80
81function SidebarContent({ className, ...props }: React.HTMLAttributes<HTMLDivElement>) {
82 return (
83 <div
84 data-slot="sidebar-content"
85 className={cn('flex flex-1 flex-col gap-1 overflow-y-auto px-7 py-5', className)}
86 {...props}
87 />
88 );
89}
90
91/* ---------- SidebarFooter ---------- */
92
93function SidebarFooter({ className, ...props }: React.HTMLAttributes<HTMLDivElement>) {
94 return (
95 <div
96 data-slot="sidebar-footer"
97 className={cn(
98 'flex shrink-0 flex-col gap-2 border-t border-line-subtle px-3 py-4',
99 className
100 )}
101 {...props}
102 />
103 );
104}
105
106// … truncated

What it pulls in

npm packages

  • @radix-ui/react-slot

Other registry items

  • utils

Files it writes

  • registry/ui/sidebar.tsx

Facts

Registry
ora-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 ora-ui ora-ui.com ora-ui/ora-ui on GitHub Raw registry item This item as JSON

More from ora-ui

All 31 items
Same registry, same kind — the ones you would have found next
ComponentRegistryKindAccessInstallsCommand
accordionaccordionora-uiComponentsFree2 deps
alert-dialogalert-dialogora-uiComponentsFree1 dep
avataravatarora-uiComponentsFree1 dep
avatar-groupavatar-groupora-uiComponentsFreeno deps
badgebadgeora-uiComponentsFree2 deps
buttonbuttonora-uiComponentsFree2 deps
button-groupbutton-groupora-uiComponentsFree2 deps
checkboxcheckboxora-uiComponentsFree3 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