Modal
A highly polished, enterprise-ready Modal component powered by Radix UI and Framer Motion. It supports multiple sizes, screen positions, visual variants, and ensures absolute accessibility out of the box.
ui@radix-ui/react-dialogclass-variance-authorityframer-motionlucide-react
Installation
$npx futureuikit add modal
Import
import { Modal } from "@/components/ui/modal"
Layout Variant
Color Theme
Size
Position
Named Keys & Props
Pass these exact named keys as props on <Modal />. Click any color pill to copy the prop.
colorDefault is "default"(Black & White)variantVisual style"default""floating""glass""elevated""minimal""spotlight"shapeCorner shape"default""square""rounded""sharp"sizeComponent size"xs""sm""md""lg""xl""full-width""full-screen"Usage Example
A basic implementation example to get you started.
Example Implementation
import { Modal, ModalTrigger, ModalContent, ModalHeader, ModalTitle, ModalDescription, ModalBody, ModalFooter, ModalClose } from"@/components/ui/modal";
import { Button } from"@/components/ui/button";
export default function Example() {
return (
<Modal variant="glass"size="md"position="center">
<ModalTrigger asChild>
<Button>Open Modal</Button>
</ModalTrigger>
<ModalContent>
<ModalHeader>
<ModalTitle>Account Settings</ModalTitle>
<ModalDescription>Manage your premium subscription.</ModalDescription>
</ModalHeader>
<ModalBody>
<div className="space-y-4">
<p>Your subscription is active until next year.</p>
</div>
</ModalBody>
<ModalFooter>
<ModalClose asChild>
<Button variant="outline">Close</Button>
</ModalClose>
<Button>Upgrade Plan</Button>
</ModalFooter>
</ModalContent>
</Modal>
);
}Features
Key capabilities and highlights.
Key Capabilities
- ◆Compound architecture: Modal, Trigger, Content, Header, Title, Description, Body, Footer, and Close.
- ◆Six visual variants: Default, Floating, Glass, Elevated, Minimal, and Spotlight.
- ◆Seven sizes: xs, sm, md, lg, xl, full-width, and full-screen.
- ◆Five positions: Center, Top Center, Bottom Sheet, Left Side, and Right Side.
- ◆Flawless accessibility: Focus trapping, Escape key to close, Scroll locking, and ARIA roles.
- ◆Smooth physics-based animations that automatically adapt to the chosen position.
Notes
Important implementation details to consider.
Implementation Details
- ◆Overview: A premium, accessible Modal system designed for modern SaaS applications. Combines Radix UI's bulletproof Dialog primitive with Framer Motion's elegant animations.
- ◆Installation: Run'npx futureuikit add modal'to install the modal component.
- ◆Basic Usage: Wrap your UI with the <Modal> component. Use <ModalTrigger asChild> for the launch button and <ModalContent> for the payload.
- ◆Controlled Usage: Pass'open'and'onOpenChange'to <Modal> to manage the state via React state.
- ◆Uncontrolled Usage: By default, the Modal manages its own state internally.
- ◆Variants: Use the'variant'prop ('default','floating','glass','elevated','minimal','spotlight') to change the backdrop and content styling.
- ◆Sizes: Use the'size'prop ('xs','sm','md','lg','xl','full-width','full-screen') to adjust the modal's maximum width.
- ◆Positions: Use the'position'prop ('center','top-center','bottom-sheet','left-side','right-side') to control where the modal appears and how it animates in.
- ◆Accessibility: The modal automatically handles focus trapping, scroll locking, and Escape key functionality.
- ◆Best Practices: Use the'bottom-sheet'position for mobile-first interactions, and'glass'variant for highly visual interfaces.