Skip to content
LogoLogo

AI Button

Loading...

Loading...

Overview

Resources

Loading...

Loading...

Loading...

Loading...

Install

yarn add @camp/ai-button

Props

PropTypeDefaultDescription
appearance"text" | "primary" | "secondary" | "pill" | "pill-gradient" | "invalid"primaryVisual style variant of the button. - `primary`: Emphasis background with on-emphasis text - `secondary`: Default background with border - `text`: Transparent background, text-only appearance - `pill`: Pill-shaped with soft shadow - `pill-gradient`: Pill-shaped with gradient background - `invalid`: Destructive/error state styling
onClickMouseEventHandler<HTMLButtonElement>
size"small" | "large" | "medium"largeSize of the button affecting padding and font size. - `large`: 12px 24px padding, 16px font - `medium`: 8px 16px padding, 14px font - `small`: 4px 8px padding, 12px font
disabledbooleanWhether the button is disabled. When disabled, opacity is reduced and interactions are prevented.
themedbooleantrueWhether the component should adapt to theme context. When false, forces light theme.
type"button" | "submit" | "reset"
styleCSSProperties
gradientBorderbooleanfalseFor secondary and pill appearances, apply a gradient border on hover/focus/active states. Creates an animated gradient border effect using a pseudo-element.
aria-labelstringDefines a string value that labels the current element. @see aria-labelledby.
tabIndexnumber
valuestring | number | readonly string[]
aria-busyBooleanish
aria-pressedboolean | "true" | "false" | "mixed"Indicates the current "pressed" state of toggle buttons. @see aria-checked @see aria-selected.
keyKey
onKeyDownKeyboardEventHandler<HTMLButtonElement>
aria-expandedBooleanishIndicates whether the element, or another grouping element it controls, is currently expanded or collapsed.
onMouseEnterMouseEventHandler<HTMLButtonElement>
onMouseLeaveMouseEventHandler<HTMLButtonElement>
refLegacyRef<HTMLButtonElement>Allows getting a ref to the component instance. Once the component unmounts, React will set `ref.current` to `null` (or call the ref with `null` if you passed a callback ref). @see {@link https://react.dev/learn/referencing-values-with-refs#refs-and-the-dom React Docs}
roleAriaRole

Generated from @camp/ai-button@6.14.0 source, ordered by production usage. * required. † standard HTML attribute — all native attributes are supported; only those with production usage are listed.

Variations

The AI Button is available in multiple appearances and sizes to fit various contexts.

Appearances

  • Primary: The primary appearance is used for the main call to action.
  • Secondary: The secondary appearance is used for less prominent actions.
  • Text: The text appearance gives the button the look of a link, for tertiary actions.
  • Pill: The pill appearance is a rounded button.
  • Pill Gradient: The pill-gradient appearance provides a visually distinct style for AI-powered suggestions.
  • Invalid: The invalid appearance is used to indicate that the action is not available or not valid.
 
<AiButton appearance="primary">Primary</AiButton>
<AiButton appearance="secondary">Secondary</AiButton>
<AiButton appearance="text">Text</AiButton>
<AiButton appearance="pill">Pill</AiButton>
<AiButton appearance="pill-gradient">Pill Gradient</AiButton>
<AiButton appearance="invalid">Invalid</AiButton>

Sizes

The AI Button is available in small, medium, and large sizes.

 
<div style={{ display: 'flex', gap: '16px', alignItems: 'center' }}>
  <AiButton size="large">Large</AiButton>
  <AiButton size="medium">Medium</AiButton>
  <AiButton size="small">Small</AiButton>
</div>

Disabled

The button can be disabled to prevent user interaction.

 
<AiButton disabled>Disabled</AiButton>

Usage

Content guidelines

Button labels should be clear and concise, in sentence case, and with no punctuation.

✅ DO

- Generate with AI - Suggest a reply - Improve writing

🚫 DON’T

- Generate - AI Suggestion - Click to Improve

Accessibility

Keyboard support

  • Tab: Moves focus to the button.
  • Enter/Space: Activates the button.

Replacing this component in ACF Agent App

Replace the existing @/components/button with @camp/ai-button:

// Before
import { Button } from '@/components/button';
<Button>Generate content</Button>;
 
// After
import { AiButton } from '@camp/ai-button';
<AiButton appearance="primary" size="large">
  Generate content
</AiButton>;

Breaking changes:

  • Component name: ButtonAiButton
  • Props appearance and size are now required (no defaults)
  • Removed pill-gradient-vertical appearance (use pill-gradient instead)
Copyright © 2026 ActiveCampaign