API
Options
Options for the whole app, and functions.
Setting them
export default defineNuxtConfig({
modules: ['boneprint/nuxt'],
boneprint: {
reveal: 'sequence',
},
})
import { boneprint } from 'boneprint'
app.use(boneprint, { reveal: 'sequence' })
| Option | Default | Purpose |
|---|---|---|
persist | true | remember shapes between visits |
debug | false | outline every skeleton and report whether the page moved, see Debugging |
reveal | fade | how content replaces the skeleton: fade, sequence or sweep |
persist and reveal can also be set on one skeleton as props.
forgetSkeletons()
Clears the remembered shapes. Whatever is on screen won't be written back, even as it unmounts. Call it on sign-out.
forgetSkeletons()
Auto-imported in Nuxt. In Vue, import { forgetSkeletons } from 'boneprint', or add it to auto-imports as shown in Vue + Vite.
useInSkeleton()
true inside the copy of the slot a skeleton is measured from, false everywhere else. Use it to keep a component in the slot from fetching or observing twice, see Side effects in the slot.
const inSkeleton = useInSkeleton()
Auto-imported in Nuxt. In Vue, import { useInSkeleton } from 'boneprint'.
Entry points
| Import | For |
|---|---|
boneprint/nuxt | the Nuxt module |
boneprint | Vue: the components, forgetSkeletons, useInSkeleton and the boneprint plugin |
boneprint/resolver | boneprintResolver() for unplugin-vue-components |