AI field

Free

A one-line field for asking about what the agent did, with a still gradient rim and the send button inset as far from the edge as from the top and bottom.

npx shadcn@latest add https://pixilui.com/r/ai-field.json

Preview

A still gradient rim marks the field that asks the agent.
Size

When to use

Use it when

  • Asking a question about runs, a table or a trace, in a page header or a panel.

Use something else when

  • A full chat composer with attachments: use the composer.

Installation

Terminal
npx shadcn@latest add https://pixilui.com/r/ai-field.json

Adds ai-field.tsx with field.tsx, and installs clsx and tailwind-merge. The URL works in any app with a components.json, with no registry to add first.

Usage

example.tsx
import { AiField } from "@/components/pixilui/ai-field";

<AiField sendIcon={sendIcon} onSubmit={onSubmit} />

Fills its container's width; the label row and the message wrap.

API reference

PropTypeDefault
sendIconRequiredReactNode–The send button's icon (the animated send-stop icon).
labelReactNode–The label above the field ("Ask about these runs").
iconReactNode–The icon before the text (the animated ai icon).
sendLabelstring"Ask"The send button's name.
onSubmit(question: string) => void–Runs with the trimmed question on Enter or the send button. Nothing runs for an empty field.
sizeFieldSize"xl"The button height of the same name; xl (44) by default, as the locked page shows it.
classNamestring–Classes for the field. Native attributes and the ref go to the input.

Also takes every native <input> attribute except size, prefix, onSubmit, and a ref.

Keyboard

EnterSends the question, never in the middle of composing.

Accessibility

  • The send button is labelled (sendLabel, "Ask").

Motion

  • None of its own: the rim is still, by design. Quiet keeps the plain rim and the focus ring.
InputA field that checks what you typed and says what's wrong in words.
Search fieldEsc clears, and Enter waits for composition to finish.
FieldOne field frame: a rim you can see, and words that say what's wrong.

PixilUI Pro opens soon. The first 20 licenses are $99.