An open API service indexing awesome lists of open source software.

https://github.com/wobsoriano/vue-driver

Drive the user's focus across the page.
https://github.com/wobsoriano/vue-driver

driver vue

Last synced: 6 months ago
JSON representation

Drive the user's focus across the page.

Awesome Lists containing this project

README

          

# vue-driver

Drive the user's focus across the page with Vue and [Driver.js](https://driverjs.com).

## Install

```bash
npm install vue3-driver
```

## Usage

Install the plugin

```js
import { VueDriver } from 'vue3-driver'
import 'driver.js/dist/driver.css'

const app = createApp(App)
app.use(VueDriver, {
// Driver.js options
// https://driverjs.com/docs/configuration
})
```

Use directive to add steps, and composable to start driving

```vue

import { useDriver } from 'vue3-driver'

const driver = useDriver()

onMount(() => {
driver.drive()
})


Welcome to My Website



Some content...


2023 My Website. All rights reserved.

```

### Indexing

By default, the steps run from top to bottom depending on the directive placements. If you want to customize the arrangement, you can add an `index` property to the directive value, or via modifiers:

```vue



```

### Highlight

You can pass a `ref` when you want to highlight an element as well:

```ts
import { onMount, ref } from 'vue'
import { useDriver } from 'vue3-driver'

const driver = useDriver()
const element = ref(null)

onMount(() => {
driver.highlight({
element,
popover: {}
})
})
```

## License

MIT