Xzero UI
Pro library

Action morphPro

A floating button that morphs into a quick-action menu, then an inline form, then back with a check.

$ pnpm dlx shadcn@4.23.0 add @xzero-ui-pro/action-morph
Live · keyboard ready

When to use

When not to use

Installation

Register both Xzero UI namespaces in your project's components.json:

{
  "registries": {
    "@xzero-ui": "https://mcp.xzero.co.uk/r/{name}.json",
    "@xzero-ui-pro": "https://mcp.xzero.co.uk/r/pro/{name}.json"
  }
}
npx shadcn@4.23.0 add @xzero-ui-pro/action-morph

Install xzero-foundation once, and import @/components/xzero/foundation.css in your app root. No Xzero token is used by this snapshot. For sample portraits, photos, fonts, or logos, download https://mcp.xzero.co.uk/install-assets.mjs and run node xzero-install-assets.mjs <receiving-project>.

Usage

import { CheckSquare, StickyNote } from "lucide-react";
import { ActionMorph } from "@/components/xzero/action-morph/action-morph";

export function QuickCreate() {
  return (
    <div style={{ position: "fixed", right: 24, bottom: 24 }}>
      <ActionMorph
        label="Create"
        actions={[
          {
            id: "task",
            label: "New task",
            description: "Add to your list",
            icon: <CheckSquare strokeWidth={1.75} />,
            shortcut: "t",
            composer: {
              title: "New task",
              placeholder: "What needs doing?",
              choices: { label: "Due", options: ["Today", "Tomorrow", "Next week"] },
              submitLabel: "Add",
              successLabel: "Task added",
            },
          },
          {
            id: "note",
            label: "New note",
            icon: <StickyNote strokeWidth={1.75} />,
            shortcut: "n",
            composer: { title: "New note", placeholder: "Write a note", multiline: true, submitLabel: "Save", successLabel: "Note saved" },
          },
        ]}
        onSubmit={({ action, text, choice }) => save(action, text, choice)}
      />
    </div>
  );
}

API reference

ActionMorph

A floating action button that springs into a quick action menu, slides into an inline composer, and folds back with a check on success.

PropTypeDefaultDescription
actions (required)ActionMorphAction[]–Actions: { id, label, description?, icon, shortcut?, composer }. composer is { title, placeholder, multiline?, choices?, submitLabel, successLabel, emptyHint? }.
labelstring"Create"Accessible name of the button and the title of the menu.
onSubmit(submission: ActionMorphSubmission) => void | Promise<unknown>–Receives { action, text, choice? }. Return a promise to hold the sending state; a rejection keeps the composer open with the draft and an error.
corner"end" | "start""end"Which bottom corner the button sits in. The surface grows away from it.
resetAfternumber1600Milliseconds the check stays before the button returns to its plus.
classNamestring–Extra class on the root, for example to position it fixed.

Keyboard interactions

KeysAction
Enter / SpaceOpens the menu from the button and focuses the first action.
ArrowDown / ArrowUpMoves between menu actions, wrapping at the ends; Home and End jump to the first or last.
Letter shortcutOpens that action's composer while the menu is open.
EnterSubmits a one line composer.
Mod + EnterSubmits a multiline composer.
Arrow keysMove between choices in the composer's radio group.
EscapeGoes back from a composer to the menu, or closes the menu and returns focus to the button.

Accessibility

Motion

Responsive behavior

Performance

Notes for AI

Also in docks and tabs

Guidance for AI tools

Action morph: A floating button that morphs into a quick-action menu, then an inline form, then back with a check. Follow the declared prop types and do not invent props. Keep keyboard access, reduced motion support, and both light and dark themes intact when adapting it.

Full library index: https://ui.xzero.co.uk/llms.txt

Browse all components