Use @appgram/react for React and Next.js applications. Start with the headless hook below, then choose the prebuilt components when you want AppGram’s interface.

Install

React 18+ and React DOM 18+ are peer dependencies. In an existing React application:

Code example
npm install @appgram/[email protected]

Show feedback and cast a vote

Copy this into a component file and replace the project values. The provider supplies configuration to every AppGram hook and component below it. This example uses your application’s HTML and styles.

Code example
'use client';

import { AppgramProvider, useAppgramContext, useVote, useWishes, type Wish } from '@appgram/react';

function FeedbackVote({ wish }: { wish: Wish }) {
  const { fingerprint } = useAppgramContext();
  const { hasVoted, voteCount, isLoading, error, vote } = useVote({
    wishId: wish.id,
    initialVoteCount: wish.vote_count,
    initialHasVoted: wish.has_voted,
  });

  return (
    <div>
      <button
        onClick={() => void vote()}
        disabled={!fingerprint || isLoading || hasVoted}
        aria-pressed={hasVoted}
      >
        {hasVoted ? 'Voted' : isLoading ? 'Saving…' : 'Vote'} ({voteCount})
      </button>
      {!fingerprint && <span> Preparing anonymous voting…</span>}
      {error && <p role="alert">{error}</p>}
    </div>
  );
}

function Feedback() {
  const { wishes, isLoading, error, refetch } = useWishes();

  if (isLoading) return <p>Loading feedback…</p>;
  if (error) return (
    <div>
      <p role="alert">{error}</p>
      <button onClick={() => void refetch()}>Try again</button>
    </div>
  );
  if (wishes.length === 0) return <p>No feature requests yet.</p>;

  return (
    <ul>{wishes.map((wish) => (
      <li key={wish.id}>
        <h2>{wish.title}</h2>
        <FeedbackVote wish={wish} />
      </li>
    ))}</ul>
  );
}

export default function App() {
  return (
    <AppgramProvider config={{
      projectId: 'YOUR_PROJECT_ID',
      orgSlug: 'your-org',
      projectSlug: 'your-project',
    }}>
      <Feedback />
    </AppgramProvider>
  );
}

First create and approve Feedback integration check using Getting started. Replace the project values, then confirm that request appears in the list. Cast a vote and refresh the dashboard to verify the saved count.

The button waits for the provider’s anonymous fingerprint, shows vote errors, and disables after a successful vote. If you disable fingerprint initialization, this example cannot cast anonymous votes. Read customer identity before choosing another identification workflow.

A successful empty list is different from a failed request. Check the selected project, approval, and filters if your sample is missing. Follow the complete signup-to-feedback walkthrough when setting up a new workspace.

Next.js App Router

Keep 'use client' at the top of the file that uses the provider and hooks. Render this client component from your page or layout. Do not add a management API key to a NEXT_PUBLIC_ variable or to provider configuration.

Prebuilt components and styles

The package also exports WishList, RoadmapBoard, HelpCenter, Releases, SupportForm, and other components. They use Tailwind utility classes; the package does not ship a standalone stylesheet.

If your application uses Tailwind CSS 3, preserve your existing configuration and include the package’s compiled files and preset:

Code example
// tailwind.config.cjs — merge these entries into your existing config
module.exports = {
  presets: [require('@appgram/react/tailwind-preset')],
  content: [
    './src/**/*.{js,ts,jsx,tsx}',
    './node_modules/@appgram/react/dist/**/*.{js,mjs}',
  ],
};

The preset supplies AppGram color and animation tokens; content scanning supplies the utility styles. If your build uses a different Tailwind version, use that version’s package-source registration rules. The headless hooks let you keep your own styling system.

Project configuration

projectId is required. Supply orgSlug and projectSlug for public URL and release routing. apiUrl can select your own API deployment; it defaults to https://api.appgram.dev.

Anonymous fingerprinting is enabled by default and can be disabled with enableFingerprinting: false. Read Customer identity and client credentials before choosing that behavior.

Continue with the React reference, pagination and errors, or troubleshooting guide.