Modal
Modal is used to show a dialog or a box when you click a button.
Import
import { Modal } from '@sigx/daisyui';
Basic Usage
A basic modal with header, body, and action buttons.
Loading preview...
Close on Backdrop Click
By default, the modal includes a backdrop. Clicking outside the modal-box closes it.
Loading preview...
Custom Width
Pass a custom class to control the modal-box width.
Loading preview...
Position: Top
Loading preview...
Position: Bottom
Loading preview...
Without Backdrop
Set backdrop={false} to drop the dimming backdrop. The modal opens
non-modally, so the rest of the page stays interactive — close it with the
button or Esc (clicking outside does nothing).
Loading preview...
Props
| Prop | Type | Default | Description |
|---|---|---|---|
model | Signal<boolean> | undefined | Two-way binding for open/close state |
position | 'top' | 'middle' | 'bottom' | undefined | Vertical position of the modal |
align | 'start' | 'end' | undefined | Horizontal alignment of the modal |
backdrop | boolean | true | Show a dimming, click-to-close backdrop. false opens the modal non-modally (no dim, page stays interactive; close via button/Esc) |
background | BackgroundColor | - | Modal-box background |
rounded | RadiusValue | boolean | - | Modal-box rounding (true → theme rounded-box) |
width | SizeValue | - | Modal-box width — Tailwind step or unitful value ("560px", "50%") |
height | SizeValue | - | Modal-box height — same value format as width |
padding | Spacing | - | Modal-box padding |
class | string | undefined | Additional CSS classes applied to the modal-box |
Sub-components
| Component | Description |
|---|---|
Modal.Header | Title area with an automatic close button |
Modal.Body | Content area with vertical padding |
Modal.Actions | Action buttons area (uses modal-action class) |