# Dialog

shadcn's dialog (Radix) in Candor's theme.

- Registry name: `dialog` (`@candor/dialog`)
- Tier: Pro. Installing it needs a Pro, Premium or Team licence key: the person runs `npx candor-ui key <key>` themselves; never ask for the key in chat or write it to a file.
- Docs: https://candor.themethodic.com/docs/dialog

## Install

```bash
npx candor-ui add dialog
```

Run `npx candor-ui@latest init` once first (https://candor.themethodic.com/get-started.md). Without the CLI: `npx shadcn@latest add @candor/dialog`.
It brings in: button, locale, render-prop, utils.
npm packages: lucide-react@^1.67.0, radix-ui@^1.8.1.

## Example

```tsx
"use client"

import { Button } from "@/components/ui/button"
import { Dialog, DialogClose, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogTitle, DialogTrigger } from "@/components/ui/dialog"

export default function Example() {
  return (
    <Dialog>
      <DialogTrigger asChild>
        <Button variant="destructive">Roll back migration</Button>
      </DialogTrigger>
      <DialogContent>
        <DialogHeader>
          <DialogTitle>Roll back 0142 on Production?</DialogTitle>
          <DialogDescription>Drops the region column from customers. The 18,240 backfilled values are lost.</DialogDescription>
        </DialogHeader>
        <DialogFooter>
          <DialogClose asChild>
            <Button variant="outline">Cancel</Button>
          </DialogClose>
          <DialogClose asChild>
            <Button variant="destructive">Roll back</Button>
          </DialogClose>
        </DialogFooter>
      </DialogContent>
    </Dialog>
  )
}
```

## <Dialog>

No props.

Also takes the props of `React.ComponentProps<typeof DialogPrimitive.Root>`.

## <DialogClose>

No props.

Also takes the props of `React.ComponentProps<typeof DialogPrimitive.Close>`, `RenderProp`.

## <DialogContent>

Props:

- `showCloseButton?: boolean | undefined` (default `true`): Shows the close (×) button in the corner. Defaults to true.

Also takes the props of `React.ComponentProps<typeof DialogPrimitive.Content>`.

## <DialogDescription>

No props.

Also takes the props of `React.ComponentProps<typeof DialogPrimitive.Description>`.

## <DialogFooter>

Props:

- `showCloseButton?: boolean | undefined` (default `false`): Adds a Close button to the footer. Defaults to false.

Also takes the props of `React.ComponentProps<"div">`.

## <DialogHeader>

No props.

Also takes the props of `React.ComponentProps<"div">`.

## <DialogOverlay>

No props.

Also takes the props of `React.ComponentProps<typeof DialogPrimitive.Overlay>`.

## <DialogPortal>

No props.

Also takes the props of `React.ComponentProps<typeof DialogPrimitive.Portal>`.

## <DialogTitle>

No props.

Also takes the props of `React.ComponentProps<typeof DialogPrimitive.Title>`.

## <DialogTrigger>

No props.

Also takes the props of `React.ComponentProps<typeof DialogPrimitive.Trigger>`, `RenderProp`.

## Strings (`dialog`)

The fixed words, English by default. Override any of them under `dialog` in `<LocaleProvider strings={{ dialog: { … } }}>`; the table is exported as `dialogStrings`.

- `close`: Close

## Rules for using Candor UI

- Components take plain typed data. Never pass model output as HTML or render it as a link; messages are typed blocks.
- A control that can't be used says why: wrap it in `<Locked reason="…">`, don't just disable it.
- Don't show a value you don't have: leave it out (it renders as —) rather than guess. An estimate is labelled as one.
- Nothing is pre-selected in a decision a person makes, and the agent is named from your app's data, never from model output.
- Your app's words go in `LocaleProvider` (fixed strings) and `TermsProvider` (nouns); entity kinds and agent roles in `EntityKindsProvider` and `AgentRolesProvider`.
