# Feedback morph

> A feedback button that becomes a form, then a thank-you, in one shape.

- Type: Component (special)
- Access: Arc Pro
- Page: https://uiarc.dev/components/feedback-morph
- Markdown: https://uiarc.dev/components/feedback-morph/markdown
- Source file: `registry/components/feedback-morph/feedback-morph.tsx`
- Dependencies: motion, lucide-react
- Keywords: special, motion, react feedback widget, feedback button, send feedback form, mood feedback, morphing popover, nps widget

## When to use

- Quick in-context feedback on a page or feature without interrupting the task.
- Mood plus note feedback where a five point scale is enough.

## When not to use

- Use dialog with form fields when you need contact details, attachments, or required fields.
- Use rating for a standalone star score.
- Use popover for arbitrary anchored content.

## Installation

Feedback morph is part of Arc Pro. The live preview is public; the source and install command need Pro.

### CLI with a Pro token

1. Create a token in your account and set it in the environment (or `.env.local`). Never commit it.

```bash
export ARC_PRO_TOKEN=arc_pro_...
```

2. Add the Pro registry to `components.json`:

```json
{
  "registries": {
    "@uiarc": "https://uiarc.dev/r/{name}.json",
    "@uiarc-pro": {
      "url": "https://uiarc.dev/r/pro/{name}.json",
      "headers": {
        "Authorization": "Bearer ${ARC_PRO_TOKEN}"
      }
    }
  }
}
```

3. Install:

```bash
npx shadcn@latest add @uiarc-pro/feedback-morph
```

### Manual

Signed-in Pro members can copy the source from the Manual tab on the docs page.

- Plans: https://uiarc.dev/pricing
- Create a Pro token: https://uiarc.dev/account#pro-access
- Setup guide: https://uiarc.dev/docs/ai#pro-access

## Usage

```tsx
import { FeedbackMorph } from "@/components/arc/feedback-morph/feedback-morph";

export function PageFeedback() {
  return (
    <FeedbackMorph
      side="top"
      onSubmit={async ({ mood, message }) => {
        await fetch("/api/feedback", { method: "POST", body: JSON.stringify({ mood, message }) });
      }}
    />
  );
}
```

## API reference

### FeedbackMorph

A "Send feedback" pill that springs open into a small panel with mood faces and a note, folds into a thank-you pill once sent, then back into the button.

| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| `label` | `string` | `"Send feedback"` | The pill's label. |
| `title` | `string` | `"How is it going?"` | Question at the top of the panel. |
| `moods` | `{ value: string; label: string; icon: ReactNode; prompt: string }[]` | `defaultFeedbackMoods` | Mood faces; five read best, three or more work. prompt replaces the placeholder once that mood is picked. |
| `placeholder` | `string` | `"Tell us what you think"` | Prompt in the empty note before a mood is picked. |
| `maxLength` | `number` | `500` | Character limit of the note. |
| `successLabel` | `string` | `"Thanks, we read every note"` | Text in the success pill. |
| `onSubmit` | `(feedback: { mood: string \| null; message: string }) => void \| Promise<unknown>` | – | Receives the note. Return a promise to hold the sending state; a rejection keeps the panel open with an error and the draft intact. |
| `resetAfter` | `number` | `3200` | Milliseconds the success pill stays before folding back into the button. |
| `side` | `"bottom" \| "top"` | `"bottom"` | Whether the panel grows down from the pill or up from it. |
| `align` | `"start" \| "center" \| "end"` | `"center"` | Horizontal anchor of the growing panel. |
| `className` | `string` | – | Class on the root element. |

## Keyboard interactions

| Keys | Action |
| --- | --- |
| Arrow keys | Move between mood faces. |
| Home / End | Select the first or last mood. |
| Cmd/Ctrl + Enter | Send the note from the textarea. |
| Escape | Fold the panel back into the pill, keeping the draft. |

## Accessibility

- The pill has aria-haspopup="dialog" and aria-expanded; the panel is role="dialog" labelled by its title.
- Moods form a role="radiogroup" of role="radio" buttons with a roving tabindex.
- Sending, errors, and success are announced through a polite status region; the send button exposes aria-keyshortcuts.

## Motion

- One shape springs between pill, panel, and thank-you pill sizes; content fades in a beat behind the edge and a check mark draws itself on success.
- A mood highlight slides between faces, a character counter rolls, and an empty send shakes.
- Reduced motion keeps every state but lands transforms at once and uses short opacity fades.

## Responsive behavior

- The panel is min(22rem, 100vw minus 2rem), so it fits phones; use side and align to keep it inside the viewport near edges.
- Mood buttons are 2.75rem targets, and hover highlights follow the mouse only.

## Performance

- Two ResizeObservers measure the pill and panel so one shape can spring between them.
- The panel mounts only while open; there is no work while idle.

## Notes for AI

- Use for quick in-context feedback where a dialog would interrupt the task. Use a dialog with form fields when you need contact details, attachments, or required fields.
- Return the fetch promise from onSubmit so the sending and error states work; pass custom moods to change the scale.

## Related

- [Dialog](https://uiarc.dev/components/dialog/markdown): A focused surface for decisions that need attention.
- [Popover](https://uiarc.dev/components/popover/markdown): A small anchored surface for contextual information.
- [Textarea](https://uiarc.dev/components/textarea/markdown): A multiline field for notes, descriptions, and longer text.
- [Rating](https://uiarc.dev/components/rating/markdown): A simple, accessible way to capture a numeric opinion.
- [Toast](https://uiarc.dev/components/toast/markdown): Brief confirmation for a completed background action.

## Also in loaders

- [Stretch refresh](https://uiarc.dev/components/stretch-refresh/markdown): Pull a feed down and a line stretches to tell you when to let go.
- [Morph loader](https://uiarc.dev/components/morph-loader/markdown): Tiny loaders that morph between shapes and fold into a check or a cross when done.
- [Skeleton morph](https://uiarc.dev/components/skeleton-morph/markdown): Loading skeletons that grow into the real content, block by block, instead of swapping.
- [Black hole](https://uiarc.dev/components/black-hole/markdown): A delete transition that pulls the chosen items into a tiny singularity while the rest of the list bends around it; undo spins them back out.
- [Slide to confirm](https://uiarc.dev/components/slide-to-confirm/markdown): A slide-to-confirm control. The thumb pulls a liquid fill behind it and makes the track swell. It snaps back on a spring if released early. Past the threshold, the track draws into the thumb and the chevron morphs into a success check, with pending and error states.
- [Charge session](https://uiarc.dev/components/charge-session/markdown): An EV or device charging card. Energy packets flow from a charger along the cable into the battery pack, which fills toward a draggable charge limit. The charge curve tapers near full, and power, energy, time to limit and cost update live. Stop charging drains the flow.

## Guidance for AI tools

Feedback morph: A feedback button that becomes a form, then a thank-you, in one shape. 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://uiarc.dev/llms.txt
