Blocks
Best dialog blocks 2026: 9 verified sections
9 dialog blocks from 3 registries, each with a free preview and Pro source code. The table ranks them by real file count and names every publisher.
Key points
- 9 dialog sections from 3 registries, counted on 1 November 2026: only one carries the nested variant.
- Focus moved in on open, returned on close, scrolling locked underneath: three tests to run by hand.
- With a form inside you need a two-file block and a confirmation before closing.
A dialog block is a window above the page, and almost all of its cost is invisible. The catalogue counts 9 from 3 registries, measured on 1 November 2026 on /api/blocks/category/dialog: three base files, and a single block with the nested variant.
The four failures nobody tests in the preview
The first is focus. When the window opens, focus must move into the first useful element; when it closes, focus must return to the button that opened it. A block that skips this leaves keyboard users on the page underneath, and the dialog becomes an obstacle instead of a step. The second is scrolling: if the page below keeps scrolling, a finger on mobile moves the wrong content.
The third is lost content. A window with a form inside that closes on Esc or on an overlay click throws away what the user typed, without asking. The fourth is nesting: opening a second dialog from the first works only when the block manages the focus stack, and most do not.
| Block | Registry | Files | Category |
|---|---|---|---|
| Dialog 01 - Newsletter Subscription Dialog | Shadcn Space | 2 | dialog |
| Form in a Dialog | flx | 2 | form |
| Form in a Dialog | flx | 2 | form |
| Opens in dialog | flx | 1 | opens |
| Command dialog | flx | 1 | command |
| Nested dialog | flx | 1 | nested |
| With dialog | flx | 1 | dialog |
| In dialog | flx | 1 | dialog |
The checks before adopting one
- Whether the window declares a title with an identifier and ties it through aria-labelledby.
- Whether it closes on Esc, on an overlay click and through a visible button, and whether focus returns to the starting point.
- Whether it blocks scrolling underneath and restores it on close.
- Whether the inner form is a separate component, so you can cancel the close when there are unsaved changes.
- The publisher licence, which on blocks with an attached form is the first thing to read.
The file count tells you the use case. Two files mean window and form already separated, which is the right shape when a request goes inside. One file means a confirmation or content window: fine for a notice, wrong for a form, because content and frame cannot be tested apart.
The limitation you must tell the user about
None of the 9 blocks guards unsaved content. There is no check asking for confirmation before closing with pending edits, and no memory of state when the window reopens. The second limitation is the publisher licence, which covers the component and not the behaviour: you verify that yourself, with a keyboard, in thirty seconds.
The rule that avoids the wrong window
If a form goes inside, take the two-file block with separate content and add a close confirmation. If it is a plain confirmation, no block is needed: the primitive plus thirty lines is enough and leaves you the button wording. And when the content exceeds the screen height, consider a side panel, which is easier to dismiss on mobile and does not hide the context.
The alternative is a dedicated page. It costs one extra navigation and has none of the focus, scrolling and stacking problems, because there is only one context. A window pays off when the action is brief and must not lose the user's place; a page pays off when the action has several steps or needs the browser back button.
Long content deserves its own test. A window with twenty lines of text on a 640-pixel screen must scroll inside itself, with the heading and buttons pinned. If the block scrolls the whole window, the close button leaves the screen and the user has no visible exit. Try the preview while shrinking the browser height: it is the fastest test and the most neglected one.
curl "https://ui.eneawork.it/api/blocks/category/dialog?limit=10"
The windows are in /blocks/category/dialog, base components in /components/cat/dialog and close icons in /icons. The complete case is in an accessible dialog with shadcn, the manual test in accessibility testing with axe; the comparison between a window and a side panel is in portals and modals in React.
Frequently asked questions
Where should focus go when the window opens?
Into the first useful element, or onto the container when there are no controls; on close it must return exactly to the button that opened it.
Why does the page underneath keep scrolling?
Because the block never locks document scrolling. Add the lock and remove it on close, otherwise the page stays frozen.
How do I prevent closing with unsaved data?
Keep the form in a separate component and intercept the close request: without this, Esc deletes the user's work.
Does a dialog inside another one work?
Only when the block manages the focus stack. If it does not, the second opens beneath the first or focus returns to the wrong place.
A window or a dedicated page?
The window for brief actions that must not lose context, the page when there are several steps or the browser back button is needed.