Browse docsDialog

Overlays

Glass Dialog

A modal glass dialog with an overlay, a focus trap and a close button.

Preview

Demos ready. Update 0.

Installation

For React 19+ apps with Tailwind CSS 4.

npx shadcn@4.14.1 add @glassyui/glass-dialog

Adds 12 files to components/glassyui and installs @radix-ui/react-dialog and clsx.

Usage

Usage

import { GlassDialog, GlassDialogContent, GlassDialogTitle, GlassDialogTrigger } from "@/components/glassyui/glass-dialog";

export function DialogDemo() {
  return (
    <GlassDialog>
      <GlassDialogTrigger>Open</GlassDialogTrigger>
      <GlassDialogContent>
        <GlassDialogTitle>Glass dialog</GlassDialogTitle>
      </GlassDialogContent>
    </GlassDialog>
  );
}

Examples

Modal content

<GlassDialogContent>Modal content</GlassDialogContent>

API reference

GlassDialog

PropTypeDefaultDescription
open / defaultOpenbooleanfalseControlled or uncontrolled open state.
onOpenChange(open: boolean) => voidNoneCalled when the dialog opens or closes.
modalbooleantrueTraps focus and makes the page behind inert.

Also accepts Radix Dialog.Root props.

GlassDialogTrigger

Opens the dialog.

PropTypeDefaultDescription
asChildbooleanfalseRenders your own element, such as a GlassButton, as the trigger.

Also accepts Radix Dialog.Trigger props.

GlassDialogContent

Renders the portal, overlay, glass panel and a close button in the corner.

PropTypeDefaultDescription
closeLabelstring'Close dialog'Accessible name of the built-in close button.
thicknessnumberthickness preferenceGlass thickness as a multiple of regular (1); thicker glass bends the backdrop further at the rim.
classNamestringNoneApplies to the glass panel.

Also accepts Radix Dialog.Content props.

GlassDialogTitle

The dialog's heading and accessible name.

Also accepts Radix Dialog.Title props.

GlassDialogDescription

Supporting text, linked to the dialog with aria-describedby.

Also accepts Radix Dialog.Description props.

GlassDialogPortal / GlassDialogOverlay

The portal and the dimmed overlay. GlassDialogContent already renders both; use them only to build your own content.

Also accepts Radix Dialog.Portal and Dialog.Overlay props.

Types
GlassDialogContentProps
Accessibility
Put a GlassDialogTitle in every dialog; the dialog takes its accessible name from it.