本文へ移動
日本語
「ホログラムカード」は Pro に含まれます。解除するとプレビューが表示されます。

仕組み

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.

向いている場面

  • 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.

向かない場面

  • 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.

使い方

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>
  )
}

プロパティ

プロパティ型既定値説明
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.

アクセシビリティ

  • 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.

モーション

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.

プロジェクトに追加

Pro メンバーはプロンプトをコピーし、コーディングエージェントが無料コンポーネントと同じ手順でソースを導入します。

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

2 つのファイルを一緒に導入します。スタイルは tokens.css の変数を読み、予備の値も持つため、単体でも表示できます。

カード
「動く枠線カード」は Pro に含まれます。解除するとプレビューが表示されます。
「ビームボーダー」は Pro に含まれます。解除するとプレビューが表示されます。
「カード詳細とロック」は Pro に含まれます。解除するとプレビューが表示されます。