SDAIA

Next.js

Set up SDAIA UI in a new or existing Next.js project.

Before you start

  • Node.js 20.9 or later (required by current versions of Next.js).
  • A Next.js project that uses the App Router or the Pages Router. Projects with or without a src/ folder both work.

1. Create a project

Skip this step if you already have a Next.js project. When create-next-app asks, keep TypeScript and the default @/* import alias. You can answer yes or no to the App Router, Tailwind CSS and the src/ folder: init handles every combination.

npx create-next-app@latest my-app

2. Run init

Run init from the project root:

npx sdaia-ui@latest init

init detects Next.js and asks four questions. The answers are pre-filled for your project, so you can press Enter for each one:

? Where should components be installed? › src/components/ui
? Where should utilities (cn.ts) be installed? › src/lib
? Which CSS file is your global stylesheet? › src/app/globals.css
? Which brand? (decides which font is installed) › Sdaia-DGA (default)

Without a src/ folder the suggestions are components/ui, lib and app/globals.css. If Tailwind CSS is not installed, init asks Install Tailwind CSS now?. Answer yes: components need Tailwind CSS v4. init then adds the core styles to your global CSS file and imports the fonts in app/layout.tsx. To skip every question, run init --yes.

Using the Pages Router

init finds pages/_app.tsx and puts the font imports there (in the Pages Router, Next.js allows global CSS only in that file), and suggests styles/globals.css as the stylesheet. For Arabic, set dir="rtl" and lang="ar" on <Html> in pages/_document.tsx instead of app/layout.tsx.

3. Add a component

npx sdaia-ui@latest add button

The Button is copied to src/components/ui/Button (or components/ui/Button without a src/ folder).

4. Use it

import { Button } from '@/components/ui/Button';
export default function Page() {
return <Button variant="primary">Get started</Button>;
}

Start the dev server with npm run dev and open the page.

Updating components

Installed components are your files, so new releases do not change them on their own. diff shows what changed for the components you installed, and update applies it (name the components, or use --all). Files you edited yourself are kept unless you pass --force; --dry-run previews the changes.

npx sdaia-ui@latest diff
npx sdaia-ui@latest update button

Arabic, dark mode and brands

Components follow the document direction. For Arabic, set lang="ar" and dir="rtl" on the <html> element in app/layout.tsx, or pass dir="rtl" to a single component. For dark mode, toggle the theme-dark class on the <html> element: it switches both the design tokens and Tailwind dark: styles. A plain dark class works the same way. If you chose a brand other than Sdaia-DGA, add the class init prints (for example brand-spectrum) to the <html> element too.

<html lang="ar" dir="rtl" className="theme-dark">