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
Disable the backdrop to prevent closing by clicking outside.
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 | Whether to show a clickable backdrop to close the modal |
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) |