# Response feedback

Collect response-specific ratings, reasons and optional comments through a native form.

Access: pro. Category: Feedback. Kind: composite.

## When to use

- Use it when a page needs collect response-specific ratings, reasons and optional comments through a native form.
- Choose it when the host application can supply the required state and keep business logic outside the presentation component.

## Alternatives

- Choose alert instead when inline notices with icons, actions and optional dismissal is the actual interface need, rather than response feedback.

## Setup for agents

Use React 19 and TypeScript. Initialize shadcn for your framework, then merge this exact entry into components.json:

```json
{
  "registries": {
    "@tidal-pro": {
      "url": "https://tidalui.com/r/pro/{name}.json",
      "headers": {
        "Authorization": "Bearer ${TIDALUI_TOKEN}"
      }
    }
  }
}
```

The namespace must be named **@tidal-pro** because transitive Pro dependencies use that namespace. Obtain an agent key from your active Pro account at https://tidalui.com/account. Keep TIDALUI_TOKEN in your local environment, never in components.json, client code, Git or logs.

```sh
export TIDALUI_TOKEN='your-private-agent-key'
npx shadcn@latest add @tidal-pro/waitlist-form
npx shadcn@latest add https://tidalui.com/r/tidal-button.json
```

Free command: `npx shadcn@latest add https://tidalui.com/r/<name>.json`.
Pro command: `npx shadcn@latest add @tidal-pro/<name>`.

Import the base stylesheet and every stylesheet listed on the installed item's metadata. For example:

```tsx
import "./components/ui/tidal.css";
import "./components/ui/hero-section.css";
// Place installed components inside this wrapper:
<div className="tidal-scope" data-theme="dark">...</div>
```

Omit data-theme for the default light theme. Put the attribute on the same tidal-scope element for dark mode. Every component installs the shared free tidal-base dependency. After upgrading, run `npx shadcn@latest add https://tidalui.com/r/tidal-base.json --overwrite` to receive current tokens. Review local modifications before overwriting.

Vite: Use React + TypeScript. Map @/* to ./src/* in paths and Vite resolve.alias. Import tidal.css and each component stylesheet in your application entry.

Next.js 15 App Router: Next.js App Router: import tidal.css and component CSS in app/layout.tsx. Interactive examples belong in a client component with "use client". Map @/* to ./* or ./src/* to match your project.

TypeScript 6: use paths without baseUrl:

```json
{
  "compilerOptions": {
    "paths": {
      "@/*": [
        "./src/*"
      ]
    }
  }
}
```

Pro registry requests are server/CLI-only. Use the same-origin account interface in a browser; cross-origin Authorization preflights are intentionally unsupported.


## Install Response feedback

```sh
npx shadcn@latest add @tidal-pro/response-feedback
```

Stylesheets: `components/ui/tidal.css`, `components/ui/response-feedback.css`.

## Minimal example

```tsx
import"./components/ui/tidal.css";
import"./components/ui/response-feedback.css";
import{TidalResponseFeedback}from"./components/ui/response-feedback";
export default(p:Parameters<typeof TidalResponseFeedback>[0])=><div className="tidal-scope"><TidalResponseFeedback {...p}/></div>;
```

## Structured props

- `TidalResponseFeedback.choice: TidalFeedbackChoice | null`: Required choice value accepted by this exported component.
- `TidalResponseFeedback.comment: string`: Required comment value accepted by this exported component.
- `TidalResponseFeedback.onChoiceChange: (choice: TidalFeedbackChoice, event: MouseEvent<HTMLButtonElement>) => void`: Callback invoked when the choice change interaction is proposed.
- `TidalResponseFeedback.onCommentChange: (comment: string) => void`: Callback invoked when the comment change interaction is proposed.
- `TidalResponseFeedback.onReasonsChange: (reasons: readonly string[]) => void`: Callback invoked when the reasons change interaction is proposed.
- `TidalResponseFeedback.reasons: ReadonlyArray<TidalFeedbackReason>`: Required reasons value accepted by this exported component.
- `TidalResponseFeedback.selectedReasons: ReadonlyArray<string>`: Required selected reasons value accepted by this exported component.
- `TidalResponseFeedback.choiceProps?: ((choice: TidalFeedbackChoice) => ButtonProps) | undefined`: Optional choice props value accepted by this exported component.
- `TidalResponseFeedback.disabled?: boolean | undefined` (default false): Optional disabled value accepted by this exported component.
- `TidalResponseFeedback.error?: ReactNode`: Optional error value accepted by this exported component.
- `TidalResponseFeedback.labels?: Partial<{ helpful: string; unhelpful: string; reasons: string; comment: string; submit: string; pending: string; invalid: string; helpfulHint: string; unhelpfulHint: string; }> | undefined` (default {}): Optional labels value accepted by this exported component.
- `TidalResponseFeedback.onSubmit?: ((event: FormEvent<HTMLFormElement>) => void) | undefined`: Callback invoked when the submit interaction is proposed.
- `TidalResponseFeedback.pending?: boolean | undefined` (default false): Optional pending value accepted by this exported component.
- `TidalResponseFeedback.submitProps?: ButtonProps | undefined`: Optional submit props value accepted by this exported component.
- `TidalResponseFeedback.success?: ReactNode`: Optional success value accepted by this exported component.
- `TidalResponseFeedback.textareaProps?: Omit<Omit<DetailedHTMLProps<TextareaHTMLAttributes<HTMLTextAreaElement>, HTMLTextAreaElement>, "ref">, "disabled" | "form" | "name" | "value" | "defaultValue" | "id" | "role" | "aria-disabled" | "aria-label" | "aria-labelledby" | "aria-readonly" | "children" | "dangerouslySetInnerHTML" | "onChange" | "onInput"> | undefined` (default {}): Optional textarea props value accepted by this exported component.
- `TidalResponseFeedback.textareaRef?: Ref<HTMLTextAreaElement> | undefined`: Optional textarea ref value accepted by this exported component.
- `TidalResponseFeedback.title?: ReactNode` (default "Was this response helpful?"): Optional title value accepted by this exported component.

## Complete usage example

[Source](https://tidalui.com/examples/response-feedback.tsx) | [Manifest](https://tidalui.com/examples/response-feedback.json). Install the listed additional dependencies. Consumer fixture: TypeScript pass; Vite pass. This fixture check is distinct from the actual shadcn install receipt.

```tsx
import "./components/ui/tidal.css";

import { useState, useRef, useLayoutEffect } from "react";

import { TidalResponseFeedback, type TidalFeedbackChoice } from "./components/ui/response-feedback";

import "./components/ui/response-feedback.css";



export function ResponseFeedbackDemo() {
  const form = useRef<HTMLFormElement>(null),
    editSource = useRef<HTMLButtonElement | null>(null);
  const [choice, setChoice] = useState<TidalFeedbackChoice | null>(null),
    [reasons, setReasons] = useState<readonly string[]>([]),
    [comment, setComment] = useState(""),
    [success, setSuccess] = useState("");
  useLayoutEffect(() => {
    const source = editSource.current;
    if (success || !source) return;
    editSource.current = null;
    const active = source.ownerDocument.activeElement;
    if (active === source || active === source.ownerDocument.body)
      form.current?.focus({ preventScroll: true });
  }, [success]);
  return (
    <div style={{ width: "100%", maxWidth: 480, marginInline: "auto" }}>
      <TidalResponseFeedback
        ref={form}
        choice={choice}
        onChoiceChange={setChoice}
        reasons={[
          { id: "incorrect", label: "Incorrect information" },
          { id: "incomplete", label: "Missing details" },
          { id: "unclear", label: "Hard to follow" },
        ]}
        selectedReasons={reasons}
        onReasonsChange={setReasons}
        comment={comment}
        onCommentChange={setComment}
        success={success}
        onSubmit={(e) => {
          e.preventDefault();
          const data = new FormData(e.currentTarget);
          setSuccess(`Feedback kept in this preview: ${data.get("feedback")}.`);
        }}
        textareaProps={{
          placeholder: "What would make this response more useful?",
          maxLength: 1000,
        }}
      />
      {success && (
        <button
          type="button"
          style={{
            display: "block",
            margin: "12px auto",
            minHeight: 44,
            color: "var(--t-muted)",
            background: "none",
            border: 0,
            cursor: "pointer",
          }}
          onClick={(event) => {
            editSource.current = event.currentTarget;
            setSuccess("");
          }}
        >
          Edit feedback
        </button>
      )}
    </div>
  );
}

export default function AgentExample() {
  return (
    <div className="tidal-scope" data-theme="light" dir="ltr">
      <ResponseFeedbackDemo />
    </div>
  );
}

```

## Gotchas

- Install the declared registry dependencies and render inside a tidal-scope with the foundation stylesheet loaded.

## Theme and accessibility

{"tokens":["--t-accent","--t-border","--t-border-strong","--t-canvas","--t-danger","--t-display","--t-ease-out","--t-ease-spring","--t-faint","--t-font","--t-ink","--t-line","--t-muted","--t-primary","--t-primary-contrast","--t-radius-card","--t-radius-control","--t-radius-overlay","--t-radius-panel","--t-ring","--t-shadow-lg","--t-shadow-soft","--t-soft","--t-subtle","--t-surface","--t-wash"],"darkMode":true}

{"keyboard":["Tab and Shift+Tab follow the component's native focus order."],"aria":"The component wires labels and relationships from consumer-provided visible text or ARIA props; preserve those labels in production.","notes":"Verify focus visibility, text alternatives, contrast, and reduced motion in the final composition."}

Controlled helpful/unhelpful/null choice, known unique reason IDs and exact comment string. Choice buttons preserve caller-first unprevented clicks. Unhelpful shows native checkboxes; helpful omits stale reason fields. Native form serializes feedback, repeated reason and comment fields, supports native action/method or an onSubmit consumer callback, and blocks invalid, disabled, pending or already-successful submissions. Optional success/error content, native textarea props/ref, native form ref, localized labels and button props are supported. Pending and disabled state applies to all fields/actions. Hidden/removed submit controls recover focus to the form only while source/body owns it. Light/dark neutral tokens,44px targets,16px phone editing,RTL and reduced-motion support. No feedback is sent, stored or persisted by the component; the demo explicitly keeps its result within the preview. Textarea id, role, ARIA availability and onInput channels are excluded and stripped; linked errors set aria-invalid. Native textarea readOnly remains supported. Disabled actions suppress consumer click handlers, and the sample Edit action restores form focus only from its removed source or body.
