MCPcopy Create free account
hub / github.com/boringstack-xyz/boringstack / DialogContent

Function DialogContent

apps/ui/src/components/ui/dialog.tsx:50–89  ·  view source on GitHub ↗
({
  className,
  children,
  showCloseButton = true,
  closeLabel = "Close",
  ...props
}: React.ComponentProps<typeof DialogPrimitive.Content> & {
  showCloseButton?: boolean;
  /*
   * Screen-reader label for the auto-rendered X close button. Defaults
   * to English so the primitive is usable standalone; callers in this
   * app pass `t("common.close")` to honour the user's language.
   */
  closeLabel?: string;
})

Source from the content-addressed store, hash-verified

48}
49
50function DialogContent({
51 className,
52 children,
53 showCloseButton = true,
54 closeLabel = "Close",
55 ...props
56}: React.ComponentProps<typeof DialogPrimitive.Content> & {
57 showCloseButton?: boolean;
58 /*
59 * Screen-reader label for the auto-rendered X close button. Defaults
60 * to English so the primitive is usable standalone; callers in this
61 * app pass `t("common.close")` to honour the user's language.
62 */
63 closeLabel?: string;
64}) {
65 return (
66 <DialogPortal data-slot='dialog-portal'>
67 <DialogOverlay />
68 <DialogPrimitive.Content
69 data-slot='dialog-content'
70 className={cn(
71 "bg-panel border-border-strong/40 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[state=open]:animate-in data-[state=open]:fade-in-0 data-[state=open]:zoom-in-95 fixed top-[50%] left-[50%] z-50 grid w-full max-w-[calc(100%-2rem)] translate-x-[-50%] translate-y-[-50%] gap-4 rounded-xl border p-6 duration-200 outline-none sm:max-w-lg",
72 className
73 )}
74 {...props}
75 >
76 {children}
77 {showCloseButton && (
78 <DialogPrimitive.Close
79 data-slot='dialog-close'
80 className="ring-offset-background focus:ring-ring data-[state=open]:bg-accent data-[state=open]:text-muted-foreground absolute top-4 right-4 rounded-xs opacity-70 transition-opacity hover:opacity-100 focus:ring-2 focus:ring-offset-2 focus:outline-hidden disabled:pointer-events-none [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4"
81 >
82 <XIcon />
83 <span className='sr-only'>{closeLabel}</span>
84 </DialogPrimitive.Close>
85 )}
86 </DialogPrimitive.Content>
87 </DialogPortal>
88 );
89}
90
91function DialogHeader({ className, ...props }: React.ComponentProps<"div">) {
92 return (

Callers

nothing calls this directly

Calls 1

cnFunction · 0.90

Tested by

no test coverage detected