本文へ移動
日本語
「シマーボタン」は Pro に含まれます。解除するとプレビューが表示されます。

仕組み

The rim is a 1px transparent border that shows a conic gradient beneath the solid body. A registered angle property turns that gradient, so a single point of light, warm-tinted at its tail, travels around the pill without any oversized spinning element. A blurred copy of the same light glows just outside, and a radial light pools inside along the bottom edge. Hover lifts the button by 1px, brightens the pool and halo and nudges the arrow; pressing settles it to 97.5%.

向いている場面

  • The single most important action of a landing page or hero, such as starting a trial.
  • An upgrade or launch moment that deserves a little ceremony.

向かない場面

  • More than one per screen: the motion stops meaning anything.
  • Routine actions in forms or dense interfaces: use a plain button.

使い方

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

export function Hero() {
  return (
    <ShimmerButton size="lg" tone="ink" speed={3.2} href="/signup">
      Start free trial
    </ShimmerButton>
  )
}

プロパティ

プロパティ型既定値説明
childrenReactNode—The label.
hrefstring—Renders a link instead of a button.
tone'ink' | 'accent' | 'teal''ink'Body colour and light tint.
size'sm' | 'md' | 'lg''md'Height 36, 44 or 52px.
speednumber3.2Seconds per lap of the light (minimum 0.8).
glowbooleantrueShows the blurred halo outside the rim.
iconReactNode—Replaces the trailing arrow; trailing={false} removes it.
disabledbooleanfalseDisables it and stops the light.

アクセシビリティ

  • A native button, or a link when href is given; Enter and Space work as usual, and a disabled link gets aria-disabled.
  • The arrow is decorative and hidden from screen readers; the label is the accessible name.
  • Focus-visible shows a solid 2px ring outside a gap in the surface colour, clear on both themes.
  • White text on the dark or accent body stays above 4.5:1; forced-colors mode shows a plain bordered button.
  • Reduced motion parks the light at the top-right corner and removes the lift, press scale and arrow nudge.

モーション

The light laps the rim linearly every 3.2s (adjustable), which reads as a steady orbit rather than a pulse. Hover eases in over 240ms (ease-out); the arrow nudges 3px with a spring; pressing scales to 97.5% in 100ms.

プロジェクトに追加

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

ShimmerButton.jsxshimmer-button.csstokens.cssREADME.md

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

ボタン
「オーロラ縁ボタン」は Pro に含まれます。解除するとプレビューが表示されます。
「かじりボタン」は Pro に含まれます。解除するとプレビューが表示されます。