# Confirm

Yes/No confirmation prompt



<ComponentPreview base="opentui" name="confirm-demo" />

Installation [#installation]

<CodeTabs>
  <TabsList>
    <TabsTrigger value="cli">
      Command
    </TabsTrigger>

    <TabsTrigger value="manual">
      Manual
    </TabsTrigger>
  </TabsList>

  <TabsContent value="cli">
    ```bash
    npx shadcn@latest add @termcn/opentui-confirm
    ```
  </TabsContent>

  <TabsContent value="manual">
    <Steps>
      <Step>
        Copy and paste the following code into your project.
      </Step>

      <ComponentSource base="opentui" name="confirm" title="components/ui/confirm.tsx" />

      <Step>
        Update the import paths to match your project setup.
      </Step>
    </Steps>
  </TabsContent>
</CodeTabs>

Usage [#usage]

```tsx
import { Confirm } from "@/components/ui/confirm";
```

```tsx
<Confirm
  message="Are you sure you want to continue?"
  onConfirm={() => console.log("Confirmed")}
  onCancel={() => console.log("Cancelled")}
/>
```

API Reference [#api-reference]

Confirm [#confirm]

| Prop           | Type                    | Default     |
| -------------- | ----------------------- | ----------- |
| `message`      | `string`                | `required`  |
| `onConfirm`    | `() => void`            | -           |
| `onCancel`     | `() => void`            | -           |
| `confirmLabel` | `string`                | `"Yes"`     |
| `cancelLabel`  | `string`                | `"No"`      |
| `defaultValue` | `boolean`               | `false`     |
| `variant`      | `"default" \| "danger"` | `"default"` |
