Ir al contenido
Español
Tarjeta holográfica viene con Pro. La vista previa aparece al desbloquearlo.

Cómo funciona

Unlike tilt-card, which tips any content and lays a white glare spot over it, this card is a material: a pearl ticket face with a foil that has colour. The foil is an oversized repeating rainbow seen through a film of fine overlapping scales, printed under the face so text keeps its contrast; the pointer slides it by up to a sixth of its size, so the colour bands travel across the face and the scales glitter, while a white glint band slides the opposite way. It blends with the pearl beneath it: multiply in the light theme (pastel colour), screen in the dark theme (the colours glow). The card tilts by up to maxTilt degrees, follows the pointer within 100ms and settles flat on an 800ms spring. Notches and a dotted tear line make the stub, and a drop-shadow follows the cut outline. Only transforms and opacity change while it moves.

Úsalo para

  • A booking confirmation, boarding pass or event ticket, where the moment deserves a little ceremony.
  • Membership, loyalty or gift cards shown on an account page.
  • A collectible or reward that should feel special.

Busca otra opción cuando

  • Ordinary content cards in a list: use a plain card, or tilt-card for a lighter touch.
  • Text-heavy cards: the foil lowers contrast where it is strongest.
  • Several foil cards side by side: one shines, many become noise.

Uso

import { HoloFoilCard } from './HoloFoilCard.jsx'

export function BoardingPass({ booking }) {
  return (
    <HoloFoilCard stub="right" stubSize={0.3} foil="spectrum" deviceTilt style={{ width: 360 }}>
      <div className="pass">
        <div className="pass__main">
          <small>{booking.route}</small>
          <h3>{booking.title}</h3>
          <p>{booking.when}</p>
        </div>
        <div className="pass__stub">{booking.seat}</div>
      </div>
    </HoloFoilCard>
  )
}

Propiedades

PropiedadTipoPor defectoQué hace
childrenReactNode—The face of the card: your ticket, pass or membership layout. The foil lies over it.
stub'right' | 'bottom' | 'none''right'Where the tear-off stub is: notches and a dotted tear line across the card, or a plain card.
stubSizenumber0.28The stub's share of the width (right) or height (bottom), 0.1 to 0.6.
foil'spectrum' | 'brand' | 'pearl''spectrum'The foil colours: the full rainbow, the palette's accent, secondary and tertiary, or a soft pearl.
intensitynumber0.7Foil strength from 0 to 1. At rest it shows at about 60% of this.
maxTiltnumber10Largest tilt in degrees, reached at the card's edges.
shine'once' | 'none''once'Whether the foil sweeps across once when the card first comes into view, for confirmation moments.
deviceTiltbooleanfalseFollows the phone's tilt. On iOS the first tap on the card asks for motion access.
...restHTMLAttributes—Other attributes go to the root element; set the width through style or a class.

Accesibilidad

  • The card is a plain container; put links or buttons inside it as usual. The foil, glint and tear line are aria-hidden.
  • When something inside has keyboard focus the card levels out, so text and focus rings stay readable.
  • On touch the card tilts while a finger moves across it; vertical scrolling still works (touch-action: pan-y) and settles it.
  • deviceTilt only reads orientation; on iOS the permission prompt appears after a tap on the card, never on load.
  • Keep body text on the card at least 13px with strong contrast; set intensity lower for dense content.
  • Reduced motion removes tilt, the sweep and the glint; the foil stays at its resting position, so the card still looks holographic.

Movimiento

Enter: eases to the pointer in 260ms. Track: 100ms. Leave: 800ms spring with a slight overshoot back to flat; the foil glides home in 900ms ease-out. Foil opacity rises from 60% to 100% of intensity while moving. First view: the foil slides in from one side and a glint crosses, 1500ms ease-in-out after 150ms.

Añádelo a tu proyecto

Los miembros Pro copian un prompt y su agente de programación instala el código, igual que con los gratuitos.

HoloFoilCard.jsxholo-foil-card.csstokens.cssREADME.md

Los dos archivos se instalan juntos. La hoja de estilos lee las variables de tokens.css y lleva valores de reserva, así que también funciona sola.

Tarjetas
Tarjeta con borde animado viene con Pro. La vista previa aparece al desbloquearlo.
Borde con haz de luz viene con Pro. La vista previa aparece al desbloquearlo.
Tarjeta con hoja de datos viene con Pro. La vista previa aparece al desbloquearlo.