shadcnui

how to hide the X at the top of the shadcn dialog box?


The shadcn/ui dialog box by default as a X at the top right hand corner. My design does not have the X. How to hide the X while retaining the esc to close functionality ?

Thanks very much.

enter image description here


Solution

  • in your component/ui/dialog, comment out this:

    <DialogPrimitive.Close className="...">
      <X className="h-4 w-4" />
      <span className="sr-only">Close</span>
    </DialogPrimitive.Close>