> ## Documentation Index
> Fetch the complete documentation index at: https://onset.io/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Install

> It only takes a few minutes to install Onset widget on your website.

## How to install

There are two ways to install the Onset widget:

1. Using the **NPM** package
2. Using the **embed** script

Both methods give you access to the same widget API.

### 1. Install via npm

**1. Install the Onset widget package**

```shell npm theme={null}
npm install @onsetio/widget
```

```shell yarn theme={null}
yarn add @onset/widget
```

**2. Create a widget client instance**

```typescript theme={null}
import { OnsetWidget } from "@onsetio/widget";

const widget = new OnsetWidget({
  page: "PAGE_DOMAIN",
});
```

**3. Use the instance**

You can now control the widget using the exposed methods.

```typescript theme={null}
widget.openWidget();
widget.closeWidget();
```

Refer to the Methods section for the full API.

### 2. Install via embed script

**1. Copy the embed snippet**

Go to your Onset **Dashboard -> Settings -> Widget** and copy the provided `<script>` snippet. Paste it into your site's HTML, right before the closing `</body>` tag.

**2. Use the global instance**

The embed script exposes a global onsetWidget instance.

```typescript theme={null}
widget.openWidget();
widget.closeWidget();
```

## Troubleshooting

> [accordion] Widget does not appear
>
> Check the following:
>
> * The script snippet or NPM import is included on every page where the widget should load.
> * `page` domain is correct.

> [accordion] onsetWidget is undefined
>
> This means the embed script did not load.
>
> Verify that the `<script>` tag is placed before the closing `</body>` tag, not in the `<head>`.

> [accordion] Open or close methods do nothing
>
> Usually caused by initialization issues.
>
> Make sure the widget is created before calling its methods.

> [accordion] Widget loads but shows the wrong workspace
>
> Double-check the `page` domain in:
>
> * The NPM initialization config
> * The embed snippet you copied from the dashboard

> [accordion] How to find my page URL
>
> Page domain is a URL to your public onset release notes page without the `https://`
>
> **Examples:**\
> [example.onset.io](http://example.onset.io) - Onset page domain\
> [releases.example.com](http://releases.example.com) - Custom domain page


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.