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.jsonUsage
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
openWhether it's open, when controlled. Goes on Dialog.
boolean
onOpenChangeCalled when it opens or closes. Goes on Dialog.
(open: boolean) => void
showCloseButtonShows the round close button in the corner. Goes on DialogContent.
boolean = true
containerClassNameClasses for the box that centers the panel. Goes on DialogContent.
string
Released under the MIT License.
More components
- SheetA side panel that slides in from any edge of the screen over a light overlay.
- Dropdown MenuA frosted menu that scales out of its trigger and animates out when it closes.
- CommandA command palette whose highlight glides between results as you move through them.
- CollapsibleA section that opens and closes by animating its height.
See them in a real app
These components come from Mochi, our admin dashboard template built with Next.js, shadcn/ui and Motion.