Y2K UI

Dialog

A modal window with the Y2K flat window-chrome aesthetic. The title bar carries three default controls_ (minimize), (maximize), (close) — and each can be hidden via prop. The dialog is triggered from a button click, not auto-opened.

Default — three controls

Click the button below to open the dialog. By default the title bar shows [minimize] [maximize] [close].

dialog-default-demo.app

Hiding individual controls

Each of the three window controls can be hidden via boolean props: hideMinimize, hideMaximize, hideClose.

dialog-hide-controls-demo.app

Installation

terminal.sh
npx y2kui@latest add dialog

Usage

import {
  Dialog,
  DialogContent,
  DialogDescription,
  DialogFooter,
  DialogHeader,
  DialogTitle,
  DialogTrigger,
} from "@/components/ui/dialog";

export function Example() {
  return (
    <Dialog>
      <DialogTrigger asChild>
        <button>Open</button>
      </DialogTrigger>
      <DialogContent title="My window">
        <DialogHeader>
          <DialogTitle>My window</DialogTitle>
          <DialogDescription>Description here.</DialogDescription>
        </DialogHeader>
        <DialogFooter>
          <button>Cancel</button>
          <button>OK</button>
        </DialogFooter>
      </DialogContent>
    </Dialog>
  );
}

Props

Dialog

PropTypeDefaultDescription
openbooleanControlled open state.
defaultOpenbooleanInitial open state (uncontrolled).
onOpenChange(open: boolean) => voidCalled when the dialog open state changes.

DialogContent

PropTypeDefaultDescription
titleReactNodeTitle shown in the Y2K title bar.
hideMinimizebooleanfalseHide the `_` (minimize) window control.
hideMaximizebooleanfalseHide the `▢` (maximize) window control.
hideClosebooleanfalseHide the `✕` (close) window control.
onMinimize() => voidFired when the user clicks the minimize control.
onMaximize() => voidFired when the user clicks the maximize control.

On this page