ComponentsComposer Actions

Composer Actions

The “+” menu next to a chat input — import, upload, toggles and submenus, with smooth motion and full keyboard support.

Preview

Installation

  1. 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

PropTypeDefaultDescription
primaryComposerAction[]GitHub / Figma / UploadRows above the divider.
secondaryComposerAction[]the settings rowsRows below the divider.
onSelect(id: string) => void—Called when a non-toggle row is chosen.
generateImagesboolean—Controlled state of the “Generate images” switch.
onGenerateImagesChange(next: boolean) => void—Called when the switch flips.
open / defaultOpen / onOpenChangeboolean / boolean / (open) => voidclosedMenu open state.
triggerReactNodea + button that rotates into ×Custom trigger.
classNamestring—Classes on the menu panel.

ComposerAction

PropTypeDefaultDescription
id*string—Passed to onSelect.
label*string—Row text.
icon*IconType—A react-icons component.
premiumboolean—Shows a Premium pill.
hasSubmenuboolean—Trailing chevron; the menu stays open on select.
toggleboolean—Trailing switch instead of a chevron.

Keyboard

KeyAction
Enter / Space on the triggerOpen the menu and focus the first row
↑ / ↓, Home / EndMove between rows
EscClose and return focus to the trigger