Skip to content
animorio
IT
All components

Response length picker

Pickers, HoverGSAP, CSS onlyMediumCompressed weight: Demo 5.3 KBGSAP 28 KBFreeDownload the zip

One picker, one gesture, in the clean style of interface pieces for AI apps: the «Response length» card with three choices, Concise, Balanced and Detailed. On a choice the dark pill glides onto the word and the draft reply below, made of grey lines, grows or shrinks: the new lines are written one after the other by a thin violet caret that lands a pixel too far and settles, the extra ones are taken back from the bottom, the card closes on a spring and the word count rolls.

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>
<!--
  "Response length picker" 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>The response length picker with the lines that grow longer</title>
  <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@fontsource-variable/mona-sans@5.3.0/wdth.css">
  <link rel="stylesheet" href="style.css">
</head>
<body>
  <main class="stage">
    <!-- one gesture: pick how long the assistant should answer, and the draft reply below grows or shrinks to it -->
    <section class="len" data-len aria-labelledby="len-title">
      <header class="len__head">
        <span class="len__title" id="len-title">Response length</span>
        <span class="len__count" aria-live="polite"><span class="len__tilde">about</span> <span data-count>120</span> words</span>
      </header>
      <div class="len__seg" role="radiogroup" aria-labelledby="len-title" data-seg>
        <span class="len__pill" data-pill aria-hidden="true"></span>
        <button class="len__opt" type="button" role="radio" aria-checked="false" tabindex="-1" data-opt><span>Concise</span></button>
        <button class="len__opt" type="button" role="radio" aria-checked="true" tabindex="0" data-opt><span>Balanced</span></button>
        <button class="len__opt" type="button" role="radio" aria-checked="false" tabindex="-1" data-opt><span>Detailed</span></button>
      </div>
      <div class="len__preview" data-preview aria-hidden="true">
        <span class="len__line" data-line></span>
        <span class="len__line" data-line></span>
        <span class="len__line" data-line></span>
        <span class="len__line" data-line></span>
        <span class="len__line" data-line></span>
        <span class="len__line" data-line></span>
        <span class="len__caret" data-caret></span>
      </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.

28 values to change

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 “Response length picker” 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 white, alone in the middle, there is a white card with a thin border: at the top «Response length» and on the right «about 120 words», below it a light grey track with three choices, Concise, Balanced and Detailed, and a dark pill under the chosen one; at the bottom the draft reply, four rounded grey lines with the last one shorter and a thin violet text caret at its end. Choosing Detailed, the pill glides onto the word a pixel too far and the word gains weight; the lines already there stretch, then the caret writes the two new ones one after the other, running to the right, while the card opens a row just before it gets there; at the end the caret goes a pixel past and comes back, and a light sheen runs once over the finished lines. Choosing Concise, the extra lines are taken back to the left from the bottom, one at a time, the card closes on a spring and the second line shortens. The word count rolls to the new figure and narrows a touch. Hovering a choice widens its word on the width axis; pressing it gives a little and comes back. The arrow keys choose too. Until someone touches it, the card changes length by itself.

How it works

Lines in percent

Each length is a list of widths in percent (Concise has two lines, Balanced four, Detailed six): GSAP takes every line to its own, so the draft stays right at any card width with no recalculation.

The caret that writes

On every frame of the timeline the caret looks for the last line that has ink and puts itself at its end: it has no tween of its own, it follows the lines, even when they retract. The new lines are written in a row with sine.inOut, each in a time proportional to its length.

The card opening a moment early

The draft’s height goes to that of the coming line 80 milliseconds before the caret starts it, with back.out: the card opens and the line comes into a space already there. When shortening, the lines leave from the bottom and the height drops once the last one is gone.

The pixel too far

At the end of the writing the caret gets an extra 1.2 pixel shift that goes back to zero on an elastic spring; the pill arrives with back.out and a sheen made with a CSS variable (--sheen-x) runs once over the finished lines.

Values to change

NameFileDefaultWhat it changes
ACCENTscript.js#6a4cffThe colour of the caret that writes the lines.
LABEL_SHORTscript.jsConciseThe first option.
LABEL_MIDscript.jsBalancedThe middle option.
LABEL_LONGscript.jsDetailedThe last option.
WORDS_SHORTscript.js40About how many words a concise reply has.
WORDS_MIDscript.js120About how many words a balanced reply has.
WORDS_LONGscript.js280About how many words a detailed reply has.
WRITEscript.js1How fast the caret writes a new line: 2 twice as fast, 0.5 half.
SPRINGscript.js1How springy the pill and the card are: 0.4 calm, 2 very bouncy.
SPEEDscript.js1The speed of everything: 2 twice as fast, 0.5 half.
HOLDscript.js2.4How many seconds each length stays when the card changes by itself.
AUTOscript.jstrueThe card changes length by itself until someone touches it.

Try them in the Playground

When to use it

In the settings of an AI assistant, in a chat composer or in a tool that summarises texts: whoever chooses sees at once how long the answer will be, before asking for it.

On phones

On the phone the card takes the screen width minus the margins and the lines stay in percent; the inner padding is also measured on the height. There is no hover, everything else is the same.

With reduced motion

The draft fades out and comes back already at the new length, with no lines being written and no springs; the pill and the number take their place at once.

Pitfalls

  • The caret measured with offsetWidth rounds to whole pixels and jumps halfway through the writing: the width must be read with getBoundingClientRect, which has decimals.
  • The extra lines are not hidden with display none: their zero width tells the caret which is the last line with ink, and the card clips them with its height and overflow hidden.
  • The number’s direction (rising from below or dropping from above) must be decided with the previous value: read after the choice has changed, it is already the new one.

Libraries

GSAP 3.15.0, Mona Sans (font variabile) 5.3.0.

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

Testing

Tested on 31 October 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