# Coffee cup size radio

> Three glasses of different sizes: the chosen one fills with coffee and foam and starts to steam.

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

## Where to use it

Three clear glasses stand on a counter line as a size picker for a café menu. The chosen glass fills from the bottom with coffee, a darker crema band and milk foam, then thin wisps of steam drift above it, while the other glasses drain. Glass, liquid and steam are CSS only, which keeps it light for ordering apps and kiosks.

The main color is the coffee and the secondary color the foam, so tea, matcha or juice are easy variations. Change the names, volumes and prices in the labels, and use three or four sizes so the scale between them stays clear.

## Code

### HTML

```html
<fieldset class="uvq04-cup"><legend>Size</legend><div class="op"><label style="--k:0.78"><input type="radio" name="uvq04-cup"><span class="gl" aria-hidden="true"><span class="st"><i></i><i></i><i></i></span><span class="cp"></span></span><span class="nm">Small</span><small>250 ml · 2,20 €</small></label><label style="--k:0.9"><input type="radio" name="uvq04-cup" checked><span class="gl" aria-hidden="true"><span class="st"><i></i><i></i><i></i></span><span class="cp"></span></span><span class="nm">Medium</span><small>350 ml · 2,80 €</small></label><label style="--k:1.04"><input type="radio" name="uvq04-cup"><span class="gl" aria-hidden="true"><span class="st"><i></i><i></i><i></i></span><span class="cp"></span></span><span class="nm">Large</span><small>470 ml · 3,30 €</small></label></div></fieldset>
```

### CSS

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

.uvq04-cup {
  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;
  text-align: center;
}

.uvq04-cup legend {
  padding: 0;
  margin: 0 0 .8em;
  font-weight: 700;
  width: 100%;
}

.uvq04-cup .op {
  display: flex;
  align-items: flex-end;
  justify-content: center;
  gap: 1.1em;
  padding-bottom: .2em;
}

.uvq04-cup label {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: .25em;
  width: 5em;
  cursor: pointer;
}

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

.uvq04-cup .gl {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  height: 7.2em;
  width: 100%;
  margin-bottom: .35em;
  border-bottom: 2px solid color-mix(in srgb,var(--fg) 14%,transparent);
}

.uvq04-cup .cp {
  position: relative;
  width: calc(var(--k) * 3.4em);
  height: calc(var(--k) * 4.8em);
  clip-path: polygon(0 0,100% 0,88% 100%,12% 100%);
  border-radius: 0 0 .4em .4em;
  background: linear-gradient(90deg,rgba(255,255,255,.35) 0 18%,transparent 26%),color-mix(in srgb,var(--fg) 7%,transparent);
  box-shadow: inset 0 0 0 2px color-mix(in srgb,var(--fg) 18%,transparent);
  transition: transform calc(0.4s / var(--k)) cubic-bezier(.34,1.56,.64,1);
}

.uvq04-cup .cp::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 0;
  background: linear-gradient(var(--c2) 0 1em,color-mix(in srgb,var(--c2),var(--c1) 45%) 1em 1.3em,var(--c1) 1.3em);
  transition: height calc(0.7s / var(--k)) cubic-bezier(.22,1,.36,1);
}

.uvq04-cup .st {
  position: absolute;
  bottom: calc(var(--k) * 4.8em + .2em);
  display: flex;
  gap: .35em;
  opacity: 0;
  transition: opacity calc(0.4s / var(--k)) cubic-bezier(.25,.1,.25,1);
}

.uvq04-cup .st i {
  width: .3em;
  height: 1.4em;
  border-left: 2px solid color-mix(in srgb,var(--fg) 30%,transparent);
  border-radius: 50%;
  animation: uvq04-cup calc(2s / var(--k)) cubic-bezier(.25,.1,.25,1) infinite;
}

.uvq04-cup .st i:nth-child(2) {
  animation-delay: calc(0.6s / var(--k));
}

.uvq04-cup .st i:nth-child(3) {
  animation-delay: calc(1.2s / var(--k));
}

.uvq04-cup .nm {
  font-weight: 700;
}

.uvq04-cup small {
  font-size: .72em;
  white-space: nowrap;
  color: color-mix(in srgb,var(--fg) 55%,transparent);
}

.uvq04-cup label:hover .cp {
  transform: translateY(-.2em);
}

.uvq04-cup label:active .cp {
  transform: scale(.95);
}

.uvq04-cup input:checked + .gl .cp::after {
  height: 88%;
}

.uvq04-cup input:checked + .gl .st {
  opacity: 1;
}

.uvq04-cup input:checked ~ .nm {
  color: color-mix(in srgb,var(--c1) 70%,var(--fg));
}

.uvq04-cup input:focus-visible + .gl {
  outline: 2px solid var(--c1);
  outline-offset: 3px;
  border-radius: .5em;
}

@keyframes uvq04-cup {
  0% {
    transform: translateY(.6em) scaleY(.6);
    opacity: 0;
  }
  40% {
    opacity: 1;
  }
  100% {
    transform: translateY(-1em) translateX(.2em) scaleY(1.1);
    opacity: 0;
  }
}

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

### React

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

const css = `
.uvq04-cup {
  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;
  text-align: center;
}

.uvq04-cup legend {
  padding: 0;
  margin: 0 0 .8em;
  font-weight: 700;
  width: 100%;
}

.uvq04-cup .op {
  display: flex;
  align-items: flex-end;
  justify-content: center;
  gap: 1.1em;
  padding-bottom: .2em;
}

.uvq04-cup label {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: .25em;
  width: 5em;
  cursor: pointer;
}

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

.uvq04-cup .gl {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  height: 7.2em;
  width: 100%;
  margin-bottom: .35em;
  border-bottom: 2px solid color-mix(in srgb,var(--fg) 14%,transparent);
}

.uvq04-cup .cp {
  position: relative;
  width: calc(var(--k) * 3.4em);
  height: calc(var(--k) * 4.8em);
  clip-path: polygon(0 0,100% 0,88% 100%,12% 100%);
  border-radius: 0 0 .4em .4em;
  background: linear-gradient(90deg,rgba(255,255,255,.35) 0 18%,transparent 26%),color-mix(in srgb,var(--fg) 7%,transparent);
  box-shadow: inset 0 0 0 2px color-mix(in srgb,var(--fg) 18%,transparent);
  transition: transform calc(0.4s / var(--k)) cubic-bezier(.34,1.56,.64,1);
}

.uvq04-cup .cp::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 0;
  background: linear-gradient(var(--c2) 0 1em,color-mix(in srgb,var(--c2),var(--c1) 45%) 1em 1.3em,var(--c1) 1.3em);
  transition: height calc(0.7s / var(--k)) cubic-bezier(.22,1,.36,1);
}

.uvq04-cup .st {
  position: absolute;
  bottom: calc(var(--k) * 4.8em + .2em);
  display: flex;
  gap: .35em;
  opacity: 0;
  transition: opacity calc(0.4s / var(--k)) cubic-bezier(.25,.1,.25,1);
}

.uvq04-cup .st i {
  width: .3em;
  height: 1.4em;
  border-left: 2px solid color-mix(in srgb,var(--fg) 30%,transparent);
  border-radius: 50%;
  animation: uvq04-cup calc(2s / var(--k)) cubic-bezier(.25,.1,.25,1) infinite;
}

.uvq04-cup .st i:nth-child(2) {
  animation-delay: calc(0.6s / var(--k));
}

.uvq04-cup .st i:nth-child(3) {
  animation-delay: calc(1.2s / var(--k));
}

.uvq04-cup .nm {
  font-weight: 700;
}

.uvq04-cup small {
  font-size: .72em;
  white-space: nowrap;
  color: color-mix(in srgb,var(--fg) 55%,transparent);
}

.uvq04-cup label:hover .cp {
  transform: translateY(-.2em);
}

.uvq04-cup label:active .cp {
  transform: scale(.95);
}

.uvq04-cup input:checked + .gl .cp::after {
  height: 88%;
}

.uvq04-cup input:checked + .gl .st {
  opacity: 1;
}

.uvq04-cup input:checked ~ .nm {
  color: color-mix(in srgb,var(--c1) 70%,var(--fg));
}

.uvq04-cup input:focus-visible + .gl {
  outline: 2px solid var(--c1);
  outline-offset: 3px;
  border-radius: .5em;
}

@keyframes uvq04-cup {
  0% {
    transform: translateY(.6em) scaleY(.6);
    opacity: 0;
  }
  40% {
    opacity: 1;
  }
  100% {
    transform: translateY(-1em) translateX(.2em) scaleY(1.1);
    opacity: 0;
  }
}

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

export default function RdCupSize() {
  return (
    <>
      <style>{css}</style>
      <div
        style={{
          "--c1": "#6f3b1f",
          "--c2": "#f1dcc0",
          "--s": "16px",
          "--k": "1",
          "--fg": "#1d1d1f",
          "--bg": "#f5f5f7",
        } as CSSProperties}
      >
        <fieldset className="uvq04-cup"><legend>Size</legend><div className="op"><label style={{ "--k": "0.78" } as CSSProperties}><input type="radio" name="uvq04-cup" /><span className="gl" aria-hidden="true"><span className="st"><i></i><i></i><i></i></span><span className="cp"></span></span><span className="nm">Small</span><small>250 ml · 2,20 €</small></label><label style={{ "--k": "0.9" } as CSSProperties}><input type="radio" name="uvq04-cup" checked={true} /><span className="gl" aria-hidden="true"><span className="st"><i></i><i></i><i></i></span><span className="cp"></span></span><span className="nm">Medium</span><small>350 ml · 2,80 €</small></label><label style={{ "--k": "1.04" } as CSSProperties}><input type="radio" name="uvq04-cup" /><span className="gl" aria-hidden="true"><span className="st"><i></i><i></i><i></i></span><span className="cp"></span></span><span className="nm">Large</span><small>470 ml · 3,30 €</small></label></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 “Coffee cup size radio” block (Radio buttons) from AIMRAN Library to my project.

## What it is
Three glasses of different sizes: the chosen one fills with coffee and foam and starts to steam.

## Chosen settings
- Main color: #6f3b1f
- Secondary color: #f1dcc0
- Size: 16px (from 12 to 24px)
- Speed: 1x (from 0.5 to 2x)
- Text: "Tamaño"

## 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-cup {
  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;
  text-align: center;
}

.uvq04-cup legend {
  padding: 0;
  margin: 0 0 .8em;
  font-weight: 700;
  width: 100%;
}

.uvq04-cup .op {
  display: flex;
  align-items: flex-end;
  justify-content: center;
  gap: 1.1em;
  padding-bottom: .2em;
}

.uvq04-cup label {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: .25em;
  width: 5em;
  cursor: pointer;
}

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

.uvq04-cup .gl {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  height: 7.2em;
  width: 100%;
  margin-bottom: .35em;
  border-bottom: 2px solid color-mix(in srgb,var(--fg) 14%,transparent);
}

.uvq04-cup .cp {
  position: relative;
  width: calc(var(--k) * 3.4em);
  height: calc(var(--k) * 4.8em);
  clip-path: polygon(0 0,100% 0,88% 100%,12% 100%);
  border-radius: 0 0 .4em .4em;
  background: linear-gradient(90deg,rgba(255,255,255,.35) 0 18%,transparent 26%),color-mix(in srgb,var(--fg) 7%,transparent);
  box-shadow: inset 0 0 0 2px color-mix(in srgb,var(--fg) 18%,transparent);
  transition: transform calc(0.4s / var(--k)) cubic-bezier(.34,1.56,.64,1);
}

.uvq04-cup .cp::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 0;
  background: linear-gradient(var(--c2) 0 1em,color-mix(in srgb,var(--c2),var(--c1) 45%) 1em 1.3em,var(--c1) 1.3em);
  transition: height calc(0.7s / var(--k)) cubic-bezier(.22,1,.36,1);
}

.uvq04-cup .st {
  position: absolute;
  bottom: calc(var(--k) * 4.8em + .2em);
  display: flex;
  gap: .35em;
  opacity: 0;
  transition: opacity calc(0.4s / var(--k)) cubic-bezier(.25,.1,.25,1);
}

.uvq04-cup .st i {
  width: .3em;
  height: 1.4em;
  border-left: 2px solid color-mix(in srgb,var(--fg) 30%,transparent);
  border-radius: 50%;
  animation: uvq04-cup calc(2s / var(--k)) cubic-bezier(.25,.1,.25,1) infinite;
}

.uvq04-cup .st i:nth-child(2) {
  animation-delay: calc(0.6s / var(--k));
}

.uvq04-cup .st i:nth-child(3) {
  animation-delay: calc(1.2s / var(--k));
}

.uvq04-cup .nm {
  font-weight: 700;
}

.uvq04-cup small {
  font-size: .72em;
  white-space: nowrap;
  color: color-mix(in srgb,var(--fg) 55%,transparent);
}

.uvq04-cup label:hover .cp {
  transform: translateY(-.2em);
}

.uvq04-cup label:active .cp {
  transform: scale(.95);
}

.uvq04-cup input:checked + .gl .cp::after {
  height: 88%;
}

.uvq04-cup input:checked + .gl .st {
  opacity: 1;
}

.uvq04-cup input:checked ~ .nm {
  color: color-mix(in srgb,var(--c1) 70%,var(--fg));
}

.uvq04-cup input:focus-visible + .gl {
  outline: 2px solid var(--c1);
  outline-offset: 3px;
  border-radius: .5em;
}

@keyframes uvq04-cup {
  0% {
    transform: translateY(.6em) scaleY(.6);
    opacity: 0;
  }
  40% {
    opacity: 1;
  }
  100% {
    transform: translateY(-1em) translateX(.2em) scaleY(1.1);
    opacity: 0;
  }
}

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

export default function RdCupSize() {
  return (
    <>
      <style>{css}</style>
      <div
        style={{
          "--c1": "#6f3b1f",
          "--c2": "#f1dcc0",
          "--s": "16px",
          "--k": "1",
          "--fg": "#1d1d1f",
          "--bg": "#f5f5f7",
        } as CSSProperties}
      >
        <fieldset className="uvq04-cup"><legend>Size</legend><div className="op"><label style={{ "--k": "0.78" } as CSSProperties}><input type="radio" name="uvq04-cup" /><span className="gl" aria-hidden="true"><span className="st"><i></i><i></i><i></i></span><span className="cp"></span></span><span className="nm">Small</span><small>250 ml · 2,20 €</small></label><label style={{ "--k": "0.9" } as CSSProperties}><input type="radio" name="uvq04-cup" checked={true} /><span className="gl" aria-hidden="true"><span className="st"><i></i><i></i><i></i></span><span className="cp"></span></span><span className="nm">Medium</span><small>350 ml · 2,80 €</small></label><label style={{ "--k": "1.04" } as CSSProperties}><input type="radio" name="uvq04-cup" /><span className="gl" aria-hidden="true"><span className="st"><i></i><i></i><i></i></span><span className="cp"></span></span><span className="nm">Large</span><small>470 ml · 3,30 €</small></label></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.
````
