# Tea bag checkbox

> The tea bag drops into the glass cup with a bounce and the water slowly turns the colour of tea while steam rises.

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

## Where to use it

This checkbox is a glass cup of hot water with a tea bag hanging above it on a string with a paper tag. Checking it lowers the bag into the cup with a bouncy dip, then the water slowly takes on the colour of the tea over a couple of seconds and two wisps of steam start to rise. It suits café menus and wellness apps.

The main color is the brewed tea and the secondary color the paper tag, so try amber black tea, green tea or a red berry infusion. The speed slider changes how fast the tea brews and the steam drifts.

## Code

### HTML

```html
<label class="uvq02-tea"><input type="checkbox"><span class="cu" aria-hidden="true"><i class="sm"></i><i class="sm"></i><span class="bg"><i class="tg"></i></span><span class="mg"><i class="wt"></i></span><i class="hd"></i></span>Brew the tea</label>
```

### CSS

```css
.uvq02-tea {
  --c1: #b5651d;
  --c2: #e8443a;
  --s: 16px;
  /* tamaño */
  --k: 1;
  /* velocidad */
  --fg: #1d1d1f;
  /* texto */
  --bg: #f5f5f7;
  /* fondo */
}

.uvq02-tea {
  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;
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: .75em;
  cursor: pointer;
  user-select: none;
  -webkit-user-select: none;
  font-weight: 550;
  gap: .8em;
}

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

.uvq02-tea .cu {
  position: relative;
  flex: none;
  width: 3.7em;
  height: 3.9em;
}

.uvq02-tea .mg {
  position: absolute;
  left: .3em;
  bottom: .15em;
  width: 2.4em;
  height: 2.1em;
  border-radius: .12em .12em .95em .95em;
  background: rgba(255,255,255,.28);
  box-shadow: inset 0 0 0 .12em rgba(255,255,255,.75),inset 0 0 0 .15em color-mix(in srgb,var(--fg) 22%,transparent),0 .3em .45em -.25em rgba(0,0,0,.35);
  overflow: hidden;
  z-index: 2;
}

.uvq02-tea .mg::after {
  content: "";
  position: absolute;
  left: .3em;
  top: .25em;
  width: .25em;
  height: 1.3em;
  border-radius: 1em;
  background: rgba(255,255,255,.6);
}

.uvq02-tea .wt {
  position: absolute;
  left: .15em;
  right: .15em;
  bottom: .15em;
  height: 72%;
  border-radius: 0 0 .8em .8em;
  background: #dcebef;
}

.uvq02-tea .wt::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: linear-gradient(to top,var(--c1),color-mix(in srgb,var(--c1) 70%,#fff));
  opacity: 0;
  transition: opacity calc(0.4s / var(--k)) cubic-bezier(.25,.1,.25,1);
}

.uvq02-tea .hd {
  position: absolute;
  left: 2.45em;
  bottom: .65em;
  width: .75em;
  height: 1em;
  border: .2em solid color-mix(in srgb,var(--fg) 22%,transparent);
  border-left: 0;
  border-radius: 0 .55em .55em 0;
  z-index: 1;
}

.uvq02-tea .bg {
  position: absolute;
  left: 1em;
  top: .15em;
  width: .95em;
  height: 1.15em;
  border-radius: .12em .12em .28em .28em;
  background: radial-gradient(circle,#7a5a33 .05em,transparent .07em) 0 0/.24em .24em,#efe2c4;
  box-shadow: 0 .06em .1em rgba(0,0,0,.25);
  z-index: 1;
  transition: transform calc(0.9s / var(--k)) cubic-bezier(.3,1.6,.5,1);
}

.uvq02-tea .bg::before {
  content: "";
  position: absolute;
  left: 50%;
  bottom: 100%;
  width: 1px;
  height: .25em;
  background: color-mix(in srgb,var(--fg) 45%,transparent);
}

.uvq02-tea .tg {
  position: absolute;
  left: 1.55em;
  top: -.55em;
  width: .8em;
  height: .62em;
  border-radius: .1em;
  background: var(--c2);
  box-shadow: 0 .05em .08em rgba(0,0,0,.25);
  transform: rotate(8deg);
}

.uvq02-tea .tg::before {
  content: "";
  position: absolute;
  right: 100%;
  top: .3em;
  width: 1.15em;
  height: 1px;
  background: color-mix(in srgb,var(--fg) 45%,transparent);
  transform-origin: 100% 0;
  transform: rotate(-22deg);
}

.uvq02-tea .sm {
  position: absolute;
  top: .4em;
  left: 1.35em;
  width: .16em;
  height: .8em;
  border-radius: 1em;
  background: linear-gradient(transparent,color-mix(in srgb,var(--fg) 25%,transparent));
  opacity: 0;
}

.uvq02-tea .sm + .sm {
  left: 1.85em;
}

.uvq02-tea:hover input:not(:checked) + .cu .bg {
  transform: translateY(.25em);
}

.uvq02-tea:active .bg {
  transform: translateY(.45em);
}

.uvq02-tea input:checked + .cu .bg {
  transform: translateY(1.45em);
}

.uvq02-tea input:checked + .cu .wt::after {
  opacity: .95;
  transition: opacity calc(2.4s / var(--k)) cubic-bezier(.25,.1,.25,1) calc(0.4s / var(--k));
}

.uvq02-tea input:checked + .cu .sm {
  animation: uvq02-tea calc(1.8s / var(--k)) cubic-bezier(.25,.1,.25,1) calc(1s / var(--k)) infinite;
}

.uvq02-tea input:checked + .cu .sm + .sm {
  animation-delay: calc(1.7s / var(--k));
}

@keyframes uvq02-tea {
  0% {
    opacity: 0;
    transform: translateY(0) scaleY(.6);
  }
  30% {
    opacity: 1;
  }
  100% {
    opacity: 0;
    transform: translateY(-1.1em) scaleY(1.1) skewX(-12deg);
  }
}

.uvq02-tea input:focus-visible + .cu {
  outline: 2px solid var(--c1);
  outline-offset: 3px;
}

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

### React

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

const css = `
.uvq02-tea {
  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;
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: .75em;
  cursor: pointer;
  user-select: none;
  -webkit-user-select: none;
  font-weight: 550;
  gap: .8em;
}

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

.uvq02-tea .cu {
  position: relative;
  flex: none;
  width: 3.7em;
  height: 3.9em;
}

.uvq02-tea .mg {
  position: absolute;
  left: .3em;
  bottom: .15em;
  width: 2.4em;
  height: 2.1em;
  border-radius: .12em .12em .95em .95em;
  background: rgba(255,255,255,.28);
  box-shadow: inset 0 0 0 .12em rgba(255,255,255,.75),inset 0 0 0 .15em color-mix(in srgb,var(--fg) 22%,transparent),0 .3em .45em -.25em rgba(0,0,0,.35);
  overflow: hidden;
  z-index: 2;
}

.uvq02-tea .mg::after {
  content: "";
  position: absolute;
  left: .3em;
  top: .25em;
  width: .25em;
  height: 1.3em;
  border-radius: 1em;
  background: rgba(255,255,255,.6);
}

.uvq02-tea .wt {
  position: absolute;
  left: .15em;
  right: .15em;
  bottom: .15em;
  height: 72%;
  border-radius: 0 0 .8em .8em;
  background: #dcebef;
}

.uvq02-tea .wt::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: linear-gradient(to top,var(--c1),color-mix(in srgb,var(--c1) 70%,#fff));
  opacity: 0;
  transition: opacity calc(0.4s / var(--k)) cubic-bezier(.25,.1,.25,1);
}

.uvq02-tea .hd {
  position: absolute;
  left: 2.45em;
  bottom: .65em;
  width: .75em;
  height: 1em;
  border: .2em solid color-mix(in srgb,var(--fg) 22%,transparent);
  border-left: 0;
  border-radius: 0 .55em .55em 0;
  z-index: 1;
}

.uvq02-tea .bg {
  position: absolute;
  left: 1em;
  top: .15em;
  width: .95em;
  height: 1.15em;
  border-radius: .12em .12em .28em .28em;
  background: radial-gradient(circle,#7a5a33 .05em,transparent .07em) 0 0/.24em .24em,#efe2c4;
  box-shadow: 0 .06em .1em rgba(0,0,0,.25);
  z-index: 1;
  transition: transform calc(0.9s / var(--k)) cubic-bezier(.3,1.6,.5,1);
}

.uvq02-tea .bg::before {
  content: "";
  position: absolute;
  left: 50%;
  bottom: 100%;
  width: 1px;
  height: .25em;
  background: color-mix(in srgb,var(--fg) 45%,transparent);
}

.uvq02-tea .tg {
  position: absolute;
  left: 1.55em;
  top: -.55em;
  width: .8em;
  height: .62em;
  border-radius: .1em;
  background: var(--c2);
  box-shadow: 0 .05em .08em rgba(0,0,0,.25);
  transform: rotate(8deg);
}

.uvq02-tea .tg::before {
  content: "";
  position: absolute;
  right: 100%;
  top: .3em;
  width: 1.15em;
  height: 1px;
  background: color-mix(in srgb,var(--fg) 45%,transparent);
  transform-origin: 100% 0;
  transform: rotate(-22deg);
}

.uvq02-tea .sm {
  position: absolute;
  top: .4em;
  left: 1.35em;
  width: .16em;
  height: .8em;
  border-radius: 1em;
  background: linear-gradient(transparent,color-mix(in srgb,var(--fg) 25%,transparent));
  opacity: 0;
}

.uvq02-tea .sm + .sm {
  left: 1.85em;
}

.uvq02-tea:hover input:not(:checked) + .cu .bg {
  transform: translateY(.25em);
}

.uvq02-tea:active .bg {
  transform: translateY(.45em);
}

.uvq02-tea input:checked + .cu .bg {
  transform: translateY(1.45em);
}

.uvq02-tea input:checked + .cu .wt::after {
  opacity: .95;
  transition: opacity calc(2.4s / var(--k)) cubic-bezier(.25,.1,.25,1) calc(0.4s / var(--k));
}

.uvq02-tea input:checked + .cu .sm {
  animation: uvq02-tea calc(1.8s / var(--k)) cubic-bezier(.25,.1,.25,1) calc(1s / var(--k)) infinite;
}

.uvq02-tea input:checked + .cu .sm + .sm {
  animation-delay: calc(1.7s / var(--k));
}

@keyframes uvq02-tea {
  0% {
    opacity: 0;
    transform: translateY(0) scaleY(.6);
  }
  30% {
    opacity: 1;
  }
  100% {
    opacity: 0;
    transform: translateY(-1.1em) scaleY(1.1) skewX(-12deg);
  }
}

.uvq02-tea input:focus-visible + .cu {
  outline: 2px solid var(--c1);
  outline-offset: 3px;
}

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

export default function ChkTeabag() {
  return (
    <>
      <style>{css}</style>
      <div
        style={{
          "--c1": "#b5651d",
          "--c2": "#e8443a",
          "--s": "16px",
          "--k": "1",
          "--fg": "#1d1d1f",
          "--bg": "#f5f5f7",
        } as CSSProperties}
      >
        <label className="uvq02-tea"><input type="checkbox" /><span className="cu" aria-hidden="true"><i className="sm"></i><i className="sm"></i><span className="bg"><i className="tg"></i></span><span className="mg"><i className="wt"></i></span><i className="hd"></i></span>Brew the tea</label>
      </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 “Tea bag checkbox” block (Checkboxes) from AIMRAN Library to my project.

## What it is
The tea bag drops into the glass cup with a bounce and the water slowly turns the colour of tea while steam rises.

## Chosen settings
- Main color: #b5651d
- Secondary color: #e8443a
- Size: 16px (from 12 to 24px)
- Speed: 1x (from 0.5 to 2x)
- Text: "Infusionar el té"

## 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 = `
.uvq02-tea {
  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;
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: .75em;
  cursor: pointer;
  user-select: none;
  -webkit-user-select: none;
  font-weight: 550;
  gap: .8em;
}

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

.uvq02-tea .cu {
  position: relative;
  flex: none;
  width: 3.7em;
  height: 3.9em;
}

.uvq02-tea .mg {
  position: absolute;
  left: .3em;
  bottom: .15em;
  width: 2.4em;
  height: 2.1em;
  border-radius: .12em .12em .95em .95em;
  background: rgba(255,255,255,.28);
  box-shadow: inset 0 0 0 .12em rgba(255,255,255,.75),inset 0 0 0 .15em color-mix(in srgb,var(--fg) 22%,transparent),0 .3em .45em -.25em rgba(0,0,0,.35);
  overflow: hidden;
  z-index: 2;
}

.uvq02-tea .mg::after {
  content: "";
  position: absolute;
  left: .3em;
  top: .25em;
  width: .25em;
  height: 1.3em;
  border-radius: 1em;
  background: rgba(255,255,255,.6);
}

.uvq02-tea .wt {
  position: absolute;
  left: .15em;
  right: .15em;
  bottom: .15em;
  height: 72%;
  border-radius: 0 0 .8em .8em;
  background: #dcebef;
}

.uvq02-tea .wt::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: linear-gradient(to top,var(--c1),color-mix(in srgb,var(--c1) 70%,#fff));
  opacity: 0;
  transition: opacity calc(0.4s / var(--k)) cubic-bezier(.25,.1,.25,1);
}

.uvq02-tea .hd {
  position: absolute;
  left: 2.45em;
  bottom: .65em;
  width: .75em;
  height: 1em;
  border: .2em solid color-mix(in srgb,var(--fg) 22%,transparent);
  border-left: 0;
  border-radius: 0 .55em .55em 0;
  z-index: 1;
}

.uvq02-tea .bg {
  position: absolute;
  left: 1em;
  top: .15em;
  width: .95em;
  height: 1.15em;
  border-radius: .12em .12em .28em .28em;
  background: radial-gradient(circle,#7a5a33 .05em,transparent .07em) 0 0/.24em .24em,#efe2c4;
  box-shadow: 0 .06em .1em rgba(0,0,0,.25);
  z-index: 1;
  transition: transform calc(0.9s / var(--k)) cubic-bezier(.3,1.6,.5,1);
}

.uvq02-tea .bg::before {
  content: "";
  position: absolute;
  left: 50%;
  bottom: 100%;
  width: 1px;
  height: .25em;
  background: color-mix(in srgb,var(--fg) 45%,transparent);
}

.uvq02-tea .tg {
  position: absolute;
  left: 1.55em;
  top: -.55em;
  width: .8em;
  height: .62em;
  border-radius: .1em;
  background: var(--c2);
  box-shadow: 0 .05em .08em rgba(0,0,0,.25);
  transform: rotate(8deg);
}

.uvq02-tea .tg::before {
  content: "";
  position: absolute;
  right: 100%;
  top: .3em;
  width: 1.15em;
  height: 1px;
  background: color-mix(in srgb,var(--fg) 45%,transparent);
  transform-origin: 100% 0;
  transform: rotate(-22deg);
}

.uvq02-tea .sm {
  position: absolute;
  top: .4em;
  left: 1.35em;
  width: .16em;
  height: .8em;
  border-radius: 1em;
  background: linear-gradient(transparent,color-mix(in srgb,var(--fg) 25%,transparent));
  opacity: 0;
}

.uvq02-tea .sm + .sm {
  left: 1.85em;
}

.uvq02-tea:hover input:not(:checked) + .cu .bg {
  transform: translateY(.25em);
}

.uvq02-tea:active .bg {
  transform: translateY(.45em);
}

.uvq02-tea input:checked + .cu .bg {
  transform: translateY(1.45em);
}

.uvq02-tea input:checked + .cu .wt::after {
  opacity: .95;
  transition: opacity calc(2.4s / var(--k)) cubic-bezier(.25,.1,.25,1) calc(0.4s / var(--k));
}

.uvq02-tea input:checked + .cu .sm {
  animation: uvq02-tea calc(1.8s / var(--k)) cubic-bezier(.25,.1,.25,1) calc(1s / var(--k)) infinite;
}

.uvq02-tea input:checked + .cu .sm + .sm {
  animation-delay: calc(1.7s / var(--k));
}

@keyframes uvq02-tea {
  0% {
    opacity: 0;
    transform: translateY(0) scaleY(.6);
  }
  30% {
    opacity: 1;
  }
  100% {
    opacity: 0;
    transform: translateY(-1.1em) scaleY(1.1) skewX(-12deg);
  }
}

.uvq02-tea input:focus-visible + .cu {
  outline: 2px solid var(--c1);
  outline-offset: 3px;
}

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

export default function ChkTeabag() {
  return (
    <>
      <style>{css}</style>
      <div
        style={{
          "--c1": "#b5651d",
          "--c2": "#e8443a",
          "--s": "16px",
          "--k": "1",
          "--fg": "#1d1d1f",
          "--bg": "#f5f5f7",
        } as CSSProperties}
      >
        <label className="uvq02-tea"><input type="checkbox" /><span className="cu" aria-hidden="true"><i className="sm"></i><i className="sm"></i><span className="bg"><i className="tg"></i></span><span className="mg"><i className="wt"></i></span><i className="hd"></i></span>Brew the tea</label>
      </div>
    </>
  );
}
```

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