a2ui-shadcn logoa2ui-shadcn
DocsPlayground

Resources

  • Documentation
  • Playground
  • A2UI Protocol

Community

  • GitHub
  • Issues
  • shadcn/ui

More

  • Tailwind CSS
  • Next.js
  • React

a2ui-shadcn.shahnazar.me

Created by Reza Shahnazar

Getting Started

  • Introduction
  • Installation
  • Usage

Components

  • Components
    Layout
    ColumnRowCard
    Content
    Text
    Input
    TextFieldCheckBox
    Interactive
    Button
    Feedback
    Badge

Reactivity & Actions

  • Actions
  • Transport

Styling

  • Theming
  • RTL Support

Advanced

  • Custom Components
  • API Reference
  1. Home
  2. /Docs
  3. /Installation
IntroductionInstallationUsageComponentsThemingRTL SupportCustom ComponentsActionsTransportAPI Reference

Installation

Step-by-step guide to installing and setting up a2ui-shadcn in your Next.js or Vite project with shadcn/ui.

Installation Guide

Prerequisites

Before installing a2ui-shadcn, ensure you have:

  • Node.js 18.0.0 or higher
  • Package Manager: pnpm (recommended), npm, or yarn
  • React 18.0.0 or higher
  • TypeScript 5.0.0 or higher (optional but recommended)

Step 1: Install the Package

Note: We recommend using pnpm for faster installs and better dependency management.

Choose your preferred package manager:

bash

Step 2: Set Up shadcn/ui

a2ui-shadcn requires shadcn/ui as a peer dependency. If you haven't already set it up:

bash

Follow the prompts to configure:

  • Style: Choose your preferred style (Default or New York)
  • Color: Pick a base color (Slate, Gray, etc.)
  • CSS Variables: Recommended for theming flexibility

For RTL Support:

If you need right-to-left layout support (Arabic, Hebrew, Persian):

bash

Or migrate an existing project:

bash

Step 3: Configure TypeScript (Optional)

Add path aliases to your tsconfig.json:

json

Step 4: Verify Installation

Create a simple test component:

tsx

Run your development server and navigate to the test page. You should see "Hello, A2UI!" rendered.

Framework-Specific Setup

#### Next.js 13+ (App Router)

a2ui-shadcn works seamlessly with Next.js App Router. No additional configuration needed.

Example Page:

tsx

#### Next.js Pages Router

Works with Pages Router as well. Import and use in any page component.

#### Vite + React

Add to your main component:

tsx

Troubleshooting

Issue: "Cannot find module 'a2ui-shadcn'"

  • Ensure the package is installed: pnpm list a2ui-shadcn
  • Restart your dev server

Issue: "Component not rendering"

  • Check browser console for errors
  • Verify your A2UI JSON messages are valid
  • Ensure surfaceId matches in all messages

Issue: "Styling doesn't match"

  • Run npx shadcn@latest init to set up shadcn/ui
  • Check Tailwind CSS is properly configured

Next Steps

Now that you've installed a2ui-shadcn, continue to:

  • Usage Guide - Learn basic API usage
  • Components Reference - Explore all available components
  • Interactive Playground - Try live examples
Previous
Introduction
Next
Usage