All components
Chewypixel component

Dialog

A dialog that springs up over a light overlay and animates out before it closes.

Installation

npx shadcn@latest add https://chewypixel.io/r/dialog.json

Usage

import { Button } from "@/components/ui/button";
import {
  Dialog,
  DialogClose,
  DialogContent,
  DialogDescription,
  DialogFooter,
  DialogHeader,
  DialogTitle,
  DialogTrigger,
} from "@/components/ui/dialog";
import { Input } from "@/components/ui/input";
import { Label } from "@/components/ui/label";

export function RenameWorkspace() {
  return (
    <Dialog>
      <DialogTrigger asChild>
        <Button variant="outline">Rename workspace</Button>
      </DialogTrigger>
      <DialogContent className="sm:max-w-sm">
        <DialogHeader>
          <DialogTitle>Rename workspace</DialogTitle>
          <DialogDescription>Everyone in the workspace sees the new name.</DialogDescription>
        </DialogHeader>
        <div className="grid gap-2">
          <Label htmlFor="workspace-name">Name</Label>
          <Input id="workspace-name" defaultValue="Gumdrop" />
        </div>
        <DialogFooter>
          <DialogClose asChild>
            <Button variant="outline">Cancel</Button>
          </DialogClose>
          <Button>Save</Button>
        </DialogFooter>
      </DialogContent>
    </Dialog>
  );
}

Props

open

Whether it's open, when controlled. Goes on Dialog.

boolean

onOpenChange

Called when it opens or closes. Goes on Dialog.

(open: boolean) => void

showCloseButton

Shows the round close button in the corner. Goes on DialogContent.

boolean = true

containerClassName

Classes for the box that centers the panel. Goes on DialogContent.

string

Released under the MIT License.

More components

See them in a real app

These components come from Mochi, our admin dashboard template built with Next.js, shadcn/ui and Motion.