dixitsimform

Dialog

Buttons

About

When dialog becomes too long for the user’s viewport or device, its scroll independent of the page itself.

Built with React and Tailwind. Copy the prompt and paste it into Claude Code, Cursor or Lovable: your agent adds Dialog to your project and fits it to your theme.

Code

How Dialog is used: the demo's code. The component's own source comes with a free account.

Usage.tsx

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

export default function DemoOne() {
  return (
    <Dialog>
      <DialogTrigger asChild>
        <Button variant="outline">Dialog Scrollable</Button>
      </DialogTrigger>
      <DialogContent className="md:max-w-[640px]">
        <DialogHeader>
          <DialogTitle>Elephant</DialogTitle>
          <DialogDescription>
            Elephants are the largest living land animals.
          </DialogDescription>
        </DialogHeader>
        <div className="flex flex-col gap-4">
          <img
            src="https://cdn.21st.dev/assets/mirror/e7/e749273e0b87f09c99d772c8b7c046e085dcb23e633766a67fa982ded1b681cd.jpg"
            alt="Elephent"
          />
          <p>
            Elephants are the largest living land animals. Three living
            species are currently recognised: the African bush elephant
            (Loxodonta africana), the African forest elephant (L.
            cyclotis), and the Asian elephant (Elephas maximus). They
            are the only surviving members of the family Elephantidae
            and the order Proboscidea; extinct relatives include
            mammoths and mastodons. Distinctive features of elephants
            include a long proboscis called a trunk, tusks, large ear
            flaps, pillar-like legs, and tough but sensitive grey skin.
            The trunk is prehensile, bringing food and water to the
            mouth and grasping objects. Tusks, which are derived from
            the incisor teeth, serve both as weapons and as tools for
            moving objects and digging. The large ear flaps assist in
            maintaining a constant body temperature as well as in
            communication. African elephants have larger ears and
            concave backs, whereas Asian elephants have smaller ears and
            convex or level backs.
          </p>
        </div>
        <DialogFooter className="flex gap-3">
          <DialogClose asChild className="grow">
            <Button variant="outline" className="grow" size={"lg"}>
              Cancel
            </Button>
          </DialogClose>
          <Button type="submit" className="grow" size={"lg"}>
            Okay
          </Button>
        </DialogFooter>
      </DialogContent>
    </Dialog>
  );
}

Dependencies

More in Buttons

View all
  • Button Save

    Button Save

    46
  • Button

    Button

    20
  • Eclipse Button

    Eclipse Button

    5
  • Button

    Button

    6
  • Button

    Button

    14
  • Button Group

    Button Group

    37
  • Button

    Button

    32
  • Split Button

    Split Button

    32