@chaesunbak/registry
Components

Responsive Dialog

모바일에서는 Drawer로, 데스크톱에서는 Dialog로 자동 전환되는 반응형 대화상자 컴포넌트입니다.

"use client";

import { useState } from "react";
import { Button } from "@/components/ui/button";
import { ResponsiveDialog } from "@/components/responsive-dialog";

export function ResponsiveDialogExample() {
  const [open, setOpen] = useState(false);

  return (
    <>
      <Button onClick={() => setOpen(true)}>Open Dialog</Button>
      <ResponsiveDialog
        isOpen={open}
        setIsOpen={setOpen}
        title="Edit profile"
        description="Make changes to your profile here. Click save when you're done."
      >
        <p className="text-sm text-muted-foreground">
          Dialog content goes here.
        </p>
      </ResponsiveDialog>
    </>
  );
}

설치

pnpm

pnpm dlx shadcn@latest add @chaesunbak/responsive-dialog

npm

npx shadcn@latest add @chaesunbak/responsive-dialog

사용법

import { ResponsiveDialog } from "@/components/responsive-dialog";
<ResponsiveDialog
  isOpen={open}
  setIsOpen={setOpen}
  title="Edit profile"
  description="Make changes to your profile here. Click save when you're done."
>
  <button>open dialog</button>
</ResponsiveDialog>

인터페이스

ResponsiveDialog

속성타입기본값
isOpenboolean-
setIsOpenDispatch<SetStateAction<boolean>>-
titlestring-
descriptionstringundefined
childrenReactNode-

On this page