Skip to main content

PromptInputMode

Composerai

Composer control for the agent's operating mode — an app-defined enum of how autonomously it may act.

import { PromptInputMode } from "@elabs-ai/components-ai";
Install
npm install @elabs-ai/components-tokens @elabs-ai/components-ui @elabs-ai/components-ai

Skipping the @source line is the most common first failure: Tailwind does not scan node_modules, so every component renders unstyled. The one-time wiring

Prompt for your coding agent

Paste it into Claude Code, Cursor, Codex or any other coding agent. Text in [brackets] is yours to fill in.

Add the brand-ui PromptInputMode component (from @elabs-ai/components-ai) to this project.

1. Read https://elabs-ai.com/llms.txt first: it maps every package and the rules. If you can use MCP servers, connect https://elabs-ai.com/mcp and use its search, docs and tokens tools. If not, run the same lookups in the terminal: `npx -y @elabs-ai/components-cli search "<what you need>"` and `npx -y @elabs-ai/components-cli docs <Component>`.
2. Look PromptInputMode up before writing code: `npx -y @elabs-ai/components-cli docs PromptInputMode` prints its real props, variants, what it pairs with and what to avoid.
3. If @elabs-ai/components-ai is not installed yet: `pnpm add @elabs-ai/components-tokens @elabs-ai/components-ui @elabs-ai/components-ai` (or `npm install @elabs-ai/components-tokens @elabs-ai/components-ui @elabs-ai/components-ai`). If this is the first brand-ui package in the project, wire it once: import `@elabs-ai/components-tokens/styles.css` plus the `themes/light.css` and `themes/dark.css` stylesheets in the CSS entry, add one Tailwind `@source` line per installed @elabs-ai package (Tailwind does not scan node_modules, so without it everything renders unstyled), and wrap the app root in `ThemeProvider` from `@elabs-ai/components-tokens`.
4. Use it here: [the screen or file, and what it should show]
5. Rules: use only @elabs-ai/components-* components and the semantic tokens — no raw colours, no raw font sizes, no arbitrary Tailwind values. Look up each component's real props with the docs tool before you use it; never guess a prop.
6. Done means: the typecheck passes, `npx -y @elabs-ai/components-cli audit src --strict` reports nothing, and you have opened the app and looked at every screen you touched in the light and the dark theme.

Avoid

  • Shipping a CLI's mode names as a type union — the vocabulary is data the app supplies.
  • Hand-rolling roving focus over the mode list — the menu's radio group already owns arrow keys and announcement.
  • Using it to express a standing policy — that is PermissionModeSelect, a settings surface, not a composer chip.

PromptInputMode — a composer control for an app-defined operating mode. Sits beside the model pill / tools cluster in a PromptInput footer: a compact trigger showing the current mode, opening a menu of every mode the app supports. Distinct from PermissionModeSelect, which renders the SAME kind of app-defined policy as an always-expanded settings-panel card list with a required consequence sentence per mode. This is the composer-toolbar altitude: a collapsed trigger, an optional one-line description, and an optional shortcut hint — the two are siblings, not a duplicate.

Works with

Examples

4 live examples

Open Menu

Opening the trigger lists every mode with its description and key hint.

Select A Mode

Selecting a mode updates the trigger and fires `onValueChange` once.

Controlled

Controlled via `value` — the app owns which mode is shown.

API

PromptInputMode

PropTypeDescription
modesrequiredOperatingMode[]The app's own operating modes, low to high ceremony or however it orders them.
valuestringControlled selected mode id. Omit for the uncontrolled default (`modes[0]`).
onValueChange(id: string) => voidFires with the chosen mode's id.

Also accepts: Omit<HTMLAttributes<HTMLDivElement>, "onChange">

Theming

The tokens each state resolves to. Change the token and every theme follows.

StateToken
labeltext-body for the active mode name
hinttext-meta text-muted-foreground for the key hint and description