Skip to main content

PromptInputEffort

Composerai

Composer control for an ordered reasoning-budget scale whose indicator fills as the level rises.

import { PromptInputEffort } 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 PromptInputEffort 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 PromptInputEffort up before writing code: `npx -y @elabs-ai/components-cli docs PromptInputEffort` 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

  • Encoding the level by hue alone — the ordinal fill and the step size are the channels that survive greyscale.
  • Shipping a fixed effort vocabulary — the levels are app-defined data.
  • Omitting the accessible name for the scale — the group needs one; the component ships no default because the name is app vocabulary.

PromptInputEffort — an ORDERED reasoning-effort/budget control. Renders levels (low → high, the order IS the semantics) as a row of same-shape squares that GROW in size; selecting a level fills every square up to and including it. The fill is a non-colour channel (size ramp + solid/hollow shape), so the level is recoverable in greyscale — plus the level's name is always rendered as text. Ships no effort vocabulary.

Works with

Used inside

Examples

5 live examples

Highest Level

Controlled at the highest level — every square is filled.

Select A Level

Clicking a level moves the fill and announces the new name.

Two Levels

Only two levels — the size ramp still reads as an ordered low/high pair.

Target Size

WCAG 2.5.8 (Target Size, Minimum) locking test (#161). The ramp bars' differing sizes ARE the meaning (the size ramp is the non-colour channel), so the fix must decouple the click/tap/focus target from the visible bar: every radio's own hit box is >=24x24 CSS px, while the visible bar (`[data-slot="prompt-input-effort-item-visual"]`) keeps its authored `effortRungForIndex` size (10, 14, 20, 24px for these 4 levels) — a fix that flattens the ramp to satisfy the target-size rule fails this test.

API

PromptInputEffort

PropTypeDescription
levelsrequiredEffortLevel[]Ordered low → high. The order IS the semantics — render in this order.
valuestringControlled selected level id. Omit for the uncontrolled default (`levels[0]`).
onValueChange(id: string) => voidFires with the chosen level's id.

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

Theming

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

StateToken
filledbg-primary border-primary — every step at or before the selected level
unfilledbg-transparent border-border-strong — a hollow outline for the rest
labeltext-body for the current level's name, always rendered as visible text