Feedback Button

An interactive button component that provides visual feedback when clicked, with automatic icon transitions.

Overview

The Feedback Button component provides visual feedback through icon transitions when clicked. It supports both automatic mode (with auto-reset) and controlled mode (for persistent state), making it perfect for copy buttons, like buttons, bookmark toggles, and other interactive elements that need visual confirmation.

Usage

import { FeedbackButton } from "@tilt-legal/cubitt-components/primitives";
import {
  Copy,
  Check } from "@tilt-legal/cubitt-icons/ui/outline";
<FeedbackButton
  defaultIcon={<Copy />}
  feedbackIcon={<Check />}
  onFeedback={() => navigator.clipboard.writeText("Copied!")}
  variant="secondary"
>
  Copy to Clipboard
</FeedbackButton>

Examples

Icon Only

Icon on Right

Controlled Toggle

Custom Reset Delay

Bookmark Toggle with Text

Variants

API Reference

FeedbackButton

Extends all Button component props with additional feedback functionality.

PropTypeDefaultDescription
defaultIconReactNode-Icon to show in default state. Required.
feedbackIconReactNode-Icon to show in feedback state. Required.
onFeedback() => void-Callback when button is clicked and feedback starts.
resetDelaynumber2000How long to show feedback state in milliseconds (automatic mode).
showFeedbackboolean-External control of feedback state (controlled mode).
controlledbooleanfalseWhether to use external state control instead of automatic reset.
iconSide"left" | "right""left"Position of icon relative to text content.
onClick(e: MouseEvent) => void-Standard click handler (called alongside onFeedback).
childrenReactNode-Button text content (optional for icon-only buttons).
...buttonPropsComponentProps<typeof Button>-All standard Button props (variant, size, disabled, etc.).

Data Attributes:

AttributeTypeDescription
data-feedback-Present when showing feedback state.

On this page