Modal
A window over the page, with the page dimmed behind it.
A window over the page, with the page dimmed behind it.
npm install @heroui/react lucide-react
First time with HeroUI? Set it up once.
/**
* Demo from HeroUI, https://heroui.com (docs example modal/default.tsx).
* Apache-2.0, Copyright 2025 NextUI Inc. Full text: https://github.com/heroui-inc/heroui/blob/main/LICENSE
* Changed for Tastebud: a default export (HeroUI's docs use named ones); lucide-react icons instead of
* @gravity-ui/icons.
*/
"use client";
import {Rocket} from "lucide-react";
import {Button, Modal} from "@heroui/react";
export default function ModalDemo() {
return (
<Modal>
<Button variant="secondary">Open Modal</Button>
<Modal.Backdrop>
<Modal.Container>
<Modal.Dialog className="sm:max-w-[360px]">
<Modal.CloseTrigger />
<Modal.Header>
<Modal.Icon className="bg-default text-foreground">
<Rocket className="size-5" />
</Modal.Icon>
<Modal.Heading>Welcome to HeroUI</Modal.Heading>
</Modal.Header>
<Modal.Body>
<p>
A beautiful, fast, and modern React UI library for building accessible and
customizable web applications with ease.
</p>
</Modal.Body>
<Modal.Footer>
<Button className="w-full" slot="close">
Continue
</Button>
</Modal.Footer>
</Modal.Dialog>
</Modal.Container>
</Modal.Backdrop>
</Modal>
);
}
Changed for this site: A default export (HeroUI's docs use named ones); lucide-react icons instead of @gravity-ui/icons.