grasscnGitHub

Dialog

A modal composed from the original Minecraft PopupScreen surface.

Preview

0 saved
Loading example...
To run this copied example, install these items using the linked CLI or manual instructions:

Usage

Keep DialogTitle and DialogDescription in DialogHeader. The root defaults to scale 2 and Content inherits it. The example controls open and closes only after its Continue callback has updated the saved count.

Composition

DialogContent owns Portal and Overlay; do not add another default layer. DialogFooter contains DialogClose and real Buttons. Content width 250 is in logical pixels. showCloseButton supports false only: the port closes through footer actions or Escape.

Interaction and limits

A Button used for submit or confirmation must call your open-state setter when the action succeeds. DialogClose closes automatically. Focus trapping and return are Base UI behavior; responsive overflow and custom rich content are web adaptations beyond the fixed native PopupScreen cases.

See the upstream API for the underlying part and event contracts.

Installation

Loading registry address

Component source

This is the component implementation. Its supporting styles, helpers and resources are also required. See complete manual installation.

Component implementationcomponents/ui/dialog.tsx · tsx
"use client";

import { Dialog as DialogPrimitive } from "@base-ui/react/dialog";
import * as React from "react";

import { Button } from "./button";
import { minecraftCardSprite } from "./minecraft-card-sprite";
import { MinecraftDialogBackdrop } from "./minecraft-dialog-backdrop";
import {
  DialogLayoutContext,
  MinecraftDialogText,
} from "./minecraft-dialog-text";

Interactive playground

Confirmed 0 timesEdit your details, then save