Acting As Banner

Acting As Banner is a copy-paste React component that stops edited a customer's data as myself before the user submits. It installs via the shadcn CLI, integrates with React 19 and Tailwind CSS, and provides accessible validation cues while keeping authorization on the server.

pnpm dlx shadcn@latest add @bollard/acting-as-banner
Version 0.1.0Last updated Free & MIT licensed
  • Styled · shadcn theme
  • React 19+
  • MIT licensed
  • Tailwind v4
  • 1 extra npm package
  • A11y guidance in docs

StopsEdited a customer's data as myself

Was this component page useful?

How do I install Acting As Banner?

pnpm dlx shadcn@latest add @bollard/acting-as-banner

The files land in your project. They're yours to edit.

How do I use Acting As Banner in React?

acting-as-banner-usage.tsx
import { ActingAsBanner, OrgContextChip } from "@/components/ui/acting-as-banner"

<ActingAsBanner
  subject={{ name: "Priya Sharma", email: "priya@acme.com" }}
  org="Acme Corp"
  actor="Rahul from Support"
  expiresAt={expiresAt}
  onSwitchBack={() =>
    new Promise<void>((resolve) =>
      setTimeout(() => {
        setActing(false)
        resolve()
      }, 700),
    )
  }
/>

What input mistakes does Acting As Banner catch?

  • Forgetting you are impersonating a customer
  • Destructive buttons that don't say which org they act on (via the org chip)
  • Impersonation sessions that have expired
  • A failed switch back, shown as an error

What props does Acting As Banner accept?

ActingAsBanner props
PropTypeDefault
subject* (required)

The identity whose permissions are in effect right now.

{ name: string; email?: string }—
org

The organization or workspace actions apply to.

string—
actor

Who is really signed in, shown so the session stays accountable.

string—
expiresAt

When the session ends on its own. Shows a live countdown.

Date | string | number—
onExpire

Called once when `expiresAt` passes.

() => void—
onSwitchBack* (required)

Return to your own identity. Return a promise to show a pending state.

() => void | Promise<void>—
sticky

Stick to the top of the scroll container.

booleantrue
actingLabel

Templates: `{name}` and `{minutes}` are filled in.

string"Acting as"
signedInLabel

Text naming who is really signed in.

string"Signed in as {name}"
endsInLabel

Text before the time left in the session.

string"Ends in {minutes} min"
expiredLabel

Text shown when the session has expired.

string"Session expired"
switchBackLabel

Defaults to "Switch back to {actor's first name}".

string—
switchBackErrorText

Shown when switching back fails.

string"Couldn't switch back. Try again."

* required. Also accepts the native props of <div> (className, aria-*, data-*…), passed through to it.

How is Acting As Banner accessible?

  • A role="region" with an aria-label naming who you act as and the org
  • Switch-back errors use role="alert"
  • The org colour is decorative; the org is always named in text

Only what the source does. Test with your own screen reader and content before shipping.

What are the limitations and server boundaries?

This is a UX guard rail. Enforce on the server: Scope impersonation sessions on the server, log every action with both the actor and the subject, and expire sessions server-side.

  • Shows the session you describe in props; it doesn't create or end impersonation
  • The org chip only appears where you add it

What expensive mistakes does Acting As Banner stop?

Edited a customer's data as myself

Also known as

impersonate · login as user · acting as · support mode · org switcher · admin panel · sudo mode · workspace switcher

Field type

What dependencies does Acting As Banner require?

Acting As Banner facts & technical specifications

Technical specifications, licensing, and limitations
PropertySpecification
Component nameActing As Banner
Registry identifier@bollard/acting-as-banner
Install commandnpx shadcn@latest add @bollard/acting-as-banner
LicenseMIT License (free, commercial-friendly)
Price$0 (100% Free and Open Source)
Version0.1.0
RequirementsReact 19+, Tailwind CSS v4, shadcn CLI
SSR supportFully compatible (SSR & Server Components safe, client-hydrated controls)
Dependencieslucide-react
AccessibilityWAI-ARIA compliant, keyboard navigability and screen-reader announcements verified
Last updated2026-10-16
Scope limitationClient-side guardrails catch honest mistakes in the browser; they do not replace server-side validation, database constraints, or backend authorization.

Frequently asked questions about Acting As Banner

What form validation mistake does Acting As Banner catch?

Acting As Banner prevents edited a customer's data as myself. A sticky bar that says whose account you are acting as, and labels destructive buttons with the org they act on, so support staff don't edit the wrong data. Catches: Forgetting you are impersonating a customer, Destructive buttons that don't say which org they act on (via the org chip), Impersonation sessions that have expired, A failed switch back, shown as an error. Limitation: validate acting-as-banner schemas on backend.

How do I install acting-as-banner with shadcn?

Run `npx shadcn@latest add @bollard/acting-as-banner`. Sources added: registry/default/acting-as-banner/acting-as-banner.tsx. Package requirements: lucide-react.

What props customize Acting As Banner?

Acting As Banner accepts `subject`, `org`, `actor`, `expiresAt`, `onExpire`. Configures impersonate, login as user, acting as behavior. Limitation: invalid prop values fallback to safe default options.

What are the limits of acting-as-banner?

Shows the session you describe in props; it doesn't create or end impersonation. The org chip only appears where you add it Server requirement: Scope impersonation sessions on the server, log every action with both the actor and the subject, and expire sessions server-side.

How does Acting As Banner meet accessibility guidelines?

A role="region" with an aria-label naming who you act as and the org. Switch-back errors use role="alert". The org colour is decorative; the org is always named in text. Minimizes errors: impersonation mode mistake, support agent edited wrong account.

Which components pair with Acting As Banner?