Modal
Modal overlay component
Overview
A simplified wrapper around the Dialog UI component with a flat prop API. Suitable for confirmation dialogs, sign-up gates, and announcement modals in marketing contexts.
Usage
import { Modal } from '@leanicon/web-builder-library'
const [open, setOpen] = React.useState(false)
;<Modal
open={open}
onOpenChange={setOpen}
title="Join our newsletter"
description="Get the latest updates delivered to your inbox."
>
<NewsletterSignup />
</Modal>Default
Click the button to open the modal.
With description
Add description for a subtitle below the title.
Confirmation dialog
Modal with action buttons for confirm/cancel patterns.
With form
Modal containing a form with input fields.
Newsletter signup
Modal as a newsletter subscription gate.
Dark mode
Confirmation — dark mode
With form — dark mode
Props
Prop | Type | Default | Description |
|---|---|---|---|
|
| — | Controlled open state (required) |
|
| — | Callback on open/close (required) |
|
| — | Dialog title (required) |
|
| — | Optional subtitle below the title |
|
| — | Modal body content (required) |
|
| — | Force light or dark mode |
|
| — | Additional CSS classes on DialogContent |
Notes
- The modal is fully controlled via
open/onOpenChange. - Built on Radix UI Dialog — supports keyboard navigation (Escape to close) and focus trapping.
- For a trigger button, use the
ModalDemowrapper or manage state yourself. - Dark mode: pass
colorScheme="dark"or place inside a.darkancestor.
Props
| Name | Type | Default | Required | Description |
|---|---|---|---|---|
open | boolean | — | Yes | |
onOpenChange | (open: boolean) => void | — | Yes | |
title | string | — | Yes | |
description | string | — | No | |
colorScheme | enum | — | No | |
className | string | — | No |