# Test tube flavour filter

> A lab test tube rack: each flavour you pick fills its tube with coloured liquid and rising bubbles.

- Category: [Filters](https://library.aimran.es/components/filters)
- Built with: HTML + CSS
- Live editor: https://library.aimran.es/blocks/uv-f-test-tubes
- Library: AIMRAN Library (https://library.aimran.es), free, no sign-up, by Aimran Oukham

## Where to use it

Ice cream shops, cocktail bars and drink brands can turn a flavour filter into a small science experiment. Each option is a glass test tube in a steel rack, drawn with CSS gradients, and checking it raises a coloured liquid with a meniscus and a stream of tiny bubbles. Labels sit below and a counter tracks the chosen flavours.

The first colour paints the rack and the second tints the glass. Set each liquid colour in the markup, swap flavours for scents or ingredients, and keep five or six tubes so the rack fits on a phone screen.

## Code

### HTML

```html
<fieldset class="uvq05-tt"><legend>Flavours</legend><div class="rk"><label style="--l:#ff4d6d"><input type="checkbox" checked><span class="tb" aria-hidden="true"><i class="lq"></i><i class="bu"></i></span><span class="nm">Strawberry</span></label><label style="--l:#2ec4b6"><input type="checkbox"><span class="tb" aria-hidden="true"><i class="lq"></i><i class="bu"></i></span><span class="nm">Mint</span></label><label style="--l:#ffb703"><input type="checkbox"><span class="tb" aria-hidden="true"><i class="lq"></i><i class="bu"></i></span><span class="nm">Mango</span></label><label style="--l:#5a4fcf"><input type="checkbox" checked><span class="tb" aria-hidden="true"><i class="lq"></i><i class="bu"></i></span><span class="nm">Blueberry</span></label><label style="--l:#9bc53d"><input type="checkbox"><span class="tb" aria-hidden="true"><i class="lq"></i><i class="bu"></i></span><span class="nm">Pistachio</span></label><i class="bar" aria-hidden="true"></i></div><p class="ct"><span>Flavours chosen:</span> <span class="n"></span></p></fieldset>
```

### CSS

```css
.uvq05-tt {
  --c1: #475569;
  --c2: #dbeafe;
  --s: 16px;
  /* tamaño */
  --k: 1;
  /* velocidad */
  --fg: #1d1d1f;
  /* texto */
  --bg: #f5f5f7;
  /* fondo */
}

.uvq05-tt {
  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;
  width: 17em;
  counter-reset: uvq05-tt;
}

.uvq05-tt legend {
  padding: 0;
  margin: 0 0 .8em;
  font-weight: 700;
}

.uvq05-tt .rk {
  position: relative;
  display: flex;
  justify-content: space-around;
  padding: .7em .4em .6em;
  border-radius: .9em;
  background: color-mix(in srgb,var(--fg) 6%,transparent);
}

.uvq05-tt .rk::after {
  content: "";
  position: absolute;
  left: .4em;
  right: .4em;
  bottom: 1.95em;
  height: .45em;
  border-radius: .2em;
  background: linear-gradient(color-mix(in srgb,var(--c1) 60%,#fff),var(--c1));
  box-shadow: 0 .3em .4em -.2em rgba(0,0,0,.4);
  pointer-events: none;
}

.uvq05-tt .bar {
  position: absolute;
  left: .4em;
  right: .4em;
  top: 1.7em;
  z-index: 2;
  height: .5em;
  border-radius: .2em;
  background: linear-gradient(color-mix(in srgb,var(--c1) 55%,#fff),var(--c1));
  box-shadow: 0 .2em .3em rgba(0,0,0,.3);
  pointer-events: none;
}

.uvq05-tt label {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: .75em;
  cursor: pointer;
}

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

.uvq05-tt input:checked {
  counter-increment: uvq05-tt;
}

.uvq05-tt .tb {
  position: relative;
  display: block;
  width: 1.35em;
  height: 5.4em;
  border-radius: .15em .15em .7em .7em;
  overflow: hidden;
  background: linear-gradient(90deg,rgba(255,255,255,.6),rgba(255,255,255,.1) 35%,rgba(255,255,255,0) 60%,rgba(255,255,255,.35)),color-mix(in srgb,var(--c2) 40%,transparent);
  box-shadow: inset 0 0 0 1.5px color-mix(in srgb,var(--fg) 28%,transparent);
  transition: transform calc(0.4s / var(--k)) cubic-bezier(.34,1.56,.64,1);
}

.uvq05-tt .lq {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 0;
  background: linear-gradient(90deg,color-mix(in srgb,var(--l) 78%,#000),var(--l) 40%,color-mix(in srgb,var(--l) 70%,#fff));
  transition: height calc(0.8s / var(--k)) cubic-bezier(.22,1,.36,1);
}

.uvq05-tt .lq::before {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  top: -.15em;
  height: .3em;
  border-radius: 50%;
  background: color-mix(in srgb,var(--l) 55%,#fff);
}

.uvq05-tt .bu {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 68%;
  background: radial-gradient(circle,rgba(255,255,255,.85) 0 .07em,transparent .09em) 30% 0/.6em 1.6em,radial-gradient(circle,rgba(255,255,255,.7) 0 .05em,transparent .07em) 75% 0/.5em 2.2em;
  opacity: 0;
  transition: opacity calc(0.3s / var(--k)) cubic-bezier(.25,.1,.25,1);
  animation: uvq05-ttb calc(1.6s / var(--k)) linear infinite;
}

.uvq05-tt .nm {
  font-size: .66em;
  font-weight: 600;
  color: color-mix(in srgb,var(--fg) 58%,transparent);
  transition: color calc(0.3s / var(--k)) cubic-bezier(.25,.1,.25,1);
}

.uvq05-tt label:hover .tb {
  transform: translateY(-.2em) rotate(-3deg);
}

.uvq05-tt label:active .tb {
  transform: scale(.94);
}

.uvq05-tt input:checked+.tb .lq {
  height: 72%;
}

.uvq05-tt input:checked+.tb .bu {
  opacity: 1;
  transition-delay: calc(0.5s / var(--k));
}

.uvq05-tt input:checked~.nm {
  color: var(--fg);
  font-weight: 800;
}

.uvq05-tt input:focus-visible+.tb {
  outline: 2px solid var(--c1);
  outline-offset: 3px;
}

.uvq05-tt .ct {
  margin: .8em 0 0;
  font-size: .8em;
  color: color-mix(in srgb,var(--fg) 58%,transparent);
}

.uvq05-tt .n::before {
  content: counter(uvq05-tt);
  font-weight: 800;
  color: var(--fg);
}

@keyframes uvq05-ttb {
  to {
    background-position: 30% -1.6em,75% -2.2em;
  }
}

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

### React

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

const css = `
.uvq05-tt {
  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;
  width: 17em;
  counter-reset: uvq05-tt;
}

.uvq05-tt legend {
  padding: 0;
  margin: 0 0 .8em;
  font-weight: 700;
}

.uvq05-tt .rk {
  position: relative;
  display: flex;
  justify-content: space-around;
  padding: .7em .4em .6em;
  border-radius: .9em;
  background: color-mix(in srgb,var(--fg) 6%,transparent);
}

.uvq05-tt .rk::after {
  content: "";
  position: absolute;
  left: .4em;
  right: .4em;
  bottom: 1.95em;
  height: .45em;
  border-radius: .2em;
  background: linear-gradient(color-mix(in srgb,var(--c1) 60%,#fff),var(--c1));
  box-shadow: 0 .3em .4em -.2em rgba(0,0,0,.4);
  pointer-events: none;
}

.uvq05-tt .bar {
  position: absolute;
  left: .4em;
  right: .4em;
  top: 1.7em;
  z-index: 2;
  height: .5em;
  border-radius: .2em;
  background: linear-gradient(color-mix(in srgb,var(--c1) 55%,#fff),var(--c1));
  box-shadow: 0 .2em .3em rgba(0,0,0,.3);
  pointer-events: none;
}

.uvq05-tt label {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: .75em;
  cursor: pointer;
}

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

.uvq05-tt input:checked {
  counter-increment: uvq05-tt;
}

.uvq05-tt .tb {
  position: relative;
  display: block;
  width: 1.35em;
  height: 5.4em;
  border-radius: .15em .15em .7em .7em;
  overflow: hidden;
  background: linear-gradient(90deg,rgba(255,255,255,.6),rgba(255,255,255,.1) 35%,rgba(255,255,255,0) 60%,rgba(255,255,255,.35)),color-mix(in srgb,var(--c2) 40%,transparent);
  box-shadow: inset 0 0 0 1.5px color-mix(in srgb,var(--fg) 28%,transparent);
  transition: transform calc(0.4s / var(--k)) cubic-bezier(.34,1.56,.64,1);
}

.uvq05-tt .lq {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 0;
  background: linear-gradient(90deg,color-mix(in srgb,var(--l) 78%,#000),var(--l) 40%,color-mix(in srgb,var(--l) 70%,#fff));
  transition: height calc(0.8s / var(--k)) cubic-bezier(.22,1,.36,1);
}

.uvq05-tt .lq::before {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  top: -.15em;
  height: .3em;
  border-radius: 50%;
  background: color-mix(in srgb,var(--l) 55%,#fff);
}

.uvq05-tt .bu {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 68%;
  background: radial-gradient(circle,rgba(255,255,255,.85) 0 .07em,transparent .09em) 30% 0/.6em 1.6em,radial-gradient(circle,rgba(255,255,255,.7) 0 .05em,transparent .07em) 75% 0/.5em 2.2em;
  opacity: 0;
  transition: opacity calc(0.3s / var(--k)) cubic-bezier(.25,.1,.25,1);
  animation: uvq05-ttb calc(1.6s / var(--k)) linear infinite;
}

.uvq05-tt .nm {
  font-size: .66em;
  font-weight: 600;
  color: color-mix(in srgb,var(--fg) 58%,transparent);
  transition: color calc(0.3s / var(--k)) cubic-bezier(.25,.1,.25,1);
}

.uvq05-tt label:hover .tb {
  transform: translateY(-.2em) rotate(-3deg);
}

.uvq05-tt label:active .tb {
  transform: scale(.94);
}

.uvq05-tt input:checked+.tb .lq {
  height: 72%;
}

.uvq05-tt input:checked+.tb .bu {
  opacity: 1;
  transition-delay: calc(0.5s / var(--k));
}

.uvq05-tt input:checked~.nm {
  color: var(--fg);
  font-weight: 800;
}

.uvq05-tt input:focus-visible+.tb {
  outline: 2px solid var(--c1);
  outline-offset: 3px;
}

.uvq05-tt .ct {
  margin: .8em 0 0;
  font-size: .8em;
  color: color-mix(in srgb,var(--fg) 58%,transparent);
}

.uvq05-tt .n::before {
  content: counter(uvq05-tt);
  font-weight: 800;
  color: var(--fg);
}

@keyframes uvq05-ttb {
  to {
    background-position: 30% -1.6em,75% -2.2em;
  }
}

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

export default function FTestTubes() {
  return (
    <>
      <style>{css}</style>
      <div
        style={{
          "--c1": "#475569",
          "--c2": "#dbeafe",
          "--s": "16px",
          "--k": "1",
          "--fg": "#1d1d1f",
          "--bg": "#f5f5f7",
        } as CSSProperties}
      >
        <fieldset className="uvq05-tt"><legend>Flavours</legend><div className="rk"><label style={{ "--l": "#ff4d6d" } as CSSProperties}><input type="checkbox" checked={true} /><span className="tb" aria-hidden="true"><i className="lq"></i><i className="bu"></i></span><span className="nm">Strawberry</span></label><label style={{ "--l": "#2ec4b6" } as CSSProperties}><input type="checkbox" /><span className="tb" aria-hidden="true"><i className="lq"></i><i className="bu"></i></span><span className="nm">Mint</span></label><label style={{ "--l": "#ffb703" } as CSSProperties}><input type="checkbox" /><span className="tb" aria-hidden="true"><i className="lq"></i><i className="bu"></i></span><span className="nm">Mango</span></label><label style={{ "--l": "#5a4fcf" } as CSSProperties}><input type="checkbox" checked={true} /><span className="tb" aria-hidden="true"><i className="lq"></i><i className="bu"></i></span><span className="nm">Blueberry</span></label><label style={{ "--l": "#9bc53d" } as CSSProperties}><input type="checkbox" /><span className="tb" aria-hidden="true"><i className="lq"></i><i className="bu"></i></span><span className="nm">Pistachio</span></label><i className="bar" aria-hidden="true"></i></div><p className="ct"><span>Flavours chosen:</span> <span className="n"></span></p></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 “Test tube flavour filter” block (Filters) from AIMRAN Library to my project.

## What it is
A lab test tube rack: each flavour you pick fills its tube with coloured liquid and rising bubbles.

## Chosen settings
- Main color: #475569
- Secondary color: #dbeafe
- Size: 16px (from 12 to 24px)
- Speed: 1x (from 0.5 to 2x)
- Text: "Sabores"

## 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 = `
.uvq05-tt {
  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;
  width: 17em;
  counter-reset: uvq05-tt;
}

.uvq05-tt legend {
  padding: 0;
  margin: 0 0 .8em;
  font-weight: 700;
}

.uvq05-tt .rk {
  position: relative;
  display: flex;
  justify-content: space-around;
  padding: .7em .4em .6em;
  border-radius: .9em;
  background: color-mix(in srgb,var(--fg) 6%,transparent);
}

.uvq05-tt .rk::after {
  content: "";
  position: absolute;
  left: .4em;
  right: .4em;
  bottom: 1.95em;
  height: .45em;
  border-radius: .2em;
  background: linear-gradient(color-mix(in srgb,var(--c1) 60%,#fff),var(--c1));
  box-shadow: 0 .3em .4em -.2em rgba(0,0,0,.4);
  pointer-events: none;
}

.uvq05-tt .bar {
  position: absolute;
  left: .4em;
  right: .4em;
  top: 1.7em;
  z-index: 2;
  height: .5em;
  border-radius: .2em;
  background: linear-gradient(color-mix(in srgb,var(--c1) 55%,#fff),var(--c1));
  box-shadow: 0 .2em .3em rgba(0,0,0,.3);
  pointer-events: none;
}

.uvq05-tt label {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: .75em;
  cursor: pointer;
}

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

.uvq05-tt input:checked {
  counter-increment: uvq05-tt;
}

.uvq05-tt .tb {
  position: relative;
  display: block;
  width: 1.35em;
  height: 5.4em;
  border-radius: .15em .15em .7em .7em;
  overflow: hidden;
  background: linear-gradient(90deg,rgba(255,255,255,.6),rgba(255,255,255,.1) 35%,rgba(255,255,255,0) 60%,rgba(255,255,255,.35)),color-mix(in srgb,var(--c2) 40%,transparent);
  box-shadow: inset 0 0 0 1.5px color-mix(in srgb,var(--fg) 28%,transparent);
  transition: transform calc(0.4s / var(--k)) cubic-bezier(.34,1.56,.64,1);
}

.uvq05-tt .lq {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 0;
  background: linear-gradient(90deg,color-mix(in srgb,var(--l) 78%,#000),var(--l) 40%,color-mix(in srgb,var(--l) 70%,#fff));
  transition: height calc(0.8s / var(--k)) cubic-bezier(.22,1,.36,1);
}

.uvq05-tt .lq::before {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  top: -.15em;
  height: .3em;
  border-radius: 50%;
  background: color-mix(in srgb,var(--l) 55%,#fff);
}

.uvq05-tt .bu {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 68%;
  background: radial-gradient(circle,rgba(255,255,255,.85) 0 .07em,transparent .09em) 30% 0/.6em 1.6em,radial-gradient(circle,rgba(255,255,255,.7) 0 .05em,transparent .07em) 75% 0/.5em 2.2em;
  opacity: 0;
  transition: opacity calc(0.3s / var(--k)) cubic-bezier(.25,.1,.25,1);
  animation: uvq05-ttb calc(1.6s / var(--k)) linear infinite;
}

.uvq05-tt .nm {
  font-size: .66em;
  font-weight: 600;
  color: color-mix(in srgb,var(--fg) 58%,transparent);
  transition: color calc(0.3s / var(--k)) cubic-bezier(.25,.1,.25,1);
}

.uvq05-tt label:hover .tb {
  transform: translateY(-.2em) rotate(-3deg);
}

.uvq05-tt label:active .tb {
  transform: scale(.94);
}

.uvq05-tt input:checked+.tb .lq {
  height: 72%;
}

.uvq05-tt input:checked+.tb .bu {
  opacity: 1;
  transition-delay: calc(0.5s / var(--k));
}

.uvq05-tt input:checked~.nm {
  color: var(--fg);
  font-weight: 800;
}

.uvq05-tt input:focus-visible+.tb {
  outline: 2px solid var(--c1);
  outline-offset: 3px;
}

.uvq05-tt .ct {
  margin: .8em 0 0;
  font-size: .8em;
  color: color-mix(in srgb,var(--fg) 58%,transparent);
}

.uvq05-tt .n::before {
  content: counter(uvq05-tt);
  font-weight: 800;
  color: var(--fg);
}

@keyframes uvq05-ttb {
  to {
    background-position: 30% -1.6em,75% -2.2em;
  }
}

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

export default function FTestTubes() {
  return (
    <>
      <style>{css}</style>
      <div
        style={{
          "--c1": "#475569",
          "--c2": "#dbeafe",
          "--s": "16px",
          "--k": "1",
          "--fg": "#1d1d1f",
          "--bg": "#f5f5f7",
        } as CSSProperties}
      >
        <fieldset className="uvq05-tt"><legend>Flavours</legend><div className="rk"><label style={{ "--l": "#ff4d6d" } as CSSProperties}><input type="checkbox" checked={true} /><span className="tb" aria-hidden="true"><i className="lq"></i><i className="bu"></i></span><span className="nm">Strawberry</span></label><label style={{ "--l": "#2ec4b6" } as CSSProperties}><input type="checkbox" /><span className="tb" aria-hidden="true"><i className="lq"></i><i className="bu"></i></span><span className="nm">Mint</span></label><label style={{ "--l": "#ffb703" } as CSSProperties}><input type="checkbox" /><span className="tb" aria-hidden="true"><i className="lq"></i><i className="bu"></i></span><span className="nm">Mango</span></label><label style={{ "--l": "#5a4fcf" } as CSSProperties}><input type="checkbox" checked={true} /><span className="tb" aria-hidden="true"><i className="lq"></i><i className="bu"></i></span><span className="nm">Blueberry</span></label><label style={{ "--l": "#9bc53d" } as CSSProperties}><input type="checkbox" /><span className="tb" aria-hidden="true"><i className="lq"></i><i className="bu"></i></span><span className="nm">Pistachio</span></label><i className="bar" aria-hidden="true"></i></div><p className="ct"><span>Flavours chosen:</span> <span className="n"></span></p></fieldset>
      </div>
    </>
  );
}
```

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