Modal

Modal is a neobrutalist React component from Cruise UI. A dialog with a --primary title bar, for confirmations and short forms. Install it with npx shadcn@latest add @cruiseui/modal.

Install

Terminal

npx shadcn@latest add @cruiseui/modal

First time? Installation shows the one-off components.json setup (the @cruiseui registry) and how to turn the theme on.

Example

Corners

When to use it

When to use

Confirming something (delete, cancel order) or a short focused task.

When not to

Long content or navigation (use a page or a Drawer). Never use alert() or confirm().

Props

CruiseModal

PropTypeDefaultDescription
titleReactNode——
childrenReactNode——
trigger?ReactElement<unknown, string | JSXElementConstructor<any>>—Element that opens the modal, e.g. <Button>. Omit when controlled.
footer?ReactNode—Buttons along the bottom.
open?boolean——
onOpenChange?((open: boolean) => void)——
initialFocus?RefObject<HTMLElement | null>—Element to focus when the modal opens; defaults to the first focusable.

Accessibility

  • Focus moves into the dialog and back to the trigger on close.
  • Esc and the close button both close it.