# Installation

> Set audio/ui up by hand in your framework, as the prompt of Get Started does for you.

The prompt of the [Get Started](/docs) page does this for you. Here is what it sets up by hand, in your framework.

## Prerequisites

**In React**

audio/ui is built on **React 19** and [Tailwind CSS v4](https://tailwindcss.com). Set up both first, with shadcn/ui: the [shadcn/ui installation guide](https://ui.shadcn.com/docs/installation) covers the environment.

**In Vue**

A Vue 3 app. The files go in `src/components/audio-ui/`, and your bundler needs an alias for them to build, as for any import of yours: in Vite, `resolve.alias` of `@` to `./src`. Tailwind CSS is not needed.

In Nuxt 4, put them in `components/` at the project root, not under `app/`, and import from there with Nuxt's root alias, `~~/components/audio-ui/knob/vue`.

**In Svelte**

A Svelte 5 app. The files go in `src/lib/components/audio-ui/`. Import them through the alias of `src/lib`: `$lib` in SvelteKit before its removal, `#lib` in the latest SvelteKit (its docs say how to keep `$lib`), and in a Vite app without SvelteKit, an alias of your own: `resolve.alias` of `$lib` to `./src/lib`. Tailwind CSS is not needed.

**In Web**

A page, or an app, with a bundler such as Vite that resolves package imports. The files go in `src/components/audio-ui/`. It needs no Tailwind and no path alias.

The primitive is TypeScript (`web.ts`): a bundler such as Vite compiles it.

## Install a primitive

**In React**

Copy a styled component with the shadcn CLI. `@audio-ui` is in shadcn's registry directory, so there is nothing to configure:

```bash
npx shadcn@latest add @audio-ui/knob
```

Or, without the styles, copy the headless primitive and style it yourself:

```bash
npx shadcn@latest add @audio-ui/knob-react
```

The same works for every item of the [Docs](/docs), including the `block-*` blocks and demos you install with `@audio-ui/…`. You can also install by manual copy, for full control.

**In Vue**

Copy the styled knob with the [CLI](/docs/cli): its primitive, its adapter and its Vue component, its sheet and the theme's tokens. It finds your framework in `package.json` and installs the packages:

```bash
npx @audio-ui/cli add knob
```

Or, without the styles, the headless primitive alone: `npx @audio-ui/cli add knob --headless`. The libraries and the engine's modules install the same way: `npx @audio-ui/cli add engine-time`.

By hand, the headless knob is a few files you copy and paste:

**1. Install the kernel:**

```bash
npm install @ui-sdk/core@0.1.0-beta.14 @ui-sdk/vue@0.1.0-beta.14 vue
```

**2. Copy each file to its path, under `src/components/audio-ui/`:**

<ItemFiles name="knob-vue" under="src/" />

**In Svelte**

Copy the styled knob with the [CLI](/docs/cli): its primitive, its adapter and its Svelte component, its sheet and the theme's tokens. It finds your framework in `package.json` and installs the packages:

```bash
npx @audio-ui/cli add knob
```

Or, without the styles, the headless primitive alone: `npx @audio-ui/cli add knob --headless`. The libraries and the engine's modules install the same way: `npx @audio-ui/cli add engine-time`.

By hand, the headless knob is a few files you copy and paste:

**1. Install the kernel:**

```bash
npm install @ui-sdk/core@0.1.0-beta.14 @ui-sdk/svelte@0.1.0-beta.14 svelte
```

**2. Copy each file to its path, under `src/lib/components/audio-ui/`:**

<ItemFiles name="knob-svelte" />

**In Web**

Copy the styled knob with the [CLI](/docs/cli): its primitive, its custom elements, its sheet and the theme's tokens. It finds your framework in `package.json` and installs the packages:

```bash
npx @audio-ui/cli add knob
```

Or, without the styles, the headless primitive alone: `npx @audio-ui/cli add knob --headless`. The libraries and the engine's modules install the same way: `npx @audio-ui/cli add engine-time`.

By hand, the headless knob is a few files you copy and paste:

**1. Install the kernel:**

```bash
npm install @ui-sdk/core@0.1.0-beta.14 @ui-sdk/web@0.1.0-beta.14
```

**2. Copy each file to its path, under `src/components/audio-ui/`:**

<ItemFiles name="knob-web" under="src/" />

**In React**

## Choose a base

A base is a complete set of components over one library of behaviors: focus, keys, popups. audio/ui ships two, as styles of the registry, each in the eight looks (`nova`, `vega`, `maia`, `lyra`, `mira`, `luma`, `rhea`, `sera`):

| Base | Style in `components.json` | Behaviors from |
| --- | --- | --- |
| `base` | `base-nova` | `@base-ui/react` |
| `ui-sdk` | `ui-sdk-nova` | `@ui-sdk/react` |

The style you set chooses. Every item installs the same way, `npx shadcn@latest add @audio-ui/knob`, and the base decides what comes with it: the ui components an item uses (button, select, dialog, menus) and the items that name a library, such as the rocker switch and the parameter field, which have a variant in each base. Pick one base for a project: files of the other bring their own library along.

```json title="components.json"
{
  "style": "ui-sdk-nova"
}
```

Each base publishes these ui components itself, over its own library: accordion, alert dialog, avatar, badge, button, button group, calendar, carousel, checkbox, collapsible, combobox, command, context menu, dialog, drawer, dropdown menu, empty, hover card, input, input group, input OTP, item, kbd, menubar, navigation menu, pagination, popover, progress, radio group, resizable, scroll area, select, separator, sheet, slider, switch, tabs, textarea, toast (sonner on `base`), toggle, toggle group, toolbar and tooltip. Those with no behavior library of their own (alert, card, field, label, skeleton, table…) come from shadcn. Any other component you add comes from shadcn, over the library of your project.

On `ui-sdk`, declare its layer first in your global stylesheet, above Tailwind's import, so your own styles win over its behavior CSS:

```css title="src/styles/globals.css"
@layer ui-sdk;
@import "tailwindcss";
```

In the customizer of this site, the Component Library picker switches the base the previews and the code shown are for.

## Shared files

`primitive.ts`, `grid.ts`, `frame.ts` and `pitch.ts` are shared: every primitive that reads one installs it at the same path. The CLI skips a file your project already holds, so you keep the copy you installed first. These files only gain exports, never lose one, so a primitive installed later still finds what it reads. To pick up an addition, ask the CLI to overwrite (`npx shadcn@latest add <item> --overwrite`), or copy the file from its item by hand.

**In React**

## Without the CLI

Each item is a JSON file at its address, and the CLI only reads it: you can do the same by hand. Open the address of the item (for the knob in Vue, `https://www.audio-ui.dev/r/styles/ui-sdk-nova/knob-vue.json`), write each entry of `files` to its path under `components/audio-ui/` with its `content`, and install the packages its `dependencies` lists. An agent can do this for you: the prompt of [Get Started](/docs) says how.

## Use it

**In React**

Import it from where it landed, through your `components` alias:

```tsx
import { Knob } from "@/components/audio-ui/knob";
```

**In Vue**

Import the styled knob from where it landed, and its sheets once, in your app's entry (`src/main.ts`):

```ts
import Knob from "@/components/audio-ui/knob/Knob.vue";
import "./components/audio-ui/css/index.css";
```

The headless knob is its parts:

```ts
import { Knob } from "@/components/audio-ui/knob/vue";
```

**In Svelte**

Import the styled knob from where it landed, and its sheets once, in your app's entry (`src/main.ts`):

```ts
import Knob from "$lib/components/audio-ui/knob/Knob.svelte";
import "./lib/components/audio-ui/css/index.css";
```

The headless knob is its parts:

```ts
import { Knob } from "$lib/components/audio-ui/knob/svelte";
```

With the latest SvelteKit, write `#lib/components/audio-ui/knob/svelte`.

**In Web**

Import it once, in your app's browser entry, with the sheets the CLI wrote: the import registers the `audio-ui-knob` tags, and the page can then use them.

```ts
import "./components/audio-ui/knob/web.ts";
import "./components/audio-ui/css/index.css";
```

The page of each component has its parts, its options and an example in your framework: [Knob](/docs/components/base/knob) is the first to open.

**In Web**

## Without a build step

A plain HTML page can run a primitive with no CLI, no bundler and no `node_modules`: the site serves each web adapter as a script, with its packages inside. Load the one you need, and write its tags:

```html title="index.html"
<script type="module" src="https://www.audio-ui.dev/web/0.1.14/knob.js"></script>

<audio-ui-knob value="40">
  <audio-ui-knob-control>
    <audio-ui-knob-track></audio-ui-knob-track>
    <audio-ui-knob-indicator></audio-ui-knob-indicator>
    <audio-ui-knob-thumb aria-label="Cutoff"></audio-ui-knob-thumb>
  </audio-ui-knob-control>
  <audio-ui-knob-value></audio-ui-knob-value>
</audio-ui-knob>
```

The folder of the address is a version of the scripts, and the files of a version never change: your page keeps what you wrote it against, and moving to a newer version is a change of the address. There is no address that follows the latest release. Every primitive has a script, named as it is: `fader.js`, `meter.js`, `waveform.js`, `piano-roll.js`… A page that loads several downloads the code they share once. Browsers only run module scripts from a server, so open the page through one, not from the file system.

## What a component brings

A primitive imports no package of ours, only the kernel. A component that needs the audio logic (pitch, MIDI, musical time, analysis) installs the engine's modules it imports with itself, as files in `lib/engine/<module>/`, and the npm packages they use. Like every file of the registry, they are yours: an update is installing the item again with `--overwrite` (`npx shadcn@latest add @audio-ui/engine-time --overwrite` in React, `npx @audio-ui/cli add engine-time --overwrite` in the other frameworks).

## Styling

**In React**

Components are styled with a design token system defined by CSS variables and implemented with Tailwind CSS, following the same conventions as shadcn/ui so they're fully customizable. See the [Styling guide](/docs/styling) for details.

**In Vue, Svelte and Web**

The styled component is drawn by its sheet: plain CSS on its parts, in the style you picked, with no Tailwind. See the [Styling guide](/docs/styling) for the styles and the skins.

A primitive is headless: it brings behavior and accessibility, and no styles. Each part takes the classes and attributes of its element, and carries state attributes (`data-dragging`, `data-disabled`…) to style from, with your own CSS or with Tailwind CSS. The page of each component lists the attributes of its parts.

Continue with [First Component](/docs/first-component) to add a knob to your app.
