Friday, January 23rd 2026 · 2 min read
Introducing shadcn-modal-manager
We open sourced shadcn-modal-manager - a lightweight, type-safe modal manager for shadcn/ui built with pure React and zero dependencies.
We're excited to open source shadcn-modal-manager - a simple yet robust modal manager for shadcn/ui.
The problem
Managing modals in React typically involves a lot of boilerplate:
const [isOpen, setIsOpen] = useState(false);
const [modalData, setModalData] = useState(null);
// Scattered across your component
<Button onClick={() => {
setModalData(someData);
setIsOpen(true);
}}>
Open Modal
</Button>
<Dialog open={isOpen} onOpenChange={setIsOpen}>
{/* Modal content using modalData */}
</Dialog>This pattern becomes unwieldy when you have multiple modals, need to open modals from deeply nested components, or want to trigger modals from outside React (like event handlers or utility functions).
The solution
shadcn-modal-manager provides a context-driven system that lets you manage modals globally through hooks:
- Open any modal from anywhere in your app
- Pass typed data to modals
- No prop drilling or state lifting
- Works with shadcn's Dialog and Drawer components
Features
- Lightweight - Built with pure React, no external dependencies
- Type-safe - Fully typed with TypeScript
- shadcn/ui compatible - Works seamlessly with Dialog and Drawer components
- Global state - Manage multiple modals through centralized context
- React 16+ - Supports React 16 and later versions
Installation
npm install shadcn-modal-managerWhy we built this
While building our starter kits, we found ourselves repeatedly implementing modal management patterns. Confirmation dialogs, edit forms, detail views - they all needed a clean way to be triggered from various places in the app.
Rather than copy-pasting the same context setup across projects, we extracted it into a reusable package.
Open source
shadcn-modal-manager is MIT licensed and available on GitHub:
Contributions are welcome!
Building a SaaS with shadcn/ui? Check out our starter kits - they come with modal management patterns built in.
Related Articles
CVE-2026-23864 - React Server Components DoS Vulnerabilities
Multiple denial of service vulnerabilities discovered in React Server Components. All Achromatic starter kits updated to patched versions.
Agent Skills Support: npm for AI Coding Agents
Achromatic now supports Vercel Agent Skills, bringing 10+ years of React and Next.js optimization patterns to AI coding assistants like Claude Code, Cursor, and Codex.
Migrate from Lovable, v0 or Replit to a Next.js Codebase
Outgrown your AI-generated prototype? Learn how to transition from Lovable, v0, Bolt, or Replit to a scalable Next.js codebase. We have helped dozens of teams make this move.