# Music player card

> A compact now-playing card with a slowly turning cover and controls that bounce when you press them.

- Category: [Cards](https://library.aimran.es/components/cards)
- Built with: HTML + CSS
- Live editor: https://library.aimran.es/blocks/uv-card-player
- Library: AIMRAN Library (https://library.aimran.es), free, no sign-up, by Aimran Oukham

## Where to use it

Good for anywhere music or audio is part of the story: the latest single on an indie band's site, a featured episode on a podcast landing page, a relaxing track in a meditation app. Under the hood it is only HTML and CSS: a music player card with a gradient cover you tint with your own colors.

It does not play sound by itself: hook the buttons up to an audio element or another player, and move the progress bar with the real time. Swap the abstract cover for real artwork, and keep the title short enough for one line.

## Code

### HTML

```html
<article class="uv-cplay"><div class="cover"><i></i><b>◌</b></div><small>REPRODUCIENDO</small><h3>Soft Motion</h3><p>Nara Fields</p><div class="line"><i></i></div><footer><button>‹</button><button class="play">▶</button><button>›</button></footer></article>
```

### CSS

```css
.uv-cplay {
  --c1: #0071e3;
  --c2: #8ec5ff;
  --s: 16px;
  /* tamaño */
  --k: 1;
  /* velocidad */
  --fg: #1d1d1f;
  /* texto */
  --bg: #f5f5f7;
  /* fondo */
}

.uv-cplay {
  font-family: -apple-system,BlinkMacSystemFont,"SF Pro Text","Inter",system-ui,sans-serif;
  width: 16em;
  padding: 1.2em;
  border-radius: 1.5em;
  font-size: var(--s);
  color: var(--fg);
  background: var(--bg);
  box-shadow: inset 0 0 0 1px color-mix(in srgb,var(--fg) 8%,transparent),0 28px 70px -40px var(--c1);
  text-align: center;
}

.uv-cplay .cover {
  position: relative;
  height: 11em;
  border-radius: 1.1em;
  overflow: hidden;
  background: conic-gradient(from 30deg,var(--c1),var(--c2),color-mix(in srgb,var(--c1) 30%,#000),var(--c1));
}

.uv-cplay .cover i {
  position: absolute;
  inset: 16%;
  border-radius: 45% 55% 60% 40%;
  border: 1px solid rgba(255,255,255,.45);
  animation: uv-cplay-r calc(8s / var(--k)) linear infinite;
}

.uv-cplay .cover b {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  font-size: 3em;
  color: #fff;
}

.uv-cplay small {
  display: block;
  margin-top: 1.1em;
  font-size: .58em;
  color: var(--c1);
}

.uv-cplay h3 {
  margin: .25em 0;
  font-size: 1.12em;
}

.uv-cplay p {
  margin: 0;
  font-size: .75em;
  opacity: .5;
}

.uv-cplay .line {
  height: .25em;
  margin: 1em 0;
  border-radius: 1em;
  background: color-mix(in srgb,var(--fg) 10%,transparent);
}

.uv-cplay .line i {
  display: block;
  width: 42%;
  height: 100%;
  border-radius: inherit;
  background: var(--c1);
}

.uv-cplay footer {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 1em;
}

.uv-cplay button {
  width: 2.2em;
  height: 2.2em;
  border: 0;
  border-radius: 50%;
  font: inherit;
  color: var(--fg);
  background: transparent;
  cursor: pointer;
  transition: transform calc(0.3s / var(--k)) cubic-bezier(.34,1.56,.64,1);
}

.uv-cplay .play {
  color: #fff;
  background: var(--c1);
}

.uv-cplay button:hover {
  transform: scale(1.14);
}

.uv-cplay button:active {
  transform: scale(.88);
}

@keyframes uv-cplay-r {
  to {
    transform: rotate(360deg);
  }
}
```

### React

```tsx
import type { CSSProperties } from "react";

const css = `
.uv-cplay {
  font-family: -apple-system,BlinkMacSystemFont,"SF Pro Text","Inter",system-ui,sans-serif;
  width: 16em;
  padding: 1.2em;
  border-radius: 1.5em;
  font-size: var(--s);
  color: var(--fg);
  background: var(--bg);
  box-shadow: inset 0 0 0 1px color-mix(in srgb,var(--fg) 8%,transparent),0 28px 70px -40px var(--c1);
  text-align: center;
}

.uv-cplay .cover {
  position: relative;
  height: 11em;
  border-radius: 1.1em;
  overflow: hidden;
  background: conic-gradient(from 30deg,var(--c1),var(--c2),color-mix(in srgb,var(--c1) 30%,#000),var(--c1));
}

.uv-cplay .cover i {
  position: absolute;
  inset: 16%;
  border-radius: 45% 55% 60% 40%;
  border: 1px solid rgba(255,255,255,.45);
  animation: uv-cplay-r calc(8s / var(--k)) linear infinite;
}

.uv-cplay .cover b {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  font-size: 3em;
  color: #fff;
}

.uv-cplay small {
  display: block;
  margin-top: 1.1em;
  font-size: .58em;
  color: var(--c1);
}

.uv-cplay h3 {
  margin: .25em 0;
  font-size: 1.12em;
}

.uv-cplay p {
  margin: 0;
  font-size: .75em;
  opacity: .5;
}

.uv-cplay .line {
  height: .25em;
  margin: 1em 0;
  border-radius: 1em;
  background: color-mix(in srgb,var(--fg) 10%,transparent);
}

.uv-cplay .line i {
  display: block;
  width: 42%;
  height: 100%;
  border-radius: inherit;
  background: var(--c1);
}

.uv-cplay footer {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 1em;
}

.uv-cplay button {
  width: 2.2em;
  height: 2.2em;
  border: 0;
  border-radius: 50%;
  font: inherit;
  color: var(--fg);
  background: transparent;
  cursor: pointer;
  transition: transform calc(0.3s / var(--k)) cubic-bezier(.34,1.56,.64,1);
}

.uv-cplay .play {
  color: #fff;
  background: var(--c1);
}

.uv-cplay button:hover {
  transform: scale(1.14);
}

.uv-cplay button:active {
  transform: scale(.88);
}

@keyframes uv-cplay-r {
  to {
    transform: rotate(360deg);
  }
}
`;

export default function CardPlayer() {
  return (
    <>
      <style>{css}</style>
      <div
        style={{
          "--c1": "#0071e3",
          "--c2": "#8ec5ff",
          "--s": "16px",
          "--k": "1",
          "--fg": "#1d1d1f",
          "--bg": "#f5f5f7",
        } as CSSProperties}
      >
        <article className="uv-cplay"><div className="cover"><i></i><b>◌</b></div><small>REPRODUCIENDO</small><h3>Soft Motion</h3><p>Nara Fields</p><div className="line"><i></i></div><footer><button>‹</button><button className="play">▶</button><button>›</button></footer></article>
      </div>
    </>
  );
}
```

## Prompt for AI assistants

Paste this into ChatGPT, Claude, Cursor, v0 or Lovable to adapt the block to your stack (Tailwind, Vue, Svelte…):

````text
I want to add the “Music player card” block (Cards) from AIMRAN Library to my project.

## What it is
A compact now-playing card with a slowly turning cover and controls that bounce when you press them.

## Chosen settings
- Main color: #0071e3
- Secondary color: #8ec5ff
- Size: 16px (from 12 to 24px)
- Speed: 1x (from 0.5 to 2x)
- Text: "Soft Motion"

## What I need
1. Add it to my project with the same look and animation as the reference code: same sizes, colours, radii, shadows, timings and easing.
2. It is built with plain HTML and CSS (the reference wraps it in a React component with its CSS). If my project uses something else (Vue, Svelte, Astro, plain HTML…), translate it without losing any behaviour. If I use Tailwind, turn the styles into classes; if not, keep the CSS in its own file.
3. Expose the settings above as props (or CSS variables) with those values as defaults.
4. Make it work well on phones: nothing that depends only on hover, touch targets of at least 44 px and no overflow on 320 px screens.
5. Make it look right in light and dark mode.
6. Keep it accessible: semantic HTML, roles and aria-* where needed, visible focus and keyboard support.
7. Respect prefers-reduced-motion: with reduced motion, no big animations but the same end result.

## Reference code
```tsx
import type { CSSProperties } from "react";

const css = `
.uv-cplay {
  font-family: -apple-system,BlinkMacSystemFont,"SF Pro Text","Inter",system-ui,sans-serif;
  width: 16em;
  padding: 1.2em;
  border-radius: 1.5em;
  font-size: var(--s);
  color: var(--fg);
  background: var(--bg);
  box-shadow: inset 0 0 0 1px color-mix(in srgb,var(--fg) 8%,transparent),0 28px 70px -40px var(--c1);
  text-align: center;
}

.uv-cplay .cover {
  position: relative;
  height: 11em;
  border-radius: 1.1em;
  overflow: hidden;
  background: conic-gradient(from 30deg,var(--c1),var(--c2),color-mix(in srgb,var(--c1) 30%,#000),var(--c1));
}

.uv-cplay .cover i {
  position: absolute;
  inset: 16%;
  border-radius: 45% 55% 60% 40%;
  border: 1px solid rgba(255,255,255,.45);
  animation: uv-cplay-r calc(8s / var(--k)) linear infinite;
}

.uv-cplay .cover b {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  font-size: 3em;
  color: #fff;
}

.uv-cplay small {
  display: block;
  margin-top: 1.1em;
  font-size: .58em;
  color: var(--c1);
}

.uv-cplay h3 {
  margin: .25em 0;
  font-size: 1.12em;
}

.uv-cplay p {
  margin: 0;
  font-size: .75em;
  opacity: .5;
}

.uv-cplay .line {
  height: .25em;
  margin: 1em 0;
  border-radius: 1em;
  background: color-mix(in srgb,var(--fg) 10%,transparent);
}

.uv-cplay .line i {
  display: block;
  width: 42%;
  height: 100%;
  border-radius: inherit;
  background: var(--c1);
}

.uv-cplay footer {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 1em;
}

.uv-cplay button {
  width: 2.2em;
  height: 2.2em;
  border: 0;
  border-radius: 50%;
  font: inherit;
  color: var(--fg);
  background: transparent;
  cursor: pointer;
  transition: transform calc(0.3s / var(--k)) cubic-bezier(.34,1.56,.64,1);
}

.uv-cplay .play {
  color: #fff;
  background: var(--c1);
}

.uv-cplay button:hover {
  transform: scale(1.14);
}

.uv-cplay button:active {
  transform: scale(.88);
}

@keyframes uv-cplay-r {
  to {
    transform: rotate(360deg);
  }
}
`;

export default function CardPlayer() {
  return (
    <>
      <style>{css}</style>
      <div
        style={{
          "--c1": "#0071e3",
          "--c2": "#8ec5ff",
          "--s": "16px",
          "--k": "1",
          "--fg": "#1d1d1f",
          "--bg": "#f5f5f7",
        } as CSSProperties}
      >
        <article className="uv-cplay"><div className="cover"><i></i><b>◌</b></div><small>REPRODUCIENDO</small><h3>Soft Motion</h3><p>Nara Fields</p><div className="line"><i></i></div><footer><button>‹</button><button className="play">▶</button><button>›</button></footer></article>
      </div>
    </>
  );
}
```

Give me the complete final code, ready to paste, and tell me in one line where to put it in my project.
````
