Skip to content

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";

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, threshold and when. See Options.
  • Other attributes: the component gives them to the rendered element, for example class and id.
  • reveal event: the component emits it with the element when the reveal starts. See Run code when the reveal starts.
  • revealed slot prop: true after the reveal. See Read the revealed state.

Vue does not change an absent when to false.

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.

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, except as. It also accepts onReveal. 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.

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.

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.