> For the complete documentation index, see [llms.txt](https://partner-docs.covergenius.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://partner-docs.covergenius.com/elements/installation.md).

# Installation

Add the CG Elements SDK to your project.

{% hint style="warning" %}
The package is not on npm yet. During alpha, Cover Genius publishes each version as a release on GitHub. Install the package from the release.
{% endhint %}

### Package

<table><thead><tr><th width="156.5">Item</th><th>Value</th></tr></thead><tbody><tr><td>Package name</td><td><code>@covergenius/elements</code></td></tr><tr><td>Module formats</td><td>ESM and CommonJS</td></tr><tr><td>Types</td><td>Included (<code>.d.ts</code> for ESM, <code>.d.cts</code> for CommonJS)</td></tr><tr><td>Licence</td><td>Apache-2.0</td></tr><tr><td>Dependencies</td><td>None. The SDK does not need React, Vue, or any other framework.</td></tr></tbody></table>

### Install

{% stepper %}
{% step %}
**Choose a version**

Open the [releases page](https://github.com/CoverGenius/elements/releases). Each release has a tag in the form `vanilla-vX.Y.Z`. Each release holds the tarball `covergenius-elements-X.Y.Z.tgz` and a `SHA256SUMS` file. The tarball is the package that your package manager installs.
{% endstep %}

{% step %}
**Install**

Use the release URL as the package source. The URL pins the version. Your lockfile keeps the hash.

Replace `X.Y.Z` with the version that you chose. The tag and the file name both hold the version, so change both.

{% tabs %}
{% tab title="npm" %}
Single project:

```bash
npm install https://github.com/CoverGenius/elements/releases/download/vanilla-vX.Y.Z/covergenius-elements-X.Y.Z.tgz
```

Monorepo, for one workspace package:

```bash
npm install https://github.com/CoverGenius/elements/releases/download/vanilla-vX.Y.Z/covergenius-elements-X.Y.Z.tgz --workspace <package-name>
```

{% endtab %}

{% tab title="pnpm" %}
Single project:

```bash
pnpm add https://github.com/CoverGenius/elements/releases/download/vanilla-vX.Y.Z/covergenius-elements-X.Y.Z.tgz
```

Monorepo, for one workspace package:

```bash
pnpm add https://github.com/CoverGenius/elements/releases/download/vanilla-vX.Y.Z/covergenius-elements-X.Y.Z.tgz --filter <package-name>
```

{% endtab %}

{% tab title="yarn" %}
Single project:

```bash
yarn add https://github.com/CoverGenius/elements/releases/download/vanilla-vX.Y.Z/covergenius-elements-X.Y.Z.tgz
```

Monorepo, for one workspace package:

```bash
yarn workspace <package-name> add https://github.com/CoverGenius/elements/releases/download/vanilla-vX.Y.Z/covergenius-elements-X.Y.Z.tgz
```

{% endtab %}
{% endtabs %}

The command adds the dependency to the package that you name, not to the root of the monorepo.

The release URL pins the exact version. Do not change it to a range during alpha.
{% endstep %}
{% endstepper %}

### Verify the download

This check is optional. It shows that the tarball is the file that Cover Genius published. The package manager does not do this check on the first install.

1. Download the tarball and `SHA256SUMS` from the same release.
2. Compare the hash of the tarball with the line in `SHA256SUMS`.

```bash
curl -LO https://github.com/CoverGenius/elements/releases/download/vanilla-vX.Y.Z/covergenius-elements-X.Y.Z.tgz
curl -LO https://github.com/CoverGenius/elements/releases/download/vanilla-vX.Y.Z/SHA256SUMS
shasum -a 256 -c SHA256SUMS
```

These commands work on macOS and Linux. On Windows, compare the SHA-256 hash of the file with the line in `SHA256SUMS` with your own tool.

The output must read `covergenius-elements-X.Y.Z.tgz: OK`. Do not install the package if the check fails. Tell your Cover Genius contact.

### Import

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

```js
import { registerElements, getElement } from '@covergenius/elements';
```

{% endtab %}

{% tab title="CommonJS" %}

```js
const { registerElements, getElement } = require('@covergenius/elements');
```

{% endtab %}
{% endtabs %}

### TypeScript

The package includes types. Both `import` and `require` get full types. This includes projects that use `node16` or `nodenext` module resolution.

### Loading styles

The SDK injects its panel styles into the shadow root. You do not import a stylesheet for the panel.

To show a loading animation before the SDK starts, import the optional loader stylesheet. See Loading State.


---

# 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://partner-docs.covergenius.com/elements/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.
