Vue reveal API: components and directives
@awesome-reveal/vue exports two components and two directives. They take the same options, as props or as an object. For the supported versions, see Requirements.
import { Cascade, Reveal, vCascade, vReveal } from "@awesome-reveal/vue";Reveal
Section titled “Reveal”Renders an element around its default slot, and reveals the element when it enters the viewport.
<Reveal as="section" from="left" class="hero">Hello</Reveal>- Props:
as,from,keyframes,duration,delay,thresholdandwhen. See Options. - Other attributes: the component gives them to the rendered element, for example
classandid. revealevent: the component emits it with the element when the reveal starts. See Run code when the reveal starts.revealedslot prop:trueafter the reveal. See Read the revealed state.
Vue does not change an absent when to false.
Cascade
Section titled “Cascade”Renders an element around its default slot. When the element enters the viewport, it reveals the direct element children one after the other. See Animate a list.
Cascade accepts the props of Reveal, and interval. It has the same event and slot prop.
v-reveal
Section titled “v-reveal”Reveals the element that has the directive.
<article v-reveal="{ from: 'left', onReveal: entered }">A card</article>- Value: an object with the options of
Reveal, exceptas. It also acceptsonReveal. With no value, the directive uses the default options. - Updates: the directive watches the object deeply, so it also sees a change to a nested value. For the time when a change applies, see Change the timing.
- Server rendering: the directive renders the element hidden in the server HTML. See Vue SSR and Nuxt.
v-cascade
Section titled “v-cascade”Reveals the direct element children of the element that has the directive. It accepts the options of v-reveal, and interval.
To use the directives with no import, register them globally. See Vue SSR and Nuxt.
Stylesheet
Section titled “Stylesheet”The package imports its stylesheet. It also exports the stylesheet as @awesome-reveal/vue/reveal.css, for the setups that need an import.
| Type | Description |
|---|---|
RevealProps |
The props of Reveal. |
CascadeProps |
The props of Cascade. |
RevealOptions |
The value of v-reveal. |
CascadeOptions |
The value of v-cascade. |
Side |
The sides of from. |
StartState |
The start state object of from. |