BlockDex

Components

Registries

Free blocks

Method

BlockDex

Components

Registries

Free blocks

Method

Open API

BlockDex

Components

Registries

Free blocks

Method

Open API

Components/mcoli-ui-registry/mc-sidebar

MicroClub Sidebar

mcoli-ui-registry/mc-sidebar
FreeComponent

A sidebar component for MicroClub UI

Live preview

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

Install it

npx shadcn@latest add https://mcoli-ui.microclub.info/r/mc-sidebar.json

Source

registry/ui/mc-sidebar.tsxmcoli-ui.microclub.info/r/mc-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';
7import { ChevronDownIcon, PanelLeftIcon } from 'lucide-react';
8
9import { cn } from '@/lib/utils';
10import { McButton } from '@/registry/ui/mc-button';
11
12const SIDEBAR_COOKIE_NAME = 'sidebar_state';
13const SIDEBAR_COOKIE_MAX_AGE = 60 * 60 * 24 * 7;
14const SIDEBAR_WIDTH = '255px';
15const SIDEBAR_WIDTH_ICON = '51px';
16const SIDEBAR_KEYBOARD_SHORTCUT = 'b';
17
18type SidebarContextProps = {
19 state: 'expanded' | 'collapsed';
20 open: boolean;
21 setOpen: (open: boolean) => void;
22 toggleSidebar: () => void;
23};
24
25const SidebarContext = React.createContext<SidebarContextProps | null>(null);
26
27function useSidebar() {
28 const context = React.useContext(SidebarContext);
29 if (!context) {
30 throw new Error('useSidebar must be used within a SidebarProvider.');
31 }
32 return context;
33}
34
35function SidebarProvider({
36 defaultOpen = true,
37 open: openProp,
38 onOpenChange: setOpenProp,
39 className,
40 style,
41 children,
42 ...props
43}: React.ComponentProps<'div'> & {
44 defaultOpen?: boolean;
45 open?: boolean;
46 onOpenChange?: (open: boolean) => void;
47}) {
48 const [_open, _setOpen] = React.useState(() => {
49 if (typeof document === 'undefined') {
50 return defaultOpen;
51 }
52
53 const cookie = document.cookie
54 .split('; ')
55 .find((entry) => entry.startsWith(`${SIDEBAR_COOKIE_NAME}=`));
56
57 if (!cookie) {
58 return defaultOpen;
59 }
60
61 return cookie.split('=')[1] === 'true';
62 });
63 const open = openProp ?? _open;
64 const setOpen = React.useCallback(
65 (value: boolean | ((value: boolean) => boolean)) => {
66 const openState = typeof value === 'function' ? value(open) : value;
67 if (setOpenProp) {
68 setOpenProp(openState);
69 } else {
70 _setOpen(openState);
71 }
72 },
73 [setOpenProp, open]
74 );
75
76 React.useEffect(() => {
77 document.cookie = `${SIDEBAR_COOKIE_NAME}=${open}; path=/; max-age=${SIDEBAR_COOKIE_MAX_AGE}`;
78 }, [open]);
79
80 const toggleSidebar = React.useCallback(() => {
81 return setOpen((open) => !open);
82 }, [setOpen]);
83
84 React.useEffect(() => {
85 const handleKeyDown = (event: KeyboardEvent) => {
86 if (event.key === SIDEBAR_KEYBOARD_SHORTCUT && (event.metaKey || event.ctrlKey)) {
87 event.preventDefault();
88 toggleSidebar();
89 }
90 };
91
92// … truncated

What it pulls in

npm packages

  • @base-ui/react
  • lucide-react

Files it writes

  • registry/ui/mc-sidebar.tsx

Facts

Registry
mcoli-ui-registry
Type
registry:component
Access
Free
Files written
1
Licence
MIT
In the index
at or before 2026-08-12
Last confirmed
today

Go to the source

Docs on mcoli-ui-registry mcoli-ui.microclub.info MicroClub-USTHB/mcoli-ui on GitHub Raw registry item This item as JSON

More from mcoli-ui-registry

All 42 items
Same registry, same kind — the ones you would have found next
ComponentRegistryKindAccessInstallsCommand
MicroClub Accordionmc-accordionmcoli-ui-registryComponentsFree2 deps
MicroClub Alertmc-alertmcoli-ui-registryComponentsFree1 dep
MicroClub Alert Dialogmc-alert-dialogmcoli-ui-registryComponentsFree1 dep
MicroClub Avatarmc-avatarmcoli-ui-registryComponentsFree1 dep
MicroClub Badgemc-badgemcoli-ui-registryComponentsFree1 dep
MicroClub Breadcrumbmc-breadcrumbmcoli-ui-registryComponentsFree2 deps
MicroClub Buttonmc-buttonmcoli-ui-registryComponentsFree2 deps
MicroClub Calendarmc-calendarmcoli-ui-registryComponentsFree3 deps

Also from Kynth Studios

Built for the same person as BlockDex

SkillWorks

Claude Code skills and plugins, scored

skillworks.kynth.studio

RuleStack

AGENTS.md gallery and agent-config comparison

rulestack.kynth.studio

ToolDrift

What the AI coding tools changed last night

tooldrift.kynth.studio

The studio list

One product, taken apart, once a month

Kynth Studios pulls one shipped product open every month — what it does, what it cost to build, what the pipeline behind it looks like, and what the numbers did. One email a month, nothing in between.

Double opt-in — we send one confirmation link and nothing else until you click it.

BlockDex

Built by

Kynth Studios

the studio behind SkillWorks, RuleStack and ToolDrift

part of Toolproof, the measurement layer for AI agent tooling

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

© 2026 BlockDex. A Kynth Studios product. Changelog

BlockDex

The studio list

One product, taken apart, once a month

Kynth Studios pulls one shipped product open every month — what it does, what it cost to build, what the pipeline behind it looks like, and what the numbers did. One email a month, nothing in between.

Double opt-in — we send one confirmation link and nothing else until you click it.

BlockDex

Built by

Kynth Studios

the studio behind SkillWorks, RuleStack and ToolDrift

part of Toolproof, the measurement layer for AI agent tooling

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

© 2026 BlockDex. A Kynth Studios product. Changelog

BlockDex

The studio list

One product, taken apart, once a month

Kynth Studios pulls one shipped product open every month — what it does, what it cost to build, what the pipeline behind it looks like, and what the numbers did. One email a month, nothing in between.

Double opt-in — we send one confirmation link and nothing else until you click it.

BlockDex

Built by

Kynth Studios

the studio behind SkillWorks, RuleStack and ToolDrift

part of Toolproof, the measurement layer for AI agent tooling

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

© 2026 BlockDex. A Kynth Studios product. Changelog

BlockDex