Skip to content
animorio
IT
All components

Size guide

Tables, Hover, TextGSAP, CSS onlyMediumCompressed weight: Demo 6.7 KBGSAP 28 KBFreeDownload the zip

The size guide of a made-up knitwear shop, Northmere: a clean table of sizes XS to XL with chest, waist and hip measurements. The cm / in switch slides its thumb on a spring and rolls every number to the other unit, column by column; the «Your chest» slider lights up the right size with a blue band that slides onto it, dims the others and says «Your size: M», and near the line between two sizes the band stretches over both rows and suggests the larger one. Minimal style.

The code

A folder that runs on its own: index.html, style.css, script.js and the libraries from a CDN. The React and Vue tabs hold the same demo as a ready component, which switches its animations off when it leaves the page.

<!doctype html>
<!--
  "Size guide" from Animorio · https://animorio.com
  License: free on your own sites and your clients’ sites, paid work included.
  Not for resale, redistribution, templates or code collections · https://animorio.com/en/license/
-->
<html lang="en">
<head>
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width, initial-scale=1">
  <title>Size guide</title>
  <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@fontsource-variable/instrument-sans@5.3.0/index.css">
  <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@fontsource-variable/fraunces@5.3.0/index.css">
  <link rel="stylesheet" href="style.css">
</head>
<body>
  <main class="stage" data-stage>
    <!-- the size guide of a made-up knitwear shop: cm / in rolls every number, and the chest slider lights up the
         right row with a band that slides, or stretches over two rows when you are between sizes -->
    <section class="guide" aria-labelledby="guide-title" data-guide>
      <header class="guide__head">
        <div>
          <h2 class="guide__title" id="guide-title">Size guide</h2>
          <p class="guide__sub">Northmere merino crew · regular fit</p>
        </div>
        <div class="unit" role="radiogroup" aria-label="Units" data-unit>
          <span class="unit__thumb" aria-hidden="true" data-thumb></span>
          <button class="unit__opt is-on" type="button" role="radio" aria-checked="true" data-u="cm">cm</button>
          <button class="unit__opt" type="button" role="radio" aria-checked="false" data-u="in">in</button>
        </div>
      </header>

      <div class="table" role="table" aria-label="Body measurements by size" data-table>
        <div class="row row--head" role="row">
          <span role="columnheader">Size</span><span role="columnheader">Chest</span><span role="columnheader">Waist</span><span role="columnheader">Hips</span>
        </div>
        <div class="rows" data-rows>
          <span class="band" aria-hidden="true" data-band><span class="band__edge" data-edge></span></span>
        </div>
      </div>

      <div class="fit">
        <div class="fit__top">
          <label class="fit__label" for="chest">Your chest</label>
          <span class="fit__value" aria-hidden="true"><span class="roll" data-chestval></span><span class="fit__unit" data-chestunit>cm</span></span>
        </div>
        <div class="slider" data-slider>
          <span class="slider__track" aria-hidden="true"><span class="slider__fill" data-fill></span><span class="slider__ticks" data-ticks></span></span>
          <input class="slider__input" id="chest" type="range" min="80" max="120" step="0.5" value="92" data-chest>
          <span class="slider__knob" aria-hidden="true" data-knob></span>
        </div>
        <p class="verdict" aria-live="polite" data-verdict></p>
      </div>
    </section>
  </main>

  <script src="https://cdn.jsdelivr.net/npm/gsap@3.15.0/dist/gsap.min.js"></script>
  <script src="script.js"></script>
</body>
</html>

Playground

Change values, colours and text with the controls and watch the animation respond live. Or write in the code yourself. Then download the folder with your changes.

23 values to change

Works with Claude, Claude Code, ChatGPT, Cursor, VS Code, Windsurf, Codex, Gemini CLI

Or ask your AI assistant for it

With the Animorio connector, Claude Code, ChatGPT, Cursor or VS Code take it from here, guide included, and fit it into your project. Paste this request:

Take “Size guide” from Animorio and fit it into my site
Platform licenseFree on your sites and your clients’ sites. Want it inside a website builder, a template platform or a client dashboard? There’s a license for agencies and platforms.

What it does

On a white background a card with «Size guide» in a serif face and «Northmere merino crew · regular fit» below; on the right the cm / in switch. Below, the table: the Size, Chest, Waist and Hips columns and five rows, XS to XL, with measurements in centimetres (for M chest 96–103, waist 82–89, hips 100–107), separated by hairlines. Tapping «in» slides the switch’s white thumb with a small bounce and every number rolls into inches, first the chest column, then waist, then hips, row after row. At the bottom the «Your chest» slider with its value rolling beside it: dragging it, a light blue band with a blue left edge slides onto the row of the right size, the other rows dim and «Your size: M» appears below. Near the line between two sizes, marked by a tick on the track, the band stretches over both rows and the line reads «Between M and L: size up to L for a relaxed fit». Left alone, the guide moves by itself: the slider glides, stops between two sizes, switches to inches and back.

How it works

Measurements in centimetres, always

The data is in centimetres as [from, to] pairs for chest, waist and hips; inches are worked out on the fly (cm / 2.54, to one decimal), so there aren’t two tables to keep in step. The slider works in centimetres too: only what you read changes.

The number roller

Each cell holds a single span, inside a one-line window with hidden overflow. To change unit a timeline sends it up by 100% as it fades, swaps the text and brings it up from below with back.out; the delay is (column × 3 + row) × ROLL_STAGGER, so the change sweeps across the table diagonally.

The band that slides and stretches

The band is a single element, absolute inside the table body. The row (or two rows) of the size is worked out from the value and y and height go to the first row’s offsetTop and the last row’s bottom with back.out(SPRING): between two sizes the same band stretches over both rows instead of jumping.

Between two sizes

The lines sit halfway between the end of one size and the start of the next (87.5, 95.5, 103.5, 111.5 cm), shown as ticks on the track. If the chest is within BETWEEN centimetres of a line the result is the pair of sizes, and the line suggests the larger one.

A real slider underneath

Under the drawn knob there’s a real, transparent range input: keyboard, screen readers and touch work on their own; the script reads the value and moves the knob, the fill and the ticks.

Values to change

NameFileDefaultWhat it changes
SLIDEscript.js0.55The seconds the band takes to slide to the right row.
SPRINGscript.js1.5How far the band and the switch go past their place as they land (back.out).
ROLLscript.js0.42The seconds a number takes to roll to the other unit.
ROLL_STAGGERscript.js0.025The seconds between one number and the next as they roll.
BETWEENscript.js1How close to the line between two sizes counts as «between», in cm.
DIMscript.js0.42How faint the other rows go, from 0 to 1.
STARTscript.js92The chest the slider starts on, in cm.

Try them in the Playground

When to use it

On a clothing, shoe or accessory product page, in a «Size guide» window beside the size picker, or on the shop’s sizing page.

On phones

The card takes almost the full width, the rows get shorter with the screen height and the type goes down to 13 pixels; the slider drags with a finger.

With reduced motion

The numbers change unit without rolling, the band goes straight to the right row and the guide doesn’t move by itself.

Pitfalls

  • The drawn knob and the range input’s real thumb don’t match at the edges: the knob moves between 11 pixels and the width minus 11, like the native thumb, and the input stays transparent on top.
  • Some typefaces’ tabular figures look like a monospace: Instrument Sans keeps them true to its design and aligned in columns.

Libraries

GSAP 3.15.0, Instrument Sans (font variabile) 5.3.0, Fraunces (font variabile) 5.3.0.

Compressed with gzip, the three demo files weigh 6.7 KB; the libraries: GSAP 28 KB.

Testing

Tested on 20 November 2026

  • Desktop: Done
  • Phone: Done
  • Reduced motion: Done
  • Safari on iPhone: To do

License

Use it in your own projects and in your clients’ projects. Do not resell it or redistribute it as is. GSAP stays under its own Standard license. Full license.

All components