# Prompt tray — Detent

> A composer for an AI agent. Files sit on a tray above the words as pills, the + menu holds modes, files and switches, and while it works a quiet dot glyph says the model is thinking.

Canonical: https://detentui.com/components/prompt-tray
Last updated: 2026-12-06

## About

A composer for an AI agent. Files sit on a tray above the words as pills, the + menu holds modes, files and switches, and while it works a quiet dot glyph says the model is thinking.

## When to use

- Use it for: A full composer for an AI agent: files attached above the message, modes like Plan or Debug, web search and extended thinking switches, and a model picker.
- Don't use it for: A light chat input where the model and modes never change. Use [Prompt box](https://detentui.com/components/prompt.md) instead.

## Placement

At the bottom of an agent or chat view, 480 to 720 wide. The + menu and model menu open downward when there is room, so leave space below it or let them flip up.

## For agents

Prompt to give a coding agent: "Add Detent's Prompt tray to this project. Fetch https://detentui.com/components/prompt-tray.md and follow its "For agents" steps."

1. Check package.json: Detent needs React 19 and Tailwind CSS v4. If either is missing or older, stop and tell the user.
2. If the project root has no components.json, run `npx shadcn@latest init --defaults --yes` there.
3. Install it from the project root: `npx shadcn@latest add https://detentui.com/r/prompt-tray`
4. Make sure the root layout (in Next.js, app/layout.tsx) wraps its children once in `<MotionConfig reducedMotion="user">` from motion/react. Add it only if it is not there.
5. Import `PromptTray` from `@/components/detent/components/prompt-tray/PromptTray` and render it where the user asked, sized and placed as the Placement section says. Start from the Example below, keep its layout, and swap in the project's real data.
6. If the project has no real data for it yet, put clearly marked placeholders in one content file. Never invent customer quotes, names or numbers and present them as real.
7. Detent pieces are client components. If you pass them functions (format, onChange, render props), do it from a client component; a server page can only pass plain data, so load the data on the server and hand it to a small client wrapper.
8. Use the Detent theme tokens (like bg-surface, text-ink, text-ink-3) for anything you draw around it, and className where the piece takes one. Don't rewrite its motion or internals.
9. Run the project's typecheck (for example `npx tsc --noEmit`; on a fresh Next.js project run `npx next typegen` first, or it can't find types like LayoutProps). If you can run the app, open the page at a desktop and a phone width and check it renders with no console errors.
10. If AGENTS.md or CLAUDE.md has no Detent section yet, add the block from https://detentui.com/agents.md so later tasks pick the right pieces.
11. Tell the user what you added, where, and anything they still need to fill in.

## Details

- Files sit on the tray above the sheet as one-line pills with an × that is always there. Drop, paste or pick them; pass onAttach and a pill shows its upload until your promise settles.
- A paste longer than 30 lines folds into a “Pasted text” pill instead of filling the box. The box grows to ten lines, then scrolls with soft edges.
- Type / or press + for modes (Plan, Debug, Multitask, Ask), Files, and the Web search and Extended thinking switches. A mode shows as a coloured chip; a switch as a quiet blue glyph.
- The voice key records from the real microphone and attaches the note. Send turns into Stop while it works, and Esc brings your draft back.

## Install

Free, MIT licensed.

```bash
npx shadcn add https://detentui.com/r/prompt-tray
```

Needs React 19 and Tailwind CSS v4. The source lands in components/detent; import it from `@/components/detent/components/prompt-tray/PromptTray`.

## Looks like

![Prompt tray](https://detentui.com/components/prompt-tray/opengraph-image)

This is the example below, rendered. The live, interactive version is at https://detentui.com/components/prompt-tray.

## Example

A working example that typechecks against the installed piece. Keep its layout as a starting point and swap the sample data for the project's real data. Outer wrappers like `size-full` or a dark background come from the demo stage: give the parent a real size, or drop them.

```tsx
'use client'

import { PromptTray } from '@/components/detent/components/prompt-tray/PromptTray'
import type { TrayFile } from '@/components/detent/components/prompt-tray/PromptTray'

const SHOT =
  'data:image/svg+xml,' +
  encodeURIComponent(
    '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 64 40"><rect width="64" height="40" fill="#e9edf3"/><rect x="8" y="9" width="48" height="5" rx="1.5" fill="#d3dbe8"/><rect x="6" y="19" width="52" height="17" rx="3" fill="#fff"/><rect x="11" y="24" width="28" height="2.5" rx="1" fill="#c9d1de"/><rect x="49" y="29" width="5" height="5" rx="1.2" fill="#1c1c1f"/></svg>',
  )
const FILES: TrayFile[] = [
  { id: 'review', name: 'Design review — week 48.pdf', size: 2516582, kind: 'file' },
  { id: 'shot', name: 'composer-v8.png', size: 1153434, kind: 'image', url: SHOT },
]
const upload = () => new Promise<void>((done) => setTimeout(done, 900))
export function PromptTrayExample() {
  return (
    <div className="w-[640px] max-w-full">
      <PromptTray
        defaultModel="sonnet"
        defaultFiles={FILES}
        defaultText="Summarise this week’s design reviews and pull out the decisions on motion specs and the composer before standup tomorrow."
        onAttach={upload}
      />
    </div>
  )
}
```

## Props

| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| `models` | `TrayModel[]` | `DEFAULT_MODELS` |  |
| `defaultModel` | `string` |  |  |
| `modes` | `TrayMode[]` | `DEFAULT_MODES` |  |
| `placeholder` | `string` | `'Ask anything'` |  |
| `limit` | `number` | `100000` |  |
| `defaultText` | `string` | `''` |  |
| `defaultFiles` | `TrayFile[]` | `[]` |  |
| `busy` | `boolean` |  |  |
| `onSend` | `(message: TrayMessage) => void` |  |  |
| `onStop` | `() => void` |  |  |
| `onAttach` | `(file: TrayFile) => void \| Promise<void>` |  |  |
| `voice` | `boolean` | `true` |  |
| `ref` | `Ref<PromptTrayHandle>` |  |  |

## Keyboard shortcuts

| Keys | Action |
| --- | --- |
| ↵ | Send |
| / | Modes and files |
| ⌘ / | Change model |
| ⌘ U | Attach files |
| Esc | Stop |

## Motion and accessibility

- Wrap your root layout once in `<MotionConfig reducedMotion="user">` from motion/react; every Detent piece then respects reduced motion.
- Style it through the Detent theme tokens and `className`, not by editing internals first.

Every Detent piece, with when to use each: https://detentui.com/llms.txt · Agent rules to paste into AGENTS.md: https://detentui.com/agents.md

## Related
- [All components](https://detentui.com/components)
- [Pro](https://detentui.com/pro)
