driver.js / docs /src /content /guides /installation.mdx
kamrify's picture
Fix type definitions not found
acbae00
raw
history blame
1.37 kB
---
title: "Installation"
groupTitle: "Introduction"
sort: 1
---
import { SimpleHighlight } from "../../components/examples/SimpleHighlight.js";
Run one of the following commands to install the package:
```bash
# Using npm
npm install driver.js
# Using pnpm
pnpm install driver.js
# Using yarn
yarn add driver.js
```
Alternatively, you can use CDN and include the script in your HTML file:
```html
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/driver.js.iife.js"></script>
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/[email protected]/dist/style.css"/>
```
## Start Using
Once installed, you can import the package in your project. The following example shows how to highlight an element:
```js
import Driver from "driver.js";
import "driver.js/dist/driver.css";
const driver = new Driver();
driver.highlight({
element: "#some-element",
popover: {
title: "Title",
description: "Description"
}
});
```
### Note on CDN
If you are using the CDN, you will have to use the package from the `window` object:
```js
const Driver = window.driver.js.driver;
const driver = new Driver();
driver.highlight({
element: "#some-element",
popover: {
title: "Title",
description: "Description"
}
});
```
Continue reading the [Getting Started](/docs/basic-usage) guide to learn more about the package.