Alert Dialog
A modal confirmation dialog with focus trap, Escape, and confirm/cancel actions.
Preview
Are you absolutely sure?
This action cannot be undone. This will permanently delete your account and remove your data from our servers.
Controls
Device view renders in an isolated frame so real responsive breakpoints apply. Switch to Full for overflowing popovers.
Installation
php artisan ui:add alert-dialog
Behavior layer (Alpine)
This component installs a self-registering Alpine module to
resources/js/ui/alert-dialog.js. Import the behavior layer once
from your bundle so it loads (it hooks alpine:init):
import './alert-dialog.js';
Registry contract
Install confidence
php artisan ui:add alert-dialog
writes only the generated targets below. The CLI validates each file hash before writing and
prompts before replacing local changes unless --force is used.
- Version
- 1.0.0
- License
- open
- Stability
- stable
- Contract
- v2
- Foundation
- ≥ 1.0.0
| Type | Generated target |
|---|---|
| blade | resources/views/components/ui/alert-dialog.blade.php |
| blade | resources/views/components/ui/alert-dialog/trigger.blade.php |
| blade | resources/views/components/ui/alert-dialog/content.blade.php |
| blade | resources/views/components/ui/alert-dialog/header.blade.php |
| blade | resources/views/components/ui/alert-dialog/title.blade.php |
| blade | resources/views/components/ui/alert-dialog/description.blade.php |
| blade | resources/views/components/ui/alert-dialog/footer.blade.php |
| blade | resources/views/components/ui/alert-dialog/cancel.blade.php |
| blade | resources/views/components/ui/alert-dialog/action.blade.php |
| js | resources/js/ui/alert-dialog.js |
Registry dependencies
None.
Package dependencies
composer: jml/brok:^1.0
npm: alpinejs
Guidance
Focused overlayHandle a short focused interruption or blocking decision.
Use when
- Use for short, self-contained work that benefits from preserving page context, or for interruptions that truly deserve focused attention. Do not use for long forms, multi-step tasks, or broad comparison work that needs more room and less interruption.
Avoid when
- Use only when the user must acknowledge or decide about a consequential condition before continuing.
- Task length
- short
- Interaction cost
- high
- Interruptiveness
- high
- Input precision
- none
- Mobile / touch risk
- high
- Accessibility risk
- high
- Needs background context
- Yes
- Comparison needed
- No
Preferred alternatives
- Inline content
- Drawer or dedicated page for longer tasks
Anti-patterns
- Long forms in dialogs
- Multi-step or comparison-heavy modal workflows
API
manifest knowledge + registry-derived coverageProps
No documented props. Pass normal Blade attributes through the component root.
Slots
default— Primary Blade slot rendered by the component.x-ui.alert-dialog.trigger— Installed subcomponent from the registry item.x-ui.alert-dialog.content— Installed subcomponent from the registry item.x-ui.alert-dialog.header— Installed subcomponent from the registry item.x-ui.alert-dialog.title— Installed subcomponent from the registry item.x-ui.alert-dialog.description— Installed subcomponent from the registry item.x-ui.alert-dialog.footer— Installed subcomponent from the registry item.x-ui.alert-dialog.cancel— Installed subcomponent from the registry item.x-ui.alert-dialog.action— Installed subcomponent from the registry item.
Data slots
alert-dialog
alert-dialog-action
alert-dialog-cancel
alert-dialog-content
alert-dialog-description
alert-dialog-footer
alert-dialog-header
alert-dialog-overlay
alert-dialog-portal
alert-dialog-title
alert-dialog-trigger
Capabilities
Behavior
- Uses server-rendered Blade and semantic HTML.
- Installs a JavaScript behavior module when the registry item includes resources/js/ui files.
- Declares registry capability flags: a11y, interactive, responsive, rtl, darkMode, localized.
Usage
<x-ui.alert-dialog>
<x-ui.alert-dialog.trigger class="inline-flex h-10 items-center justify-center rounded-md bg-destructive px-4 text-sm font-medium text-destructive-foreground transition-colors hover:bg-destructive/90 focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background">
{{ __('Delete account') }}
</x-ui.alert-dialog.trigger>
<x-ui.alert-dialog.content>
<x-ui.alert-dialog.header>
<x-ui.alert-dialog.title>{{ __('Are you absolutely sure?') }}</x-ui.alert-dialog.title>
<x-ui.alert-dialog.description>{{ __('This action cannot be undone. This will permanently delete your account and remove your data from our servers.') }}</x-ui.alert-dialog.description>
</x-ui.alert-dialog.header>
<x-ui.alert-dialog.footer>
<x-ui.alert-dialog.cancel>{{ __('Cancel') }}</x-ui.alert-dialog.cancel>
<x-ui.alert-dialog.action>{{ __('Continue') }}</x-ui.alert-dialog.action>
</x-ui.alert-dialog.footer>
</x-ui.alert-dialog.content>
</x-ui.alert-dialog>
Accessibility & localization
data-slot
Keyboard focus-visible
Localized labels
- Accessibility target: wcag-2.2-aa-target.
- Uses semantic HTML and a stable
data-slotattribute for styling/scripting hooks. - Focus-visible rings use the
ringtoken so keyboard focus is always visible. - Disabled and invalid states are conveyed to assistive tech, not by color alone.
- Targets WCAG 2.2 AA; verify contrast in light, dark, admin and customer surfaces above.
- Labels go through
__()and the component uses logical properties (ms-*,text-start,start-*) so it mirrors correctly — flip the preview to RTL to confirm.
Source
The exact, editable file ui:add writes
into your app — copy it or own the whole thing. Previews
render this same code; there are no preview-only components.
Changelog
Current version: v1.0.0. See the site changelog for the full release history.