Skip to main content
Clever Ops

Message Action Bar

Assistant message action toolbar for React chat UIs, copy, retry, edit, and feedback buttons with a mono model attribution seam; Tailwind-styled, roving tabindex, SDK-agnostic.

Preview & code

Loading Message Action Bar preview

Installation

pnpm dlx shadcn@latest add @cleverui/message-action-bar

Requires the @cleverui registry in your components.json, a one-off, two-line setup.

Usage

tsx
import { MessageActionBar } from '@/components/ui/message-action-bar'
Exampletsx
'use client'

import { useState } from 'react'
import {
  MessageActionBar,
  type MessageFeedback,
} from '@/components/ui/message-action-bar'

const MSG_A =
  'Matched 42 of 44 May invoices for Apex Holdings. Two Stripe payouts (py_8k2L, py_9m1Q) sit $87 and $124 over the Xero bills, both under the $500 auto-approve threshold, so I held them for your review.'

const MSG_B =
  'Draft digest ready for #ops: three open approvals, spend +4.2% vs last week, and one Linear ticket (LIN-1842) past the five-day escalation window.'

export default function MessageActionBarDemo() {
  const [feedbackA, setFeedbackA] = useState<MessageFeedback>('none')
  const [feedbackB, setFeedbackB] = useState<MessageFeedback>('up')
  const [retryNote, setRetryNote] = useState<string | null>(null)

  return (
    <div className="mx-auto flex min-h-[360px] w-full max-w-xl flex-col justify-center gap-8 px-4 py-12 sm:px-6 sm:py-16">
      <article className="min-w-0 space-y-3">
        <div className="rounded-2xl border border-border/60 bg-card px-4 py-3.5 sm:px-5">
          <p className="font-mono text-[11px] uppercase tracking-[0.16em] text-muted-foreground">
            meridian-ops
          </p>
          <p className="mt-2 text-sm leading-relaxed text-foreground">
            {MSG_A}
          </p>
        </div>
        <MessageActionBar
          content={MSG_A}
          feedback={feedbackA}
          onFeedback={setFeedbackA}
          onRetry={() => setRetryNote('Regenerating May reconcile…')}
          onEdit={() => setRetryNote('Edit opened for message A')}
          model="claude-sonnet-4-5"
          meta="1,204 tokens · 2.1s"
        />
      </article>

      <article className="min-w-0 space-y-3">
        <div className="rounded-2xl border border-border/60 bg-card px-4 py-3.5 sm:px-5">
          <p className="font-mono text-[11px] uppercase tracking-[0.16em] text-muted-foreground">
            meridian-ops
          </p>
          <p className="mt-2 text-sm leading-relaxed text-foreground">
            {MSG_B}
          </p>
        </div>
        <MessageActionBar
          content={MSG_B}
          feedback={feedbackB}
          onFeedback={setFeedbackB}
          onRetry={() => setRetryNote('Regenerating ops digest…')}
          model="claude-sonnet-4-5"
          meta="612 tokens · 1.4s"
        />
      </article>

      {retryNote && (
        <p className="text-center font-mono text-[11px] text-muted-foreground sm:text-xs">
          {retryNote}
        </p>
      )}
    </div>
  )
}

API reference

MessageActionBar accepts the following props.

PropTypeDefaultDescription
contentstringmessage text the copy button writes to the clipboard; omitted hides copy
onCopy() => voidfires after a successful copy, alongside the built-in receipt
onRetry() => voidregenerate callback; omitted hides the button
onEdit() => voidedit-message callback; omitted hides the button
feedbackMessageFeedback'none'controlled feedback state
onFeedback(value: MessageFeedback) => voidfires with the next state; pressing the active thumb again sends 'none'
modelstringmono model id on the attribution seam
metastringpreformatted mono run figures rendered verbatim
labelstring'Message actions'accessible name for the toolbar

…plus everything from Omit< React.HTMLAttributes<HTMLElement>, 'content' | 'onCopy' | 'onDrag' | 'onDragStart' | 'onDragEnd' | 'onAnimationStart' >: className, event handlers, aria attributes and the rest pass straight through.

Referenced types

Typestsx
export type MessageFeedback = 'up' | 'down' | 'none'

Frequently asked questions

How do I install the Message Action Bar component?

Register the @cleverui registry in your components.json ("@cleverui": "https://cleverops.com.au/r/{name}.json"), then run `npx shadcn@latest add @cleverui/message-action-bar`. The shadcn CLI copies the source into your project, you own the code from that point. You can also copy the source directly from this page.

What dependencies does Message Action Bar require?

Message Action Bar uses motion and lucide-react on top of React and Tailwind CSS. You don't need to install them manually, the shadcn CLI resolves and installs npm dependencies automatically when you add the component.

Can I theme Message Action Bar to match my brand?

Yes. The component is styled entirely with Tailwind utilities over standard design tokens (primary, background, muted, border), so it inherits your existing shadcn/ui theme automatically. Change your CSS variables and the component follows, no source edits needed for palette, radius, or fonts.

Want this built for you?

CleverUI is built by the Clever Ops web team. If you'd rather ship a hand-coded, fast, custom website than assemble one, we build them for Australian businesses every week.

Explore web development services