Choosing components
Dialog or AlertDialog, Dialog or Sheet, NavigationMenu or DropdownMenu, Select, MultiSelect or Combobox, and more.
Dialog vs AlertDialog
| Dialog | AlertDialog | |
|---|---|---|
| Purpose | Any modal task: forms, details, settings | An interruption that needs an explicit decision (destructive confirmation) |
| Role | dialog | alertdialog |
| Outside press | Closes | Ignored |
| Initial focus | First focusable element | Cancel |
| Escape | Closes | Cancels |
Use AlertDialog sparingly; prefer undo over confirmation when possible.
Dialog vs Sheet
Both are modal dialogs with the same focus management. A Sheet slides from an edge (side:
left, right, top, bottom) and suits secondary content tied to the current page — filters, details,
navigation drawers. A Dialog is centred and suits self-contained tasks. Sheet was called
"Drawer" in earlier proposals; there is no separate Drawer component.
NavigationMenu vs DropdownMenu
| NavigationMenu | DropdownMenu | |
|---|---|---|
| Contains | Links to pages | Commands (actions, toggles, radio choices) |
| Semantics | <nav> with lists and disclosure panels | menu / menuitem roles |
| Typical place | Site header | Account menu, row actions, toolbars |
Do not put navigation links in a DropdownMenu only because it looks right: screen readers announce a menu of commands.
Select vs Combobox
| Select | Combobox | |
|---|---|---|
| Input | A button that opens a listbox | A text input that filters a listbox |
| Best for | Short lists (up to ~15 options) | Long lists, search, server results |
| Typeahead | Jump by first letters | Free typing filters items |
| Value | Always one of the options | Always one of the items (no free text) |
For free text with suggestions, use a native <Input list="…"> with a <datalist>.
Select vs MultiSelect
MultiSelect is the multiple-value counterpart of Select: removable chips beside the trigger
(never inside it), a clear-all button, and announcements when values are removed. For searchable
multiple selection use Combobox with multiple.
Controlled vs uncontrolled inputs
Uncontrolled (defaultValue) is simpler and works with native forms; controlled (value +
onValueChange) lets your state drive the UI. Don't switch a component between the two during its
lifetime. See Forms.
Desktop vs mobile navigation
- Navbar + NavbarNav + MobileMenu: a top bar whose links collapse into a sheet below a
breakpoint.
NavbarNav hideBelow="md"withMobileMenu breakpoint="md"guarantees exactly one is visible. - AppShell + Sidebar: application navigation. Desktop shows a sidebar (expanded or icon rail);
below the shell's
breakpointthe same sidebar content moves into a modal drawer.
Full vs collapsed Sidebar
collapsible="icon" (default) collapses to an icon rail on desktop: labels stay as accessible names
and appear as tooltips on hover and focus. collapsible="offcanvas" hides the sidebar completely when
collapsed. collapsible="none" keeps it expanded. On mobile, the sidebar is always a drawer.
Accordion vs Collapsible
| Accordion | Collapsible | |
|---|---|---|
| Sections | Several related ones | One |
| Trigger | A heading that contains a button | A button |
| Keyboard | Arrow keys, Home and End between headers | Enter and Space |
| State | value (string or list) | open (boolean) |
Switch vs checkbox
A Switch takes effect immediately. A checkbox is a choice that waits for a submit button, or one
of several that can be selected together; use the native <input type="checkbox">.
Toast vs Dialog vs inline message
| Toast | AlertDialog | Inline message | |
|---|---|---|---|
| Use for | Confirming something that already happened | A decision before continuing | Errors about a field or the page |
| Interrupts | No | Yes | No |
| Disappears by itself | Usually | No | No |
Never put the only copy of important information in a toast.