Installation
Add the CG Elements SDK to your project.
Package
Package name
@covergenius/elements
Module formats
ESM and CommonJS
Types
Included (.d.ts for ESM, .d.cts for CommonJS)
Licence
Apache-2.0
Dependencies
None. The SDK does not need React, Vue, or any other framework.
Install
Choose a version
Open the releases page. 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.
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.
Single project:
npm install https://github.com/CoverGenius/elements/releases/download/vanilla-vX.Y.Z/covergenius-elements-X.Y.Z.tgzMonorepo, for one workspace package:
npm install https://github.com/CoverGenius/elements/releases/download/vanilla-vX.Y.Z/covergenius-elements-X.Y.Z.tgz --workspace <package-name>Single project:
pnpm add https://github.com/CoverGenius/elements/releases/download/vanilla-vX.Y.Z/covergenius-elements-X.Y.Z.tgzMonorepo, for one workspace package:
pnpm add https://github.com/CoverGenius/elements/releases/download/vanilla-vX.Y.Z/covergenius-elements-X.Y.Z.tgz --filter <package-name>Single project:
yarn add https://github.com/CoverGenius/elements/releases/download/vanilla-vX.Y.Z/covergenius-elements-X.Y.Z.tgzMonorepo, for one workspace package:
yarn workspace <package-name> add https://github.com/CoverGenius/elements/releases/download/vanilla-vX.Y.Z/covergenius-elements-X.Y.Z.tgzThe 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.
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.
Download the tarball and
SHA256SUMSfrom the same release.Compare the hash of the tarball with the line in
SHA256SUMS.
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 SHA256SUMSThese 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
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.
Last updated
Was this helpful?

