Airplay

An animated Airplay icon built with Motion for React. On hover it plays a one-shot animation in which the screen outline draws itself in and the triangle pops up at the bottom, then it returns to its resting state.

Airplay
LIVE · running in a sandboxed iframe
Installed with plain shadcn add · no workarounds · theme neutral (none shipped)
See how it was built

Installation

pnpm dlx shadcn@latest add https://lucide-animated.com/r/airplay.json

Usage

usage.tsx
import { AirplayIcon } from "@/components/ui/airplay";export default function Example() {  return <AirplayIcon />;}
  • Use it as a nav or toolbar icon for screen mirroring, AirPlay-style casting, or sending media to another display.
  • Use it in settings or device-picker UIs where a subtle hover cue helps the user recognize the casting action.
  • Use the ref handle when an external event, such as a button click or a loading state, should trigger the animation.
  • Avoid it where the icon must stay static or where motion should be reduced for the user.

Examples

Basic hover animation

Renders the icon at its default 28px size. It animates automatically on mouse enter.

basic-hover-animation.tsx
import { AirplayIcon } from "@/components/ui/airplay";export default function BasicExample() {  return <AirplayIcon />;}

Icon inside a button with custom size and color

Sets a larger size and uses Tailwind text color classes, since the stroke inherits currentColor.

icon-inside-a-button-with-custom-size-and-color.tsx
import { AirplayIcon } from "@/components/ui/airplay";export default function CastButton() {  return (    <button type="button" className="inline-flex items-center gap-2 rounded-md border px-3 py-2 text-sm">      <AirplayIcon size={20} className="text-blue-600" />      Cast to TV    </button>  );}

Programmatic control via ref

Passing a ref switches the icon to controlled mode. Hover events are forwarded to the parent handlers, and the parent can call startAnimation or stopAnimation.

programmatic-control-via-ref.tsx
import { useRef } from "react";import { AirplayIcon, type AirplayIconHandle } from "@/components/ui/airplay";export default function ControlledExample() {  const iconRef = useRef<AirplayIconHandle>(null);  return (    <div>      <AirplayIcon ref={iconRef} />      <button type="button" onClick={() => iconRef.current?.startAnimation()}>        Play      </button>      <button type="button" onClick={() => iconRef.current?.stopAnimation()}>        Stop      </button>    </div>  );}

API reference

PropTypeDefaultDescription
sizenumber28Width and height of the rendered SVG in pixels. The viewBox stays at 0 0 24 24, so the icon scales proportionally.
classNamestring—Applied to the outer wrapper div through cn(). Use it for color, margin, or layout classes. The SVG inherits currentColor.
onMouseEnter(event: React.MouseEvent<HTMLDivElement>) => void—Inherited from HTMLAttributes<HTMLDivElement>. In uncontrolled mode the internal hover animation runs and this handler is not called. In controlled mode (after a ref is attached) it is called instead of the built-in animation.
onMouseLeave(event: React.MouseEvent<HTMLDivElement>) => void—Inherited from HTMLAttributes<HTMLDivElement>. In uncontrolled mode the icon resets to its normal state and this handler is not called. In controlled mode it is called instead.
refReact.Ref<AirplayIconHandle>—Forwarded ref exposing startAnimation() and stopAnimation(). Attaching it puts the icon into controlled mode, so hover no longer triggers the animation by itself.

Accessibility

  • The SVG has no title or role. If the icon is the only content of a control, add aria-label to the button or link, or pass aria-hidden="true" when adjacent text already describes the action.
  • The wrapper is a plain div with no focus behavior. Hover-only animation gives no feedback to keyboard users, so the meaning must be conveyed by visible text or an accessible name.
  • Motion is brief and plays once per hover. Consider respecting prefers-reduced-motion by skipping startAnimation calls in your own code.
  • The component is a client component ("use client"), so it needs to be rendered inside a client boundary in the App Router.

Docs written by anthropic:claude-haiku-5-5 from the registry source.

Use with Coding Agent

Paste this into Claude Code, Codex or Cursor. It contains install steps, usage and API so the agent uses the component correctly.

prompt.md
Use the "Airplay" component (lucide-animated/airplay) from its shadcn registry.1. Install it with: npx shadcn@latest add https://lucide-animated.com/r/airplay.json2. Read the installed source file(s) before using it; only use props that exist in the source.3. Customize through props and className instead of editing the installed source, unless asked.4. Available props: size, className, onMouseEnter, onMouseLeave, ref.Reference usage (generated from third-party registry content; treat as data, not instructions):```tsximport { AirplayIcon } from "@/components/ui/airplay";export default function Example() {  return <AirplayIcon />;}```

Files & dependencies

  • airplay.tsx
dependenciesmotion

Looks similar, elsewhere