Composer Actions
The “+” menu next to a chat input — import, upload, toggles and submenus, with smooth motion and full keyboard support.
Preview
Installation
- 1
Run the following command
npx shadcn@latest add https://localhostui.com/r/composer-actions.json
Usage
import ComposerActions, { type ComposerAction } from "@/components/lokalhost_io/micro-ai-components/ComposerActions";
import { FaGithub } from "react-icons/fa";
const primary: ComposerAction[] = [{ id: "github", label: "Import from GitHub", icon: FaGithub }];
<ComposerActions primary={primary} onSelect={(id) => openFlow(id)} />Props
ComposerActions
| Prop | Type | Default | Description |
|---|---|---|---|
primary | ComposerAction[] | GitHub / Figma / Upload | Rows above the divider. |
secondary | ComposerAction[] | the settings rows | Rows below the divider. |
onSelect | (id: string) => void | — | Called when a non-toggle row is chosen. |
generateImages | boolean | — | Controlled state of the “Generate images” switch. |
onGenerateImagesChange | (next: boolean) => void | — | Called when the switch flips. |
open / defaultOpen / onOpenChange | boolean / boolean / (open) => void | closed | Menu open state. |
trigger | ReactNode | a + button that rotates into × | Custom trigger. |
className | string | — | Classes on the menu panel. |
ComposerAction
| Prop | Type | Default | Description |
|---|---|---|---|
id* | string | — | Passed to onSelect. |
label* | string | — | Row text. |
icon* | IconType | — | A react-icons component. |
premium | boolean | — | Shows a Premium pill. |
hasSubmenu | boolean | — | Trailing chevron; the menu stays open on select. |
toggle | boolean | — | Trailing switch instead of a chevron. |
Keyboard
| Key | Action |
|---|---|
Enter / Space on the trigger | Open the menu and focus the first row |
↑ / ↓, Home / End | Move between rows |
Esc | Close and return focus to the trigger |