Dialogs, forms and wizards
Built on the native <dialog>, with no dependencies and tested accessibility.
For : vacation requests, new hires, approvals with a reason, deletes with confirmation and importing from Excel.
npm i nexus-dialogsimport { confirmDelete } from 'nexus-dialogs/patterns'
if (await confirmDelete({ what: 'Laura Méndez' })) {
await api.employees.remove(id)
}
See it in action
It is a mockup you can use: type, click and try the validation. Pick the scene and the appearance; the real dialogs on this page change with the appearance.
Delete Laura Méndez?
Their record will be deleted. This action cannot be undone.
View code
import { confirmDelete } from 'nexus-dialogs/patterns'
import { confirmDelete } from 'nexus-dialogs/patterns'
if (await confirmDelete({ what: 'Laura Méndez' })) {
// delete
}
What’s new
The latest in version 1.1.1. See all changes.
Tabs
General data, appointment and interview in a single dialog, with keyboard and screen reader support. Try it · Guide
Step-by-step tracking
The progress of a candidate or a procedure with status, date and progress, vertical or horizontal. Try it · Guide
Sizes and responsive
Tabs and tracking in sm, md or lg, adapting to the available width, also on phones. Try it · Guide
Safe HTML by default
An html string is shown as text unless you allow it with strictHtml or filter it with sanitize, also in the no-bundler build with Swal.configure. Security
Forms in columns
columns: 'auto': two columns on the phone, three on desktop, and long fields on a full row. Guide
Try it right here
These buttons use this page’s library, not screenshots.
Why
Alerts solve the “Are you sure?” and little else. nexus-dialogs also brings forms with validation, multi-step wizards, Excel import and export, Mexican validators and HR templates.
A real top layer
No z-index wars with Bootstrap, other libraries or your sticky menu. The background becomes inert and scrolling is locked.
Shadow DOM
Your page’s CSS doesn’t break it and its own doesn’t leak out. It works with a strict CSP, without unsafe-inline.
Promises that don’t fail
const r = await dialog.confirm(…) always resolves with { confirmed, denied, value, reason }.
Truly accessible
Correct initial focus, Esc, focus return, errors tied to each field, announced toasts and reduced motion. Tested with axe.
Made for HR and accounting
RFC, CURP, NSS and CLABE with check digit, amounts in pesos, business days and holidays, signature, address by postal code.
Migrate from SweetAlert2
Change the import and your code keeps working. See how to migrate.
One piece instead of several
What in a business system is usually assembled from different packages comes here in a single one, with no dependencies.
| What you need | Usually built with | In nexus-dialogs |
|---|---|---|
| Confirm, approve, warn about changes | An alerts or modals library | confirmDelete, approval, unsavedChanges |
| Forms with validation | A forms library and another for validation | form, with RFC, CLABE and more already validated |
| Dates and business days | A separate calendar component | The daterange field with businessDays |
| Import and export Excel | One more utility, with its own interface | importData and exportData |
| Notices that disappear | A toast library | toast, with “Undo” |
| Accessibility | Checking each piece separately | Focus, keyboard and WCAG 2.2 AA target, with axe tests |
Every piece you add is another version to update and another style to match. Here it is one, with a single theme.
In one line
Each recipe already comes with the right text, buttons, focus and accessibility.
import { dialog } from 'nexus-dialogs'
import { confirmDelete } from 'nexus-dialogs/patterns'
import { form } from 'nexus-dialogs/forms'
import { toast } from 'nexus-dialogs/toast'
if (await confirmDelete({ what: 'Laura Méndez' })) await api.employees.remove(id)
const r = await form({
title: 'New expense',
fields: [
{ name: 'rfc', label: 'Supplier RFC', type: 'rfc', required: true },
{ name: 'amount', label: 'Amount', type: 'money', required: true },
],
})
if (r.confirmed) toast.success('Sent for approval')Modules: install only what you use
Sizes measured when building this site (minified + gzip). Each path is imported separately.
| Path | What for | Size |
|---|---|---|
nexus-dialogs | alert, confirm, prompt, open | 11.2 KB |
nexus-dialogs/forms | form, wizard, formFromJSON and the fields | 24.9 KB |
nexus-dialogs/toast | Queued notices | 5.1 KB |
nexus-dialogs/patterns | Recipes: delete, unsaved, session, approve, bulk actions | 6.2 KB |
nexus-dialogs/import | Import and export CSV and Excel | 10.1 KB |
nexus-dialogs/table | Choose rows from a table | 3.6 KB |
nexus-dialogs/tabs | Accessible tabs, standalone or in a dialog; sizes and responsive | 3.2 KB |
nexus-dialogs/timeline | Step tracking with status, date and progress | 2.9 KB |
nexus-dialogs/mx | RFC, CURP, NSS, CLABE, business days | 1.1 KB |
nexus-dialogs/rrhh | HR templates in JSON | 4.0 KB |
nexus-dialogs/themes | Bootstrap, Tailwind, Material, dark | 1.3 KB |
nexus-dialogs/vue · /react | Plugin and hooks that close the dialogs on unmount | 0.8 KB · 1.0 KB |
nexus-dialogs/swal | SweetAlert2 compatible | 7.5 KB |
Paths that depend on the core share it: it is not downloaded twice.