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 useful for copy buttons, like buttons, bookmark toggles, and other interactive elements that need visual confirmation.

Usage

import { FeedbackButton } from "@tilt-legal/cubitt-components/feedback-button";
import { Check, Copy } 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 except onClick, which is wrapped so feedback state can be triggered before the click handler runs.

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

On this page