Reveal Card

Mousemove effect to reveal text content at the bottom of the card.

Table of contents

  • This example isn't available at your current screen size. Please try again on a larger screen.
PR

Installation

To install, just include the following JavaScript somewhere on your page:

<!-- Load the core file first -->
<script
src="https://cdn.jsdelivr.net/npm/[email protected]/dist/js/ft-core.iife.js"
></script>
<!-- Load the component -->
<script
src="https://cdn.jsdelivr.net/npm/[email protected]/dist/js/ft/text-reveal-card.iife.js"
></script>

Important notes

  • Make sure your project is using either Frankenstyle or FrankenstyleKit.
  • The order of JavaScript loading is important. The ft-core.iife.js file must be loaded before any other components.
  • When using multiple Frankternity components, the core file only needs to be loaded once.

CSS variables

All CSS variables prefixed with --ft-* can be used to customize layout, spacing, colors, and sizing of this component.

Container

VariableDefaultDescription
--ft-width40remWidth of the card container.
--ft-border-width1pxBorder thickness of the card.
--ft-border-colorvar(--color-white)Border color of the card.
--ft-border-opacity0.08Opacity applied to the card border color.
--ft-background#1d1c20Background color of the card container.
--ft-padding8Inner padding of the card container.

Text sizing and spacing

VariableDefaultDescription
--ft-font-size1remBase font size for both primary and revealed text.
--ft-font-size-sm3remFont size used at the small breakpoint and above.
--ft-vertical-padding10Vertical padding applied to text blocks.

Primary text (base layer)

VariableDefaultDescription
--ft-alt-background#323238Background color behind the base (non-revealed) text.
--ft-text-colortransparentText color of the base text layer.

Reveal text (hover layer)

VariableDefaultDescription
--ft-reveal-background#1d1c20Background color behind the revealed text.
--ft-reveal-colorvar(--color-white)Text color of the revealed text layer.
--ft-reveal-fromvar(--color-white)Gradient start color for revealed text.
--ft-reveal-tovar(--color-neutral-300)Gradient end color for revealed text.

Highlight divider

VariableDefaultDescription
--ft-highlight-viavar(--color-neutral-800)Middle color of the vertical highlight line gradient.

Stars effect

VariableDefaultDescription
--ft-star-colorwhiteColor of the animated star particles in the background.

Props

To pass props, include them as JSON inside a <script> tag with the data-fn="props" attribute.

Note The data-ft-* attribute determines which Frankternity component is mounted and should be replaced with the component name.

Prop nameTypeDescription
classNamestringThe class name of the TextReveal component.
stlobjectAdditional inline styles for the TextReveal component.
textstringPiece of text that stays on the card.
revealTextstringText that reveals when hovered over the card.