Skip to content

Now Playing

A word that dances, turns green and puffs music notes while a track plays — hover it for a card with a spinning record.

2 variantsNew

Preview

Installation

Copies the component into components/ui and installs its dependencies and theme tokens.

pnpm dlx shadcn@latest https://floret.shippedui.com/r/now-playing.json

Usage

Pass your own data and wire the callbacks to your app.

import { NowPlaying } from "@/components/ui/now-playing/now-playing";

// Feed it from your own endpoint (e.g. Spotify's currently-playing API),
// polled every few seconds.
const track = {
  title: "Midnight Drive",
  artist: "Neon Harbor",
  albumImage: "https://…/cover.jpg",
  songUrl: "https://open.spotify.com/track/…",
  isPlaying: true,
  playedAt: null,
};

<p>
  Beyond work, I like to listen to <NowPlaying track={track} />
</p>

Props

PropTypeDefaultDescription
trackNowPlayingTrack | null—The current or most recent track. While it's missing, the word shows without a card.
childrenReactNode | ({ isPlaying }) => ReactNodethe dancing word “music.”What sits in the sentence. Pass a function to react to playback.
openboolean—Keeps the card open. By default it opens on hover and keyboard focus.
classNamestring—Merged onto the wrapper; it is 3rem wide by default.
export type NowPlayingTrack = {
  title: string;
  artist: string;
  albumImage: string;
  songUrl?: string; // leave out for a plain-text title
  isPlaying: boolean;
  playedAt?: string | null; // ISO time, for "Last played 5 minutes ago"
};

// Also exported from ./dancing-text:
<DancingText text="music" fontSize={14} minWeight={100} maxWeight={600} isPlaying />