You only need to wrap your action button as below, following the documentation from https://ui.shadcn.com/docs/components/dialog#custom-close-button
<DialogFooter>
<DialogClose asChild>
<Button onClick={() => { console.log("something") }} type="button">
Do something and close
</Button>
</DialogClose>
</DialogFooter>