@ninna-ui/overlays
v0.6.0
Published
5 overlay React components for Ninna UI - Modal, Drawer, Popover, Tooltip, DropdownMenu. Radix-powered accessibility, Tailwind CSS v4.
Downloads
228
Maintainers
Readme
@ninna-ui/overlays
5 accessible React overlay components - Modal, Drawer, Popover, Tooltip, and DropdownMenu with built-in focus trapping, scroll locking, and keyboard dismissal. Radix-powered accessibility with zero Radix API leakage.
📖 Full Documentation → | 📦 npm → | 🐙 GitHub →
Production-ready overlay and portal components for Ninna UI. Every component is powered by Radix UI internally for bulletproof accessibility - focus trapping, scroll locking, escape-to-close, click-outside dismissal, and portal rendering are all handled automatically. Radix types never leak into your code - you get a clean, simple API.
Installation
pnpm add @ninna-ui/overlays @ninna-ui/coreCSS Setup
@import "tailwindcss";
@import "@ninna-ui/core/theme/presets/default.css";
@variant dark (&:is(.dark *));HTML Setup
Add the data-theme attribute to your <html> element:
<html data-theme="default">Components
| Component | Description | Radix Engine |
|-----------|-------------|-------------|
| Modal | Dialog with backdrop overlay, focus trap, and scroll lock | DialogEngine |
| Drawer | Slide-in panel from any edge (top, right, bottom, left) | DialogEngine |
| Popover | Floating content anchored to a trigger element | PopoverEngine |
| Tooltip | Lightweight hover/focus hint | TooltipEngine |
| DropdownMenu | Accessible dropdown menu with keyboard navigation | DropdownEngine |
Quick Start
import { Modal, Tooltip, DropdownMenu } from "@ninna-ui/overlays";
import { Button } from "@ninna-ui/primitives";
function App() {
return (
<>
{/* Tooltip */}
<Tooltip>
<Tooltip.Trigger asChild>
<Button color="primary">Save</Button>
</Tooltip.Trigger>
<Tooltip.Content>Save your changes</Tooltip.Content>
</Tooltip>
{/* Modal */}
<Modal>
<Modal.Trigger asChild>
<Button>Open Modal</Button>
</Modal.Trigger>
<Modal.Content>
<Modal.Header>Confirm</Modal.Header>
<Modal.Body>
<p>Are you sure you want to continue?</p>
</Modal.Body>
</Modal.Content>
</Modal>
{/* Dropdown */}
<DropdownMenu>
<DropdownMenu.Trigger asChild>
<Button variant="outline">Options</Button>
</DropdownMenu.Trigger>
<DropdownMenu.Content>
<DropdownMenu.Item>Edit</DropdownMenu.Item>
<DropdownMenu.Item>Duplicate</DropdownMenu.Item>
<DropdownMenu.Separator />
<DropdownMenu.Item destructive>Delete</DropdownMenu.Item>
</DropdownMenu.Content>
</DropdownMenu>
</>
);
}Built-in Behavior
Overlay components include these accessibility features out of the box:
- Focus trapping - Modal and Drawer trap keyboard focus
- Scroll locking - Modal and Drawer lock background scroll while open
- Escape to close - Press Escape to dismiss (component-configurable)
- Click outside - Click outside to dismiss (component-configurable)
- Portal rendering - Overlay content renders in a portal to avoid z-index conflicts
- Animation - Enter/exit animations via CSS keyframes (ninna-enter, ninna-exit)
- z-index layering - Tooltip > DropdownMenu > Popover > Modal/Drawer
All Exports
import {
Modal,
Drawer,
Popover,
Tooltip,
DropdownMenu,
} from "@ninna-ui/overlays";Related Packages
@ninna-ui/core- Design tokens and theme presets (required)@ninna-ui/primitives- Button, Badge, and other trigger components@ninna-ui/feedback- Toast notifications for overlay actions- All packages - Complete package list
