Skip to content
Haze UI

AI prompt selector

Prompt input with dismissible model promo banner, inline slash commands, removable file chips, model and effort menus, and stream stop.

pnpm dlx shadcn@latest add @haze/ai-prompt
Open preview in a new tab
Livesmall script

When to use

  • Launching a workspace prompt bar that highlights a featured model alongside command shortcuts
  • Giving users separate model and reasoning effort controls with file attachments in one composer
  • Prototyping an interactive AI prompt card with simulated streaming and stop controls

When not to use

  • You need a grounded web search trace with live source citations; use ai-input-search instead
  • You only need a compact model and effort pill without a full composer; use ai-model-selector instead

Installation

Add the Haze registry to components.json once, then install AI prompt selector with the shadcn CLI. Works in any Astro project with Tailwind CSS v4.

pnpm dlx shadcn@latest add @haze/ai-prompt
First time? Registry and theme setup

1. Add to components.json:

{
  "registries": {
    "@haze": "http://localhost:4329/r/{name}.json"
  }
}

2. Install the theme once: npx shadcn@latest add @haze/theme, then import it after Tailwind in your global CSS:@import "./haze.css";

API reference

PropTypeDefaultDescription
idstring"haze-ai-prompt"Unique prefix for labels, menus and aria-controls references.
headingstring"AI prompt selector"Screen-reader section heading for the prompt composer.
promoTextstring"Solstice 5.1 is free this weekend"Announcement copy shown inside the top promo strip.
promoModelstring"Solstice 5.1"Model selected automatically when activating the Try it button.
placeholderstring"Ask anything. Type / for commands"Placeholder copy inside the auto-growing textarea.
models{ name: string; note: string }[]4 demo modelsModels listed in the composer model menu.
effortsstring[]["Low", "Medium", "High", "Max"]Reasoning effort levels available in the effort picker.
commands{ name: string; description: string }[]4 slash commandsCommands shown when typing / or opening the slash menu.
classstring–Extra classes on the outer section.

Keyboard interactions

/
Open and filter the inline slash-command menu inside the prompt field
Escape
Dismiss any open command, model or effort tray
TabEnter
Navigate toolbar controls, pick options, remove chips or submit the prompt

Accessibility

  • Slash command, model and effort trays wire aria-expanded and aria-controls to their triggers and close cleanly on Escape.
  • Model switches, file attachments, promo dismissal and streaming completion announce through a polite role="status" element.

Notes for AI

Copy into Claude Code, Cursor, Codex or any coding agent. Agents can also read the Markdown version of this page.

  • Install and use

    Install the Haze UI block "AI prompt selector" with `npx shadcn@latest add @haze/ai-prompt`. If components.json has no "@haze" registry yet, add "registries": { "@haze": "http://localhost:4329/r/{name}.json" }. If src/styles/haze.css does not exist yet, run `npx shadcn@latest add @haze/theme` once and import it from the global stylesheet after Tailwind. The CLI stops at an overwrite question when a Haze file already exists and differs, even with --yes, and then installs nothing after it: read its output. If the user has not edited their Haze files, re-run with --overwrite to take the registry versions; if they have, ask them before overwriting. Then import AiPrompt from "@/components/haze/blocks/ai-prompt.astro" (or the relative path) and render it where it fits the page. Keep Haze token classes (bg-background, text-muted-foreground, border-border...) and never hardcode colors. Docs: http://localhost:4329/blocks/ai-prompt.md

  • Customize with real content

    Adapt the Haze ai-prompt block for our product. Replace the demo values of these props with our real content: id, heading, promoText, promoModel, placeholder, models, efforts, commands, class. Keep the layout, the heading level rules and these accessibility details: Slash command, model and effort trays wire aria-expanded and aria-controls to their triggers and close cleanly on Escape. Model switches, file attachments, promo dismissal and streaming completion announce through a polite role="status" element. Do not add raw color classes; use the Haze tokens.

  • Choose the right block

    Before using ai-prompt, check it fits: use it when launching a workspace prompt bar that highlights a featured model alongside command shortcuts; giving users separate model and reasoning effort controls with file attachments in one composer; prototyping an interactive ai prompt card with simulated streaming and stop controls. Avoid it when you need a grounded web search trace with live source citations; use ai-input-search instead; you only need a compact model and effort pill without a full composer; use ai-model-selector instead. Alternatives: @haze/ai-composer, @haze/ai-input-search, @haze/ai-model-selector.

Dependencies

  • npm: @lucide/astro
  • @haze/utils
  • @haze/theme (one-time setup)

Source · Original Haze UI work.

Catalog

↑↓ moveEnter openEsc close

Keyboard shortcuts

CtrlK
Command palette
/
Focus search
←↑→↓
Move between cards
jk
Next / previous card
ci
Copy code / install command (detail page)
[]
Previous / next entry
?
This help
Esc
Close dialog