AI Native UI Kit
Components

Prompt Composer

A polished chat/prompt composer — context pill, auto-growing input, attach, research toggle, source & model selectors, mic, and send.

Type a prompt and press Enter ↵

Installation

npx shadcn@latest add https://ai-native-ui.com/r/prompt-composer.json

Usage

import { PromptComposer } from "@/components/ui/prompt-composer";

export default function Page() {
  return (
    <PromptComposer
      placeholder="Learn something new..."
      models={["Claude Opus 4.8", "GPT-5"]}
      sources={[
        { id: "all", label: "All sources" },
        { id: "web", label: "Web" },
      ]}
      onSend={(text) => console.log("send:", text)}
      onAttach={(files) => console.log("attach:", files)}
    />
  );
}

Props

PropTypeDescription
value / defaultValuestringControlled / uncontrolled input value.
placeholderstringPlaceholder for the empty input.
onSend(value: string) => voidFires on the send button or Enter.
onChange(value: string) => voidFires on every keystroke.
onAttach(files: FileList | null) => voidOpens a file picker and returns the selection.
research / defaultResearchbooleanResearch toggle state.
onResearchToggle(active: boolean) => voidFires when Research is toggled.
sources{ id: string; label: string }[]Options for the source dropdown.
onSourceChange(id: string) => voidFires when the source changes.
modelsstring[]Options for the model dropdown.
onModelChange(model: string) => voidFires when the model changes.
onClose() => voidShows the ✕ button when provided.
onMic() => voidFires when the mic button is clicked.
disabledbooleanDisables the whole composer.

Behavior

  • Enter sends; Shift + Enter inserts a newline.
  • The input auto-grows up to maxRows (default 8), then scrolls.
  • Send is disabled while the input is empty.
  • Dropdowns close on outside click or Escape.

Theming

The component styles itself with CSS custom properties (all prefixed --pc-). Override them on the root to match your brand:

.my-composer {
  --pc-accent: #6d28d9;
  --pc-radius: 16px;
}

It also respects prefers-color-scheme: dark automatically.

On this page