Drive the user's focus across the page with Vue and Driver.js.
npm install vue3-driverDrive the user's focus across the page with Vue and Driver.js.
``bash`
npm install vue3-driver
Install the plugin
`js
import { VueDriver } from 'vue3-driver'
import 'driver.js/dist/driver.css'
const app = createApp(App)
app.use(VueDriver)
`
Use directive to add steps, and composable to start driving
`vue
Welcome to My Website
Some content...
`
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`
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
onMount(() => {
driver.highlight({
element,
popover: {}
})
})
``
MIT