---
title: "Installation"
description: "Add rightui components to your Exact app. Current release: 0.4.0-beta.4 (beta)."
---

# Installation

Add rightui components to your Exact app. Current release: 0.4.0-beta.4 (beta).

## Install with your AI agent

Copy this prompt into any coding agent. It will check your project, install rightui and add a working component.

```text
Add rightui to this project using the official @rightui/ui npm package.

Read https://rightui.dev/docs/installation.md and https://rightui.dev/llms.txt first. Follow this repository's instructions and preserve existing features, styling and uncommitted changes.

1. Inspect the project. rightui provides Exact Contract components for web, iOS and macOS. Find the Exact app, its package.json, app.contract and pinned SDK. If this is not an Exact project, explain that rightui cannot be imported as React, React Native or Vue components, and ask before creating an Exact app or migrating anything.

2. Install @rightui/ui@0.4.0-beta.4 as an exact dependency in the consuming app, using the project's package manager. With Bun: bun add --exact @rightui/ui@0.4.0-beta.4. Use the published npm package; do not substitute a local checkout, Git dependency or an invented adapter. Keep the lockfile in sync. Check the documented Exact compatibility and report any mismatch before changing the SDK.

3. Follow the font setup in the installation guide: copy Geist.ttf, Geist-Italic.ttf, Newsreader.ttf, Newsreader-Italic.ttf, OFL.txt, OFL-Italic.txt and OFL-Newsreader.txt from the package into the app's assets/fonts directory, then register Geist and Newsreader in Contract if it is not already configured. Preserve an intentional existing typeface. Add "rightui-font" to the top-level app.json data allowlist, preserving existing entries. Add uiFont = "theme" and uiWeights = defaultFontWeights() to the root component’s provide block (merge with its existing provide block). For runtime switching, provide a state choosing "sans", "serif" or "mono" instead.

If adding a code block, also install the root clipboard controller from the guide.

4. Import components with Contract syntax, for example: use Button from "@rightui/ui". Add a small working interaction to the appropriate existing screen using the documented props. Keep UI state and actions in Contract; keep existing TypeScript or Rust data logic in its data module. Do not replace the app with a starter template.

5. Run the project's build and relevant tests, then check the new interaction and responsive layout. Report the files changed, package version and checks actually completed. Distinguish web checks from native device validation, and list any remaining blockers.
```

## Before you start

Use an Exact app and Bun 1.4.2. This beta is tested with [expo/exact revision 53426cf](https://github.com/expo/exact/tree/53426cf02bf986a5e781abc4f953d79989c6dc05). If you are new to Exact, follow its [setup guide](https://github.com/expo/exact/blob/53426cf02bf986a5e781abc4f953d79989c6dc05/README.md) and create an app first. Run the following commands from your app directory. For a visual introduction to the layers, read [How Exact works](/docs/how-exact-works).

## Install the package

Install the shared component package once. Choose the package manager you use in your project. Pin the version while rightui is in beta.

```sh
# Bun
bun add --exact @rightui/ui@0.4.0-beta.4

# npm
npm install --save-exact @rightui/ui@0.4.0-beta.4

# pnpm
pnpm add --save-exact @rightui/ui@0.4.0-beta.4

# Yarn
yarn add --exact @rightui/ui@0.4.0-beta.4
```

## Allow the font marker

Add rightui-font to the top-level data allowlist in app.json. Merge it with existing entries. RightUI uses this marker to identify text that follows the body typeface.

```json
{
  "data": ["rightui-font"]
}
```

## Add the typeface

Copy the bundled Geist and Newsreader families with their licenses. Declare their regular and italic faces at the top of app.contract, as shown in the next step.

```sh
mkdir -p assets/fonts
cp node_modules/@rightui/ui/assets/fonts/Geist.ttf assets/fonts/
cp node_modules/@rightui/ui/assets/fonts/Geist-Italic.ttf assets/fonts/
cp node_modules/@rightui/ui/assets/fonts/OFL.txt assets/fonts/
cp node_modules/@rightui/ui/assets/fonts/OFL-Italic.txt assets/fonts/
cp node_modules/@rightui/ui/assets/fonts/Newsreader.ttf assets/fonts/
cp node_modules/@rightui/ui/assets/fonts/Newsreader-Italic.ttf assets/fonts/
cp node_modules/@rightui/ui/assets/fonts/OFL-Newsreader.txt assets/fonts/
```

## Use your first component

Copy this example into app.contract in a new app, or adapt the import and Button call in your existing view. The counter uses local state; the greeting comes from app.ts below. Every app root must provide uiFont = "theme" and uiWeights = defaultFontWeights(), even with the default theme. Merge this with any existing provide block; descendants inherit the selected font.

```contract
use defaultFontWeights from "@rightui/ui"
font "Geist"
  100 900 = "assets/fonts/Geist.ttf"
  100 900 italic = "assets/fonts/Geist-Italic.ttf"

font "Newsreader"
  200 800 = "assets/fonts/Newsreader.ttf"
  200 800 italic = "assets/fonts/Newsreader-Italic.ttf"

use uiFontFamily, Button from "@rightui/ui"

shape Greeting
  label: string

component App
  provide
    uiFont = "theme"
    uiWeights = defaultFontWeights()
  resource greeting = greeting() as shape Greeting
  state count = 0
  action increment
    count = count + 1
  view
    column padding=24 gap=12 color="ui.foreground" background-color="ui.background"
      text greeting.label font-family=uiFontFamily("theme") data-rightui-font="body"
      text count.toString() testId="counter" font-family=uiFontFamily("theme") data-rightui-font="body"
      Button(id="increment", label="Increment", variant="primary", disabled=false, press=increment)

```

## Add the data module

Use this as app.ts for the example. It answers the greeting requested by app.contract. The next command generates its Answer type.

```typescript
import type { Answer } from './app.contract.d.ts';

export const grants = '';
export const answer: Answer = (source) => {
  if (source === 'greeting') return { label: 'Hello from TypeScript' };
  throw new Error(`Unknown source: ${source}`);
};

```

## Enable code-block copying

If you use CodeBlock, CodeBlockAdvanced, CodeBlockAI or CodeBlockFrame, merge this controller into your application root. It copies the original text and resets feedback after three seconds; a repeated copy restarts the delay. Keep the font declarations and app.json metadata from the steps above. Exact dispatches the platform clipboard command but does not report its success back to Contract.

```contract
use defaultFontWeights from "@rightui/ui"
use CodeBlock from "@rightui/ui"

component App
  state copiedId = ""
  state copiedText = ""
  state copyVersion = 0
  provide
    uiFont = "theme"
    uiWeights = defaultFontWeights()
    uiCopiedId = copiedId
    uiCopiedText = copiedText
    uiCopyCode = copyCode
  action copyCode(id: string, text: string)
    copyText(text)
    copiedId = id
    copiedText = text
    copyVersion = copyVersion + 1
  action clearCopyFeedback
    copiedId = ""
    copiedText = ""
  task copiedFeedback when copiedId != "" key=copyVersion
    after(3000, clearCopyFeedback)
  view
    CodeBlock(id="example", title="hello.ts", language="ts", code="console.log('Hello')", numbers=false, diff=false)
```

## Start the app

Run the web preview from your app directory. Press Increment to check that the component responds. For data integration, continue with the [TypeScript guide](/docs/installation/typescript) or [Rust guide](/docs/installation/rust).

```sh
bun exact.mjs contract types app.contract -o app.contract.d.ts
bun exact.mjs web
```

## Add more components

Browse [Components](/docs/components) for live previews, imports and props. Every component uses the same @rightui/ui package. [AI Elements](/docs/ai-elements) and [Blocks](/blocks) are source patterns you can copy and adapt.

## Update your version

Read the [changelog](/source?file=packages/ui/CHANGELOG.md) before installing a newer beta, then build and test your app. Commit package.json and your lockfile together. To roll back, reinstall the previous exact version. Keep your Exact SDK version unchanged unless the release notes require an upgrade.

```sh
bun add --exact @rightui/ui@0.4.0-beta.4
```

## Platform support

Rightui targets Web, iOS and macOS. Windows and Android are not supported. See the [compatibility table](/docs/compatibility) for the checks completed for each component. Rightui remains in beta; there is no stable release yet.
