> For the complete documentation index, see [llms.txt](https://docs.rierino.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.rierino.com/sdk-core-ui/getting-started/installation.md). Agents can also search and read this documentation through its [MCP server](https://docs.rierino.com/~gitbook/mcp).

# Installation

Add Core UI to a React app.

{% hint style="info" %}
**Writing code inside Rierino?**

Custom lists, editors, pages and widgets inside Rierino already have Core UI loaded. Skip this page and go to [Usage in hosted editors](https://docs.rierino.com/sdk-core-ui/guides/hosted-editors.md).
{% endhint %}

## Requirements

* **React 18** and **React DOM 18**. They are not bundled with the package, so your app provides them.
* A bundler that understands ES modules and CSS imports, such as Vite or Next.js. The package is published as ES modules only.

## Setup

{% stepper %}
{% step %}

### Point the `@rierino-open` scope at GitHub Packages

The package is published to GitHub Packages, not the public npm registry. Add an `.npmrc` next to your `package.json`:

{% code title=".npmrc" %}

```ini
@rierino-open:registry=https://npm.pkg.github.com
//npm.pkg.github.com/:_authToken=${GITHUB_TOKEN}
```

{% endcode %}

GitHub Packages requires a token even for public packages. Create a [personal access token](https://github.com/settings/tokens) with the `read:packages` scope and export it as `GITHUB_TOKEN` in your shell and CI. Keep the token itself out of the committed `.npmrc`.
{% endstep %}

{% step %}

### Install the package

{% tabs %}
{% tab title="npm" %}

```bash
npm install @rierino-open/core-ui
```

{% endtab %}

{% tab title="pnpm" %}

```bash
pnpm add @rierino-open/core-ui
```

{% endtab %}

{% tab title="yarn" %}

```bash
yarn add @rierino-open/core-ui
```

{% endtab %}

{% tab title="bun" %}

```bash
bun add @rierino-open/core-ui
```

{% endtab %}
{% endtabs %}

React Aria, Tailwind Variants and the other runtime dependencies are installed with it.
{% endstep %}

{% step %}

### Import the stylesheet once

Import the compiled CSS at the root of your app, before your own styles:

{% tabs %}
{% tab title="Vite" %}
{% code title="src/main.tsx" %}

```tsx
import '@rierino-open/core-ui/dist/style.css';
import './index.css';
```

{% endcode %}
{% endtab %}

{% tab title="Next.js (App Router)" %}
{% code title="app/layout.tsx" %}

```tsx
import '@rierino-open/core-ui/dist/style.css';
import './globals.css';
```

{% endcode %}
{% endtab %}

{% tab title="Next.js (Pages Router)" %}
{% code title="pages/\_app.tsx" %}

```tsx
import '@rierino-open/core-ui/dist/style.css';
import '../styles/globals.css';
```

{% endcode %}
{% endtab %}
{% endtabs %}
{% endstep %}

{% step %}

### Use a component

{% code title="SaveButton.tsx" %}

```tsx
import { Button } from '@rierino-open/core-ui';

export function SaveButton({ onSave }: { onSave: () => void }) {
  return (
    <Button intent="g-button" onPress={onSave}>
      Save
    </Button>
  );
}
```

{% endcode %}

Components are named exports of the main entry point. Types ship with the package, so props autocomplete in TypeScript.
{% endstep %}
{% endstepper %}

## Data visualization

The `DV` components are available from the main entry as `DV`, or from a separate entry point that you can load on its own:

```tsx
import { DVProvider } from '@rierino-open/core-ui/dv';
```

The charts use Plotly and ECharts, which need a browser. In Next.js, load DV components on the client only, for example with `next/dynamic` and `ssr: false`.

## Good to know

{% hint style="warning" %}
**The stylesheet affects the whole page**

`style.css` includes Tailwind's base reset (preflight) and loads the Montserrat font from Google Fonts. Both apply to the whole document, not only to Core UI components. If your app has its own global styles, import them after `style.css` so they take precedence.
{% endhint %}

* **Already using Tailwind?** You don't need to add Core UI to your Tailwind `content` paths. The library's classes are already compiled into `style.css`.
* **Next.js App Router:** the published bundle is not marked `"use client"`. Import Core UI components from files that start with `'use client'`, not directly from server components.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.rierino.com/sdk-core-ui/getting-started/installation.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
