YuktaiDocs v5.3.12

Next.js setup

Next.js setup

Add YuktAI to a Next.js App Router project with one client component. Choose the floating buttons your users need; the files below are generated for exactly that choice.

Builder

Buttons

One button that shows or hides the others; remembers the choice; Esc closes.

Contrast, text size, dyslexia font, colour-blind filters…

Questions about the page (RAG), answered on the device.

Page agent for multi-step tasks.

Developer tool: generate UI code. Usually off in production.

Copilot, QA report (15 WCAG checks), Forms, Design, Ask page, Voice. New in 5.3.11.

Engine options

Your visitors will see

app/YuktaiClient.tsx
// generated
app/layout.tsx
// generated

Steps

  1. Install: npm install @yuktishaalaa/yuktai@5.3.12 (or newer). Works with Next.js 13 to 16 and TypeScript 5 to 7.
  2. Create YuktaiClient.tsx next to your root layout and paste the first file. It must start with "use client": YuktAI uses browser APIs, and the package itself does not mark its components as client components.
  3. In layout.tsx, wrap {children} with <YuktaiClient>. Keep metadata and fonts in the layout as they are.
  4. Run npm run dev. The buttons appear at the side you chose.

Using other YuktAI components

app/staff/page.tsx
"use client"
import { YuktaiGrid, AgenticPanel } from "@yuktishaalaa/yuktai"
import { SearchIcon } from "@yuktishaalaa/yuktai/icons"

export default function Staff() {
  return (
    <main>
      <h1><SearchIcon size={28} color="#0a4a85" /> Staff</h1>
      <YuktaiGrid data={rows} columns={columns} rowKey="id" engine="auto" showSearchTime />
      <AgenticPanel defaultTab="ask" engine="rust" />
    </main>
  )
}

The second tab here shows the Pages Router version instead of plain HTML.

Common problems

Symptom, cause and fix
SymptomFix
Error about hooks or window in a Server ComponentUse YuktAI only inside a file that starts with "use client" (like YuktaiClient.tsx), not directly in layout.tsx.
Type error: children is missingYuktAIWrapper must wrap your content: <YuktAIWrapper>{children}</YuktAIWrapper>, not self-closing.
Page content shows twiceRender {children} once, inside the wrapper only.
New props (launcher, showVibeCoder, engine) show type errorsDelete old hand-written declare module "@yuktishaalaa/yuktai" files (for example src/types/*.d.ts); the package ships its own types.
Old version still runningnpm ls @yuktishaalaa/yuktai, then npm install @yuktishaalaa/yuktai@latest and restart npm run dev.
🛠 or ⚡ buttons overlap after updatingRemove any old custom CSS that moves YuktAI buttons (for example transform: translateY(-64px) on html[data-yuktai-tools]). Since 5.3.9 the launcher prop stacks every button itself.
In npm run dev, the Next.js "N" badge covers the left buttonsDevelopment only. Move it with devIndicators: { position: "bottom-right" } in next.config, or put YuktAI on the right.
Rust engine reported as "ts"The browser blocked WebAssembly (often a Content Security Policy). Allow 'wasm-unsafe-eval' in script-src; YuktAI falls back to TypeScript meanwhile, with the same results.
YuktAIWrapper props
PropWhat it does
childrenYour app (required)
position"left" (default) or "right"
launcherOne ✨ button that shows or hides the others
showAccessibility, showRag, showAgent, showVibeCoderTurn each button on. Setting showAccessibility, showVibeCoder or launcher switches every button to opt-in
showPageTools5.3.11: adds 🛠 Page tools (Copilot, QA report, Forms, Design, Ask page, Voice), always the top button. Adding it does not change which other buttons show
pageToolsTabTab 🛠 opens on: "copilot" (default), "qa", "forms", "design", "ask" or "voice"
voiceLangSpeech language for the 🛠 Voice tab, for example "te-IN" (default "en-IN")
engine"rust", "auto" or "ts": 💬 Ask page finds passages with the page RAG first, then the on-device model answers from them. Also used by the 🛠 Ask tab (Rust by default since 5.3.11)
configEngine options, for example { autoFix: false }

Older usage still works: with none of showAccessibility, showVibeCoder or launcher set, ♿ is always shown and ⚡ follows showAgent.