# Car radio preset keys

> The mechanical keys of an old car radio: the one you press sinks in and the previous one pops back up.

- Category: [Radio buttons](https://library.aimran.es/components/radios)
- Built with: HTML + CSS
- Live editor: https://library.aimran.es/blocks/uv-rd-preset-keys
- Library: AIMRAN Library (https://library.aimran.es), free, no sign-up, by Aimran Oukham

## Where to use it

Radio buttons got their name from these keys: on old car radios, pressing one preset pushed it in and released the others. This block recreates that on a brushed chrome faceplate, with cream plastic keys that sink when chosen, spring back with a bounce and tune an amber display to the station frequency.

Use the main color for the display and the small indicator on the pressed key, and the secondary color for the plastic. Five keys fit comfortably; rename the stations or turn them into presets for a player, a heater or a coffee machine.

## Code

### HTML

```html
<fieldset class="uvq04-pst"><legend>Presets</legend><div class="fp"><div class="ds" aria-hidden="true"><span class="fq"></span><span class="st">ST</span></div><div class="ks"><label><input type="radio" name="uvq04-pst"><span class="ky"><b>1</b></span><span class="nm">Classical</span></label><label><input type="radio" name="uvq04-pst"><span class="ky"><b>2</b></span><span class="nm">News</span></label><label><input type="radio" name="uvq04-pst" checked><span class="ky"><b>3</b></span><span class="nm">Jazz</span></label><label><input type="radio" name="uvq04-pst"><span class="ky"><b>4</b></span><span class="nm">Pop</span></label><label><input type="radio" name="uvq04-pst"><span class="ky"><b>5</b></span><span class="nm">Sports</span></label></div></div></fieldset>
```

### CSS

```css
.uvq04-pst {
  --c1: #ff7a1a;
  --c2: #ece4d0;
  --s: 16px;
  /* tamaño */
  --k: 1;
  /* velocidad */
  --fg: #1d1d1f;
  /* texto */
  --bg: #f5f5f7;
  /* fondo */
}

.uvq04-pst {
  font-family: -apple-system,BlinkMacSystemFont,"SF Pro Text","Inter",system-ui,sans-serif;
  font-size: var(--s);
  color: var(--fg);
  -webkit-tap-highlight-color: transparent;
  border: 0;
  margin: 0;
  padding: 0;
  min-width: 0;
}

.uvq04-pst legend {
  padding: 0;
  margin: 0 0 .8em;
  font-weight: 700;
}

.uvq04-pst .fp {
  width: 20em;
  padding: .9em .9em 1em;
  border-radius: .9em;
  background: repeating-linear-gradient(90deg,rgba(255,255,255,.08) 0 1px,transparent 1px 3px),linear-gradient(#d3d6da,#9196a0 55%,#c1c5cb);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.8),inset 0 -1px 0 rgba(0,0,0,.25),0 1em 2em -1em rgba(0,0,0,.55);
}

.uvq04-pst .ds {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: .45em .8em;
  margin-bottom: .9em;
  border-radius: .4em;
  background: radial-gradient(120% 140% at 50% 0,#2a1608,#120904 70%);
  box-shadow: inset 0 .2em .5em rgba(0,0,0,.8),0 1px 0 rgba(255,255,255,.6);
  font-family: ui-monospace,"SF Mono",Menlo,Consolas,monospace;
  color: var(--c1);
}

.uvq04-pst .fq {
  font-size: 1.35em;
  font-weight: 700;
  letter-spacing: .04em;
  text-shadow: 0 0 .4em var(--c1);
}

.uvq04-pst .fq::before {
  content: "FM ";
  font-size: .55em;
  opacity: .7;
}

.uvq04-pst .fq::after {
  content: var(--f,"98.3");
}

.uvq04-pst .st {
  padding: .1em .4em;
  border: 1px solid currentColor;
  border-radius: .3em;
  font-size: .6em;
  font-weight: 700;
  opacity: .8;
}

.uvq04-pst .ks {
  display: grid;
  grid-template-columns: repeat(5,1fr);
  gap: .45em;
}

.uvq04-pst label {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: .65em;
  cursor: pointer;
}

.uvq04-pst input {
  position: absolute;
  opacity: 0;
  width: 1px;
  height: 1px;
  margin: 0;
  pointer-events: none;
}

.uvq04-pst .ky {
  position: relative;
  display: grid;
  place-items: center;
  width: 100%;
  height: 2.3em;
  border-radius: .35em .35em .5em .5em;
  background: linear-gradient(color-mix(in srgb,var(--c2),#fff 35%),var(--c2));
  box-shadow: 0 .42em 0 color-mix(in srgb,var(--c2),#000 40%),0 .6em .7em -.1em rgba(0,0,0,.45),inset 0 1px 0 rgba(255,255,255,.8);
  transition: transform calc(0.35s / var(--k)) cubic-bezier(.34,1.56,.64,1),box-shadow calc(0.35s / var(--k)) cubic-bezier(.34,1.56,.64,1),background calc(0.3s / var(--k)) cubic-bezier(.25,.1,.25,1);
}

.uvq04-pst .ky b {
  font-size: 1em;
  font-weight: 800;
  color: #3b3530;
}

.uvq04-pst .ky::after {
  content: "";
  position: absolute;
  top: .3em;
  left: 50%;
  width: 1.1em;
  height: .16em;
  margin-left: -.55em;
  border-radius: 1em;
  background: color-mix(in srgb,var(--c2),#000 25%);
  transition: background calc(0.3s / var(--k)) cubic-bezier(.25,.1,.25,1),box-shadow calc(0.3s / var(--k)) cubic-bezier(.25,.1,.25,1);
}

.uvq04-pst .nm {
  font-size: .55em;
  font-weight: 800;
  letter-spacing: .04em;
  text-transform: uppercase;
  white-space: nowrap;
  color: #2d2f33;
}

.uvq04-pst label:hover .ky {
  transform: translateY(.08em);
}

.uvq04-pst label:active .ky {
  transform: translateY(.3em);
  box-shadow: 0 .12em 0 color-mix(in srgb,var(--c2),#000 40%),0 .2em .3em rgba(0,0,0,.4),inset 0 1px 0 rgba(255,255,255,.6);
}

.uvq04-pst input:checked + .ky {
  transform: translateY(.36em);
  background: linear-gradient(var(--c2),color-mix(in srgb,var(--c2),#000 10%));
  box-shadow: 0 .06em 0 color-mix(in srgb,var(--c2),#000 40%),0 .1em .2em rgba(0,0,0,.4),inset 0 .2em .4em rgba(0,0,0,.18);
}

.uvq04-pst input:checked + .ky::after {
  background: var(--c1);
  box-shadow: 0 0 .4em var(--c1);
}

.uvq04-pst input:checked ~ .nm {
  color: color-mix(in srgb,var(--c1),#000 35%);
}

.uvq04-pst input:focus-visible + .ky {
  outline: 2px solid var(--c1);
  outline-offset: 3px;
}

.uvq04-pst:has(label:nth-of-type(1) input:checked) .fq {
  --f: "89.6";
}

.uvq04-pst:has(label:nth-of-type(2) input:checked) .fq {
  --f: "94.0";
}

.uvq04-pst:has(label:nth-of-type(3) input:checked) .fq {
  --f: "98.3";
}

.uvq04-pst:has(label:nth-of-type(4) input:checked) .fq {
  --f: "102.7";
}

.uvq04-pst:has(label:nth-of-type(5) input:checked) .fq {
  --f: "106.1";
}

@media (prefers-reduced-motion:reduce) {
  .uvq04-pst,.uvq04-pst *,.uvq04-pst *::before,.uvq04-pst *::after {
    animation-duration: .01ms!important;
    animation-iteration-count: 1!important;
    transition-duration: .01ms!important;
  }
}
```

### React

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

const css = `
.uvq04-pst {
  font-family: -apple-system,BlinkMacSystemFont,"SF Pro Text","Inter",system-ui,sans-serif;
  font-size: var(--s);
  color: var(--fg);
  -webkit-tap-highlight-color: transparent;
  border: 0;
  margin: 0;
  padding: 0;
  min-width: 0;
}

.uvq04-pst legend {
  padding: 0;
  margin: 0 0 .8em;
  font-weight: 700;
}

.uvq04-pst .fp {
  width: 20em;
  padding: .9em .9em 1em;
  border-radius: .9em;
  background: repeating-linear-gradient(90deg,rgba(255,255,255,.08) 0 1px,transparent 1px 3px),linear-gradient(#d3d6da,#9196a0 55%,#c1c5cb);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.8),inset 0 -1px 0 rgba(0,0,0,.25),0 1em 2em -1em rgba(0,0,0,.55);
}

.uvq04-pst .ds {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: .45em .8em;
  margin-bottom: .9em;
  border-radius: .4em;
  background: radial-gradient(120% 140% at 50% 0,#2a1608,#120904 70%);
  box-shadow: inset 0 .2em .5em rgba(0,0,0,.8),0 1px 0 rgba(255,255,255,.6);
  font-family: ui-monospace,"SF Mono",Menlo,Consolas,monospace;
  color: var(--c1);
}

.uvq04-pst .fq {
  font-size: 1.35em;
  font-weight: 700;
  letter-spacing: .04em;
  text-shadow: 0 0 .4em var(--c1);
}

.uvq04-pst .fq::before {
  content: "FM ";
  font-size: .55em;
  opacity: .7;
}

.uvq04-pst .fq::after {
  content: var(--f,"98.3");
}

.uvq04-pst .st {
  padding: .1em .4em;
  border: 1px solid currentColor;
  border-radius: .3em;
  font-size: .6em;
  font-weight: 700;
  opacity: .8;
}

.uvq04-pst .ks {
  display: grid;
  grid-template-columns: repeat(5,1fr);
  gap: .45em;
}

.uvq04-pst label {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: .65em;
  cursor: pointer;
}

.uvq04-pst input {
  position: absolute;
  opacity: 0;
  width: 1px;
  height: 1px;
  margin: 0;
  pointer-events: none;
}

.uvq04-pst .ky {
  position: relative;
  display: grid;
  place-items: center;
  width: 100%;
  height: 2.3em;
  border-radius: .35em .35em .5em .5em;
  background: linear-gradient(color-mix(in srgb,var(--c2),#fff 35%),var(--c2));
  box-shadow: 0 .42em 0 color-mix(in srgb,var(--c2),#000 40%),0 .6em .7em -.1em rgba(0,0,0,.45),inset 0 1px 0 rgba(255,255,255,.8);
  transition: transform calc(0.35s / var(--k)) cubic-bezier(.34,1.56,.64,1),box-shadow calc(0.35s / var(--k)) cubic-bezier(.34,1.56,.64,1),background calc(0.3s / var(--k)) cubic-bezier(.25,.1,.25,1);
}

.uvq04-pst .ky b {
  font-size: 1em;
  font-weight: 800;
  color: #3b3530;
}

.uvq04-pst .ky::after {
  content: "";
  position: absolute;
  top: .3em;
  left: 50%;
  width: 1.1em;
  height: .16em;
  margin-left: -.55em;
  border-radius: 1em;
  background: color-mix(in srgb,var(--c2),#000 25%);
  transition: background calc(0.3s / var(--k)) cubic-bezier(.25,.1,.25,1),box-shadow calc(0.3s / var(--k)) cubic-bezier(.25,.1,.25,1);
}

.uvq04-pst .nm {
  font-size: .55em;
  font-weight: 800;
  letter-spacing: .04em;
  text-transform: uppercase;
  white-space: nowrap;
  color: #2d2f33;
}

.uvq04-pst label:hover .ky {
  transform: translateY(.08em);
}

.uvq04-pst label:active .ky {
  transform: translateY(.3em);
  box-shadow: 0 .12em 0 color-mix(in srgb,var(--c2),#000 40%),0 .2em .3em rgba(0,0,0,.4),inset 0 1px 0 rgba(255,255,255,.6);
}

.uvq04-pst input:checked + .ky {
  transform: translateY(.36em);
  background: linear-gradient(var(--c2),color-mix(in srgb,var(--c2),#000 10%));
  box-shadow: 0 .06em 0 color-mix(in srgb,var(--c2),#000 40%),0 .1em .2em rgba(0,0,0,.4),inset 0 .2em .4em rgba(0,0,0,.18);
}

.uvq04-pst input:checked + .ky::after {
  background: var(--c1);
  box-shadow: 0 0 .4em var(--c1);
}

.uvq04-pst input:checked ~ .nm {
  color: color-mix(in srgb,var(--c1),#000 35%);
}

.uvq04-pst input:focus-visible + .ky {
  outline: 2px solid var(--c1);
  outline-offset: 3px;
}

.uvq04-pst:has(label:nth-of-type(1) input:checked) .fq {
  --f: "89.6";
}

.uvq04-pst:has(label:nth-of-type(2) input:checked) .fq {
  --f: "94.0";
}

.uvq04-pst:has(label:nth-of-type(3) input:checked) .fq {
  --f: "98.3";
}

.uvq04-pst:has(label:nth-of-type(4) input:checked) .fq {
  --f: "102.7";
}

.uvq04-pst:has(label:nth-of-type(5) input:checked) .fq {
  --f: "106.1";
}

@media (prefers-reduced-motion:reduce) {
  .uvq04-pst,.uvq04-pst *,.uvq04-pst *::before,.uvq04-pst *::after {
    animation-duration: .01ms!important;
    animation-iteration-count: 1!important;
    transition-duration: .01ms!important;
  }
}
`;

export default function RdPresetKeys() {
  return (
    <>
      <style>{css}</style>
      <div
        style={{
          "--c1": "#ff7a1a",
          "--c2": "#ece4d0",
          "--s": "16px",
          "--k": "1",
          "--fg": "#1d1d1f",
          "--bg": "#f5f5f7",
        } as CSSProperties}
      >
        <fieldset className="uvq04-pst"><legend>Presets</legend><div className="fp"><div className="ds" aria-hidden="true"><span className="fq"></span><span className="st">ST</span></div><div className="ks"><label><input type="radio" name="uvq04-pst" /><span className="ky"><b>1</b></span><span className="nm">Classical</span></label><label><input type="radio" name="uvq04-pst" /><span className="ky"><b>2</b></span><span className="nm">News</span></label><label><input type="radio" name="uvq04-pst" checked={true} /><span className="ky"><b>3</b></span><span className="nm">Jazz</span></label><label><input type="radio" name="uvq04-pst" /><span className="ky"><b>4</b></span><span className="nm">Pop</span></label><label><input type="radio" name="uvq04-pst" /><span className="ky"><b>5</b></span><span className="nm">Sports</span></label></div></div></fieldset>
      </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 “Car radio preset keys” block (Radio buttons) from AIMRAN Library to my project.

## What it is
The mechanical keys of an old car radio: the one you press sinks in and the previous one pops back up.

## Chosen settings
- Main color: #ff7a1a
- Secondary color: #ece4d0
- Size: 16px (from 12 to 24px)
- Speed: 1x (from 0.5 to 2x)
- Text: "Presintonías"

## 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 = `
.uvq04-pst {
  font-family: -apple-system,BlinkMacSystemFont,"SF Pro Text","Inter",system-ui,sans-serif;
  font-size: var(--s);
  color: var(--fg);
  -webkit-tap-highlight-color: transparent;
  border: 0;
  margin: 0;
  padding: 0;
  min-width: 0;
}

.uvq04-pst legend {
  padding: 0;
  margin: 0 0 .8em;
  font-weight: 700;
}

.uvq04-pst .fp {
  width: 20em;
  padding: .9em .9em 1em;
  border-radius: .9em;
  background: repeating-linear-gradient(90deg,rgba(255,255,255,.08) 0 1px,transparent 1px 3px),linear-gradient(#d3d6da,#9196a0 55%,#c1c5cb);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.8),inset 0 -1px 0 rgba(0,0,0,.25),0 1em 2em -1em rgba(0,0,0,.55);
}

.uvq04-pst .ds {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: .45em .8em;
  margin-bottom: .9em;
  border-radius: .4em;
  background: radial-gradient(120% 140% at 50% 0,#2a1608,#120904 70%);
  box-shadow: inset 0 .2em .5em rgba(0,0,0,.8),0 1px 0 rgba(255,255,255,.6);
  font-family: ui-monospace,"SF Mono",Menlo,Consolas,monospace;
  color: var(--c1);
}

.uvq04-pst .fq {
  font-size: 1.35em;
  font-weight: 700;
  letter-spacing: .04em;
  text-shadow: 0 0 .4em var(--c1);
}

.uvq04-pst .fq::before {
  content: "FM ";
  font-size: .55em;
  opacity: .7;
}

.uvq04-pst .fq::after {
  content: var(--f,"98.3");
}

.uvq04-pst .st {
  padding: .1em .4em;
  border: 1px solid currentColor;
  border-radius: .3em;
  font-size: .6em;
  font-weight: 700;
  opacity: .8;
}

.uvq04-pst .ks {
  display: grid;
  grid-template-columns: repeat(5,1fr);
  gap: .45em;
}

.uvq04-pst label {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: .65em;
  cursor: pointer;
}

.uvq04-pst input {
  position: absolute;
  opacity: 0;
  width: 1px;
  height: 1px;
  margin: 0;
  pointer-events: none;
}

.uvq04-pst .ky {
  position: relative;
  display: grid;
  place-items: center;
  width: 100%;
  height: 2.3em;
  border-radius: .35em .35em .5em .5em;
  background: linear-gradient(color-mix(in srgb,var(--c2),#fff 35%),var(--c2));
  box-shadow: 0 .42em 0 color-mix(in srgb,var(--c2),#000 40%),0 .6em .7em -.1em rgba(0,0,0,.45),inset 0 1px 0 rgba(255,255,255,.8);
  transition: transform calc(0.35s / var(--k)) cubic-bezier(.34,1.56,.64,1),box-shadow calc(0.35s / var(--k)) cubic-bezier(.34,1.56,.64,1),background calc(0.3s / var(--k)) cubic-bezier(.25,.1,.25,1);
}

.uvq04-pst .ky b {
  font-size: 1em;
  font-weight: 800;
  color: #3b3530;
}

.uvq04-pst .ky::after {
  content: "";
  position: absolute;
  top: .3em;
  left: 50%;
  width: 1.1em;
  height: .16em;
  margin-left: -.55em;
  border-radius: 1em;
  background: color-mix(in srgb,var(--c2),#000 25%);
  transition: background calc(0.3s / var(--k)) cubic-bezier(.25,.1,.25,1),box-shadow calc(0.3s / var(--k)) cubic-bezier(.25,.1,.25,1);
}

.uvq04-pst .nm {
  font-size: .55em;
  font-weight: 800;
  letter-spacing: .04em;
  text-transform: uppercase;
  white-space: nowrap;
  color: #2d2f33;
}

.uvq04-pst label:hover .ky {
  transform: translateY(.08em);
}

.uvq04-pst label:active .ky {
  transform: translateY(.3em);
  box-shadow: 0 .12em 0 color-mix(in srgb,var(--c2),#000 40%),0 .2em .3em rgba(0,0,0,.4),inset 0 1px 0 rgba(255,255,255,.6);
}

.uvq04-pst input:checked + .ky {
  transform: translateY(.36em);
  background: linear-gradient(var(--c2),color-mix(in srgb,var(--c2),#000 10%));
  box-shadow: 0 .06em 0 color-mix(in srgb,var(--c2),#000 40%),0 .1em .2em rgba(0,0,0,.4),inset 0 .2em .4em rgba(0,0,0,.18);
}

.uvq04-pst input:checked + .ky::after {
  background: var(--c1);
  box-shadow: 0 0 .4em var(--c1);
}

.uvq04-pst input:checked ~ .nm {
  color: color-mix(in srgb,var(--c1),#000 35%);
}

.uvq04-pst input:focus-visible + .ky {
  outline: 2px solid var(--c1);
  outline-offset: 3px;
}

.uvq04-pst:has(label:nth-of-type(1) input:checked) .fq {
  --f: "89.6";
}

.uvq04-pst:has(label:nth-of-type(2) input:checked) .fq {
  --f: "94.0";
}

.uvq04-pst:has(label:nth-of-type(3) input:checked) .fq {
  --f: "98.3";
}

.uvq04-pst:has(label:nth-of-type(4) input:checked) .fq {
  --f: "102.7";
}

.uvq04-pst:has(label:nth-of-type(5) input:checked) .fq {
  --f: "106.1";
}

@media (prefers-reduced-motion:reduce) {
  .uvq04-pst,.uvq04-pst *,.uvq04-pst *::before,.uvq04-pst *::after {
    animation-duration: .01ms!important;
    animation-iteration-count: 1!important;
    transition-duration: .01ms!important;
  }
}
`;

export default function RdPresetKeys() {
  return (
    <>
      <style>{css}</style>
      <div
        style={{
          "--c1": "#ff7a1a",
          "--c2": "#ece4d0",
          "--s": "16px",
          "--k": "1",
          "--fg": "#1d1d1f",
          "--bg": "#f5f5f7",
        } as CSSProperties}
      >
        <fieldset className="uvq04-pst"><legend>Presets</legend><div className="fp"><div className="ds" aria-hidden="true"><span className="fq"></span><span className="st">ST</span></div><div className="ks"><label><input type="radio" name="uvq04-pst" /><span className="ky"><b>1</b></span><span className="nm">Classical</span></label><label><input type="radio" name="uvq04-pst" /><span className="ky"><b>2</b></span><span className="nm">News</span></label><label><input type="radio" name="uvq04-pst" checked={true} /><span className="ky"><b>3</b></span><span className="nm">Jazz</span></label><label><input type="radio" name="uvq04-pst" /><span className="ky"><b>4</b></span><span className="nm">Pop</span></label><label><input type="radio" name="uvq04-pst" /><span className="ky"><b>5</b></span><span className="nm">Sports</span></label></div></div></fieldset>
      </div>
    </>
  );
}
```

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