Susegad UI Accessibility GitHub

How this site looks

The view settings need JavaScript. Every page reads well without them.

Mood

The same pages, in three moods.

Theme

Components

Now note

A short, dated note of what someone is up to right now, with the availability as a badge in words. It adds how long ago it was updated and, past a stale-after limit, says plainly that it may be out of date. Quiet is a dated line; warm is a sticky note in the hand; playful is a café chalkboard in a wooden frame.

quiet warm playful

Open the live demo npx @susegad/cli add now-note

Stands on: Badge, Core, Core: components, Engine, Tokens

The prompt

the prompt

What someone is up to right now: a studio's current work, a homestay's "open for the season", a restaurant's specials, an office's hours this week.

A line or two, an availability state in words, and the date it was last said, so a reader can tell whether to believe it.

<link rel="stylesheet" href="susegad/components/now-note/now-note.css">
<link rel="stylesheet" href="susegad/components/badge/badge.css">
<script type="module" src="susegad/components/now-note/now-note.js"></script>
<script type="module" src="susegad/components/badge/badge.js"></script>

<sg-now-note stale-after="45">
  <section aria-labelledby="now">
    <h2 id="now">Now</h2>
    <p>Building an order page for a clothing brand in Aldona.</p>
    <p class="sg-now-state"><sg-badge tone="success">Taking on one new project</sg-badge></p>
    <p class="sg-now-updated">Updated <time datetime="2026-09-24">24 September 2026</time></p>
  </section>
</sg-now-note>

The prompt

Make a "now" note web component around a <section>: a small heading, a line or two of what's happening, the availability as a status badge whose words say it ("Taking on one new project", "Heads-down till October"), and "Updated" with a <time datetime>. With JavaScript, add after the date how long ago that was in words (today, yesterday, 3 days ago, 2 weeks ago, 3 months ago), counted by calendar days in the reader's own calendar, and once the note is older than a stale-after number of days (45 by default), add a plain line saying it may be out of date. Give it three registers. Quiet: a dated line under a hairline, the heading in small capitals. Warm: a sticky note in the hand, the highlighter's yellow by day and by night, set on at a small seeded lean with a strip of tape. Playful: a chalkboard outside a café, a slate board in a dark wooden frame whatever the page's theme, the words in chalky handwriting and the heading underlined with a wavy line. Nothing moves.

Words to code

When you sayTechniqueWhat happens
how long ago … in wordspure coreageInWords(then, now) from whole calendar days (daysBetween, UTC day numbers, so no time zone shifts a day); a date in the future says nothing.
older than stale-afterhonestyisStale(then, now, days); an unreadable date counts as stale. The element adds .sg-now-stale and data-stale, and follows a changed stale-after.
the reader's own calendartodayIso()Local year, month and day. A today attribute pins it, for demos and tests.
by day and by night … whatever the page's themecolor-schemeThe sticky note sets color-scheme: light and the board color-scheme: dark, so every token inside resolves to that theme; the tests check their words at 4.5:1 in both palettes.
a small seeded leanlean(seed)0.8 to 2 degrees, set once as --sg-now-lean.
a status badgereuseThe state is <sg-badge>: its words are the meaning and its shape backs up the tone.

Accessibility

  • A section named by its heading; the state is words, not a colour.
  • The age and the stale line are plain text in the section, read in order.
  • Without JavaScript the note shows its date, and a reader can judge its age themselves.

<sg-now-note> is a short, dated "what I'm up to" note with an availability state in words. It enhances a <section> (or an <article>, <aside> or <div>).

Markup

ElementWhat it is
a heading"Now", or the business's own word
<p>what is happening
p.sg-now-state with <sg-badge>availability, in words: "Taking on one new project" (success), "Heads-down till October" (warning), "Booked till March" (neutral)
p.sg-now-updated with <time datetime="YYYY-MM-DD">required: when it was last updated

The element adds , 3 days ago after the date and, past stale-after days, a p.sg-now-stale saying "This note may be out of date."

Attributes

AttributeValuesDefault
stale-afterdays45
todayan ISO date to count from, for demos, tests and printthe reader's today
seedthe warm leanheading and date
registerquiet, warm, playfulinherited

On a static site, the build can also compute the age with ageInWords() and isStale() from now-note.core.js, so a reader without JavaScript sees it. Use one or the other: the element adds its own age line whatever the HTML already says.

Registers

Look
quieta dated line under a hairline
warma sticky note in the hand, with tape, always daylight yellow
playfula café chalkboard in a wooden frame, always dark

Nothing moves.

Accessibility

How this component meets WCAG 2.2 level A and AA, criterion by criterion, how each was checked, and what your page still owns.

  • Meets 9
CriterionStatusHow it was checked
1.1.1 Non-text contentMeetsThe tape, the frame and the chalk are CSS decoration with no words in them; the state is the badge's words ("Taking on one new project") and the date is text. packages/components/now-note/now-note.check.mjs: "without JavaScript: the words, the state in words and the date all show".
1.3.1 Info and relationshipsMeetsA <section> named by its heading, a <time datetime> for the date and the state in a <p>; the element adds the age after the date. now-note.check.mjs: "each note says how long ago, in words", and axe without JavaScript: 0 violations.
1.4.1 Use of colorMeetsAvailability is words ("Taking on one new project", "Heads-down till October", "Booked till March"); the badge's colour backs them up. An old note says "This note may be out of date." in words (now-note.check.mjs, "every note older than 45 days says it may be out of date; no fresh one does").
1.4.3 Contrast (minimum)Meetspackages/components/now-note/now-note.test.js, "AA: <palette>: words on the sticky note and the chalkboard read at 4.5:1 in any theme" (the note and the board keep their own colours in either theme); packages/tokens/tokens.test.js for the plain register. now-note.check.mjs: axe in light and dark, all three registers: 0 violations.
1.4.4 Resize textMeetsManual test, 2026-10-07: demo with the root font size at 200 percent, three registers, no sideways scroll and nothing clipped (throwaway Playwright script).
1.4.10 ReflowMeetsnow-note.check.mjs: "at 390 px the page does not scroll sideways". Manual test, 2026-10-07: demo at 320 CSS px, three registers, no sideways scroll (document width 320).
1.4.11 Non-text contrastMeetsThere is no control and no graphic that carries meaning: state and age are words (packages/components/now-note/now-note.check.mjs, "without JavaScript: the words, the state in words and the date all show").
1.4.12 Text spacingMeetsManual test, 2026-10-07: the WCAG text-spacing values (line height 1.5, letter 0.12em, word 0.16em, paragraph 2em) injected on the demo, three registers, no clipped or overlapping text, including the sticky note and the chalkboard (throwaway Playwright script). No check in the repository asserts it yet.
4.1.2 Name, role, valueMeetsNative elements only, nothing to operate; the section is named by the author's heading. now-note.check.mjs: axe with and without JavaScript, 0 violations.

The page author owns:

  • The heading, the note, the availability words and the date, in the language of the page, and lang on text in another language (3.1.2).
  • The <time datetime> being true, and a stale-after that suits how often the note changes.
  • Using either the element's age line or the build's own ageInWords(), not both.

How it behaves

  • The state is words; the badge's shape and colour back it up.
  • The sticky note and the board keep their own colours in either page theme; their words are tested at 4.5:1.

All 57 tables, and how the library tests