Design System

Component usage guide template

Browse Components

ui

Dialog Panel

Wrapper cho Dialog với layout chuẩn hóa, preset size và khả năng forward toàn bộ props của DialogContent.

1. Import
Import root, trigger và dialog panel wrapper.
import {
  DialogPanel,
  DialogPanelRoot,
  DialogPanelTrigger,
} from "@/design-system/components/ui/dialog-panel"
2. Props
DialogPanel kế thừa toàn bộ props của DialogContent.
PropTypeDefault
size"sm" | "md" | "lg" | "xl" | "auto""md"
titleReact.ReactNode--
descriptionReact.ReactNode--
footerReact.ReactNode--
showCloseButtonbooleantrue
classNamestring--
3. Usages
Các pattern phổ biến cho dialog wrapper.
import {
  DialogPanel,
  DialogPanelRoot,
  DialogPanelTrigger,
} from "@/design-system/components/ui/dialog-panel";
import { Button } from "@/design-system/components/ui/button";
import { Input } from "@/design-system/components/ui/input";

export function Example() {
  return (
    <DialogPanelRoot>
      <DialogPanelTrigger render={<Button variant="outline">Mở dialog</Button>} />
      <DialogPanel
        title="Cập nhật hồ sơ"
        description="Dùng wrapper thống nhất cho dialog center."
        footer={
          <>
            <Button variant="outline">Hủy</Button>
            <Button>Lưu thay đổi</Button>
          </>
        }
      >
        <div className="grid gap-3">
          <Input label="Họ và tên" placeholder="Nguyễn Văn A" />
          <Input label="Email" placeholder="name@company.vn" />
        </div>
      </DialogPanel>
    </DialogPanelRoot>
  );
}