# Mintlify Confirmation

Asks the person to approve or deny a tool call before it runs.

Build a Confirmation in this project that looks and behaves like Mintlify's. Measured from the running Mintlify app (mintlify.com). Keep every value exact. Map the tokens onto the project's own theme variables instead of hard-coding them. Use the project's own component library for behaviour, or Base UI primitives if it has none.

Fidelity: Partly measured from the Mintlify assistant's ask-user card. Read from the assistant's class strings; the card only appears mid-answer and the reply wasn't kept.

## Tokens

| Token | Light | Dark |
| --- | --- | --- |
| `--focus-ring` | `rgb(22 110 63)` | `rgb(38 189 108)` |
| `--font-regular` | `"Inter", "Inter Variable", -apple-system, "system-ui", "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif, "Apple Color Emoji", "Segoe UI Emoji"` | `"Inter", "Inter Variable", -apple-system, "system-ui", "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif, "Apple Color Emoji", "Segoe UI Emoji"` |
| `--font-monospace` | `"Paper Mono", ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace` | `"Paper Mono", ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace` |
| `--font-size-mini` | `0.75rem` | `0.75rem` |
| `--font-size-small` | `0.875rem` | `0.875rem` |
| `--font-weight-medium` | `500` | `500` |
| `--ease-in-out` | `cubic-bezier(0.4, 0, 0.2, 1)` | `cubic-bezier(0.4, 0, 0.2, 1)` |
| `--duration-short` | `0.15s` | `0.15s` |
| `--assistant-text-strong` | `rgb(10 13 12)` | `#ffffff` |
| `--assistant-text-subtle` | `rgb(80 83 81)` | `rgb(159 161 160)` |
| `--assistant-text-muted` | `rgb(112 115 113)` | `rgb(159 161 160)` |
| `--assistant-border` | `rgb(223 225 224)` | `rgb(255 255 255 / 0.1)` |
| `--assistant-border-weak` | `rgb(238 241 239)` | `rgb(255 255 255 / 0.07)` |
| `--assistant-tag-bg` | `rgb(238 241 239)` | `rgb(255 255 255 / 0.1)` |
| `--assistant-accent` | `rgb(22 110 63)` | `rgb(38 189 108)` |
| `--assistant-error-bg` | `rgb(254 242 242 / 0.9)` | `rgb(69 10 10 / 0.9)` |
| `--assistant-error-subtle` | `#dc2626` | `#f87171` |
| `--assistant-solid` | `#000000` | `#ffffff` |
| `--assistant-solid-text` | `#ffffff` | `#000000` |
| `--assistant-press` | `rgb(10 13 12 / 0.03)` | `rgb(255 255 255 / 0.03)` |
| `--codegroup-bg` | `rgb(243 246 244)` | `rgb(255 255 255 / 0.05)` |
| `--codegroup-border` | `rgb(10 13 12 / 0.1)` | `rgb(255 255 255 / 0.1)` |
| `--code-text` | `#1f2328` | `#d4d4d4` |
| `--assistant-surface` | `#ffffff` | `rgb(10 13 13)` |

## CSS

Scoped under `[data-style="mintlify"]`; dark rules sit under `[data-theme="dark"]`. The `ui-*` classes and data attributes match the structure below.

```css
[data-style="mintlify"] {
  .ui-confirmation {
    box-sizing: border-box;
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    grid-template-areas:
      "icon content"
      "actions actions";
    column-gap: 8px;
    row-gap: 4px;
    padding: 6px;
    border: 1px solid var(--assistant-border-weak);
    border-radius: 16px;
    background-color: var(--assistant-surface);
    color: var(--assistant-text-subtle);
    font-family: var(--font-regular);
    font-size: var(--font-size-small);
    line-height: 20px;
    -webkit-font-smoothing: antialiased;
  }

  .ui-confirmation-icon {
    grid-area: icon;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    margin: 6px 0 0 8px;
    border-radius: 8px;
    background-color: var(--assistant-tag-bg);
    color: var(--assistant-text-muted);

    & svg {
      width: 16px;
      height: 16px;
    }
  }

  .ui-confirmation[data-state="approved"] .ui-confirmation-icon {
    background-color: color-mix(in srgb, var(--assistant-accent) 12%, transparent);
    color: var(--assistant-accent);
  }

  .ui-confirmation[data-state="denied"] .ui-confirmation-icon {
    background-color: var(--assistant-error-bg);
    color: var(--assistant-error-subtle);
  }

  .ui-confirmation-content {
    grid-area: content;
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
    padding: 6px 8px 6px 0;
  }

  .ui-confirmation-title {
    margin: 0;
    color: var(--assistant-text-strong);
    font-size: var(--font-size-small);
    font-weight: var(--font-weight-medium);
    line-height: 20px;
    letter-spacing: -0.1px;
    overflow-wrap: anywhere;
  }

  .ui-confirmation-description {
    margin: 0;
    color: var(--assistant-text-subtle);
  }

  .ui-confirmation-code {
    box-sizing: border-box;
    margin: 6px 0 0;
    padding: 6px 10px;
    overflow-x: auto;
    border: 1px solid var(--codegroup-border);
    border-radius: 10px;
    background-color: var(--codegroup-bg);
    color: var(--code-text);
    font-family: var(--font-monospace);
    font-size: var(--font-size-mini);
    line-height: 20px;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
  }

  .ui-confirmation-actions {
    grid-area: actions;
    display: flex;
    gap: 6px;
    padding: 4px 2px 2px;

    & .ui-button {
      flex: 1;
      height: 32px;
      padding: 6px 10px;
      border: 1px solid var(--assistant-border);
      border-radius: 10px;
      background-color: var(--assistant-surface);
      box-shadow: none;
      color: var(--assistant-text-strong);
      font-family: var(--font-regular);
      font-size: var(--font-size-small);
      font-weight: var(--font-weight-medium);
      line-height: 20px;
      letter-spacing: -0.1px;
      transition: background-color var(--duration-short) var(--ease-in-out);

      @media (hover: hover) {
        &:hover:not([data-disabled]) {
          background-color: var(--assistant-press);
          color: var(--assistant-text-strong);
        }
      }

      &:focus-visible {
        box-shadow: none;
        outline: 2px solid var(--focus-ring);
        outline-offset: 2px;
      }
    }

    & .ui-button[data-variant="primary"] {
      border-color: transparent;
      background-color: var(--assistant-solid);
      color: var(--assistant-solid-text);

      @media (hover: hover) {
        &:hover:not([data-disabled]) {
          background-color: var(--assistant-solid);
          color: var(--assistant-solid-text);
          opacity: 0.85;
        }
      }
    }
  }

  @media (prefers-reduced-motion: reduce) {
    .ui-confirmation-actions .ui-button {
      transition: none;
    }
  }
}
```

## Structure

How Replicas assembles it on Base UI.

```tsx
import type { ComponentProps } from "react";
import { join } from "./utils";

type RootProps = ComponentProps<"div"> & {
  state?: "pending" | "approved" | "denied";
};

function Root({ className, state = "pending", role, ...props }: RootProps) {
  return (
    <div
      role={role ?? (state === "pending" ? "group" : "status")}
      className={join("ui-confirmation", className)}
      data-state={state}
      {...props}
    />
  );
}

const part = (name: string) =>
  function Part({ className, ...props }: ComponentProps<"div">) {
    return <div className={join(`ui-confirmation-${name}`, className)} {...props} />;
  };

function Title({ className, ...props }: ComponentProps<"p">) {
  return <p className={join("ui-confirmation-title", className)} {...props} />;
}

function Description({ className, ...props }: ComponentProps<"p">) {
  return <p className={join("ui-confirmation-description", className)} {...props} />;
}

function Code({ className, ...props }: ComponentProps<"pre">) {
  return <pre className={join("ui-confirmation-code", className)} {...props} />;
}

export const Confirmation = {
  Root,
  Icon: part("icon"),
  Content: part("content"),
  Title,
  Description,
  Code,
  Actions: part("actions"),
};
```

## Example

```tsx
import { Button, Confirmation } from "@replicas/ui";

export default function ConfirmationDemo() {
  return (
    <Confirmation.Root style={{ width: "100%", maxWidth: 420 }}>
      <Confirmation.Icon>
        <svg viewBox="0 0 16 16" fill="none" aria-hidden>
          <path d="M3.5 5l3 3-3 3M8 11h4.5" stroke="currentColor" strokeWidth="1.5" strokeLinecap="round" strokeLinejoin="round" />
        </svg>
      </Confirmation.Icon>
      <Confirmation.Content>
        <Confirmation.Title>Run this command?</Confirmation.Title>
        <Confirmation.Description>It deletes the build folder in this project.</Confirmation.Description>
        <Confirmation.Code>rm -rf dist</Confirmation.Code>
      </Confirmation.Content>
      <Confirmation.Actions>
        <Button size="small">Deny</Button>
        <Button size="small" variant="primary">
          Approve
        </Button>
      </Confirmation.Actions>
    </Confirmation.Root>
  );
}
```

## Foundations

The rest of the Mintlify style, as a skill: https://replicas.raphaelsalaja.com/skills/mintlify/SKILL.md