Skip to content
animorio
IT
All components

Class attendance

Lists, HoverGSAP, CSS onlyMediumCompressed weight: Demo 5.4 KBGSAP 28 KBFreeDownload the zip

The roll call of a class, in a card on white: one row per pupil with three options, “Here”, “Late” and “Away”, and at the top a single bar split by share, green for present, amber for late, red for absent, striped for those still to mark. With every tap the coloured pill appears or slides under the option, the bar re-proportions with a bounce and the counts roll. “Mark all here” marks present everyone not yet marked, one row after another.

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>
<!--
  "Class attendance" 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>Class attendance</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">
    <!-- the roll call of a class: one row per pupil with Here, Late and Away, a bar at the top split in three
         that re-proportions at every tap, the counts rolling, and Mark all here -->
    <section class="ra" data-ra aria-label="Class attendance">
      <header class="ra__head">
        <div class="ra__what"><strong>Year 4B roll call</strong><span>Wednesday morning</span></div>
        <button type="button" class="ra__all" data-all>Mark all here</button>
      </header>

      <div class="ra__sum">
        <div class="ra__bar" aria-hidden="true"><i class="ra__b ra__b--here" data-b="here"></i><i class="ra__b ra__b--late" data-b="late"></i><i class="ra__b ra__b--away" data-b="away"></i><i class="ra__b ra__b--none" data-b="none"></i></div>
        <p class="ra__counts"><span class="ra__c ra__c--here"><b class="ra__clip"><span data-n="here">0</span></b> here</span><span class="ra__c ra__c--late"><b class="ra__clip"><span data-n="late">0</span></b> late</span><span class="ra__c ra__c--away"><b class="ra__clip"><span data-n="away">0</span></b> away</span><span class="ra__c ra__c--none"><b class="ra__clip"><span data-n="none">5</span></b> to mark</span></p>
      </div>

      <ul class="ra__list">
        <li class="ra__pupil" data-pupil data-name="Ada Lund"><strong>Ada Lund</strong><div class="ra__seg" role="radiogroup" aria-label="Ada Lund"><i data-thumb></i><button type="button" role="radio" aria-checked="false" data-v="here">Here</button><button type="button" role="radio" aria-checked="false" data-v="late">Late</button><button type="button" role="radio" aria-checked="false" data-v="away">Away</button></div></li>
        <li class="ra__pupil" data-pupil data-name="Tom Baker"><strong>Tom Baker</strong><div class="ra__seg" role="radiogroup" aria-label="Tom Baker"><i data-thumb></i><button type="button" role="radio" aria-checked="false" data-v="here">Here</button><button type="button" role="radio" aria-checked="false" data-v="late">Late</button><button type="button" role="radio" aria-checked="false" data-v="away">Away</button></div></li>
        <li class="ra__pupil" data-pupil data-name="Mei Sato"><strong>Mei Sato</strong><div class="ra__seg" role="radiogroup" aria-label="Mei Sato"><i data-thumb></i><button type="button" role="radio" aria-checked="false" data-v="here">Here</button><button type="button" role="radio" aria-checked="false" data-v="late">Late</button><button type="button" role="radio" aria-checked="false" data-v="away">Away</button></div></li>
        <li class="ra__pupil" data-pupil data-name="Zoe Klein"><strong>Zoe Klein</strong><div class="ra__seg" role="radiogroup" aria-label="Zoe Klein"><i data-thumb></i><button type="button" role="radio" aria-checked="false" data-v="here">Here</button><button type="button" role="radio" aria-checked="false" data-v="late">Late</button><button type="button" role="radio" aria-checked="false" data-v="away">Away</button></div></li>
        <li class="ra__pupil" data-pupil data-name="Omar Haddad"><strong>Omar Haddad</strong><div class="ra__seg" role="radiogroup" aria-label="Omar Haddad"><i data-thumb></i><button type="button" role="radio" aria-checked="false" data-v="here">Here</button><button type="button" role="radio" aria-checked="false" data-v="late">Late</button><button type="button" role="radio" aria-checked="false" data-v="away">Away</button></div></li>
      </ul>
    </section>
    <span class="live" aria-live="polite" data-live></span>

    <svg class="ghost" data-ghost viewBox="0 0 24 24" aria-hidden="true"><path d="M5 3.200 19.200 11l-6.300 1.600-3.300 5.900Z"></path></svg>
  </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.

40 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 “Class attendance” 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, a rounded card: at the top “Year 4B roll call”, “Wednesday morning” and on the right the dark button “Mark all here”. Below, a thin bar all in grey stripes, and the counts: “0 here”, “0 late”, “0 away” and on the right “5 to mark”. Then five rows, one per pupil: the name and a three-way control, Here, Late, Away, with nothing chosen yet. Tapping “Here” on a row a green pill appears under the option with a small snap, the label turns white, a green stretch is born in the bar pushing the striped one, and the counts roll. “Mark all here” marks the other four one after another, in a cascade: the bar turns all green and “to mark” dims. Switching a row to “Late” the pill slides and turns amber, and a fifth of the bar turns amber; with “Away” it is red. Going back to “Here” the bar puts itself back together. The arrow keys move between the options inside a row.

How it works

One state per pupil

Every row keeps a single word: here, late, away or nothing. Counts and bar come from counting the rows at every tap.

The bar does its own sums

The four parts of the bar sit in a row with `flex`: the script only animates their `flex-grow` up to the number of pupils, and the browser does the proportions.

The pill takes the colour

A CSS variable on the control says the state’s colour: the pill slides and changes tint on the way, with no need for three different pills.

All here, but not all

“Mark all here” only touches those not marked yet: a late or an absence already set stays where it is.

Values to change

NameFileDefaultWhat it changes
HEREscript.js#1f9d6bThe colour of those present.
LATEscript.js#d98a0bThe colour of late arrivals.
AWAYscript.js#d8452fThe colour of those absent.
CASCADEscript.js0.07How many seconds between rows when “Mark all here” runs.
LOOPscript.jstrueLeft alone, the demo’s pointer marks everyone here and then a late and an absence.

Try them in the Playground

When to use it

In a school’s electronic register, in an app for courses, gyms or after-school clubs, in the sign-in sheet of a workshop or a volunteer shift; the same three-way list carries the answers to an invitation (yes, maybe, no), the state of deliveries or the check of a list of things.

On phones

The card is at most 352 pixels wide and about 325 tall. Each row is 40 pixels tall; the three options are 52 pixels wide each (48 under 350) and 24 tall inside a 28-pixel pill. Long names are cut with an ellipsis.

With reduced motion

No snaps, bounces or cascade: the pills appear in place, the bar and the counts change in one step and “Mark all here” marks everyone at once. The demo’s pointer does not start.

Pitfalls

  • The state is not told by colour alone: every option has its word, the counts are written and every choice is announced to screen readers with the pupil’s name.
  • Every row is a radio group labelled with the pupil’s name: without it, three “Here Late Away” in a row do not say whose they are.
  • Animating widths in percent the four stretches would never add up to a hundred mid-move: with `flex-grow` the sum always works.
  • Chosen options have white text on the coloured pill: keep the amber dark enough to hold the contrast.
  • Class and names are invented.

Libraries

GSAP 3.15.0, Mona Sans (font variabile) 5.3.0.

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

Testing

Tested on 2 December 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