Skip to Content
BBRICKSv0.7.4
KitPatterns

TodoItems

The to-do list: an <ul> of TodoItems (the mock's .todo, gap 10).

import { TodoItems } from '@ergasti/bricks';

Examples

To-do list

Links that say what needs attention; each has an icon and a tone.

Code
import { TodoItem, TodoItems } from '@ergasti/bricks';

function Todo() {
  return (
    <div style={{ maxWidth: 520 }}>
      <TodoItems>
        <TodoItem icon="wallet" tone="rasp" href="#">Your wallet is <b>low (17% left)</b>. Top up so coupons keep working.</TodoItem>
        <TodoItem icon="mail" tone="sky" href="#"><b>17 invites</b> are waiting for a creator’s reply</TodoItem>
        <TodoItem icon="user" tone="lime" href="#"><b>6 join requests</b> are with the TRNDR team for review</TodoItem>
        <TodoItem icon="flag" tone="butter" href="#"><b>1 challenge request</b> is waiting for TRNDR approval</TodoItem>
      </TodoItems>
    </div>
  );
}

Props

Prop

Type

Design guidance

How the BRICKS design system uses TodoItems. Written in docs/content/components/TodoItems.md; the props above are read from the code, which wins where the two disagree.

The to-do list wrapper: an unstyled <ul> that stacks TodoItem rows with 10px gaps; use it whenever you show more than one to-do, usually inside a Card with a header.

It is the mock's .todo container on Brand Home ("To-do list · 4 things worth a look today", the card beside the seat gauge). It adds list semantics and spacing only; the rows, their tones and their links are TodoItem's. It renders whatever children you give it, so pass TodoItem elements (each is an <li>).

Anatomy

  1. List (.kit-todos, <ul>): flex column, gap 10, no margin, no padding, no bullets.
  2. Rows (children): TodoItem <li>s, each an <a class="kit-todo"> with a tinted 38px icon square (.kit-ic), the sentence and a "→" (.kit-todo-go, aria-hidden).

Variants

TodoItems has none. Each child TodoItem takes tone:

TodoItem toneIcon squareUse when (Brand Home)
'rasp'--rasp-50 fill, --rasp inkMoney that needs action (wallet low).
'sky'--sky fill, --sky-ink inkWaiting on creators (invites).
'lime'--lime-50 fill, --olive inkWaiting on TRNDR review (join requests).
'butter'--butter fill, --butter-ink inkApprovals pending (challenge request).

States

  • List: static; with one child it is a one-row list.
  • Empty: with no children it renders an empty <ul> (no message): render an empty state (EmptyView or a sentence) instead of the list.
  • Row hover: border --rasp-100, background #FFFBFC; active moves 1px down (off with reduced motion); focus-visible shows the kit focus ring.
  • Long text: the sentence wraps; the arrow stays at the end.

Types

TodoItem (for reference): icon: IconName, tone: 'rasp' | 'sky' | 'lime' | 'butter', href: string (passed through safeHref), children: ReactNode; all required.

Usage

// Brand › Home › "To-do list" card (beside the seat gauge)
<Card>
  <Card.Header title="To-do list" sub="4 things worth a look today" />
  <TodoItems>
    <TodoItem icon="wallet" tone="rasp" href="#payments/wallet">
      Your wallet is <Strong tone="bad">low (17% left)</Strong>. Top up so coupons keep working.
    </TodoItem>
    <TodoItem icon="mail" tone="sky" href="#creators/invitations"><b>17 invites</b> are waiting for a creator’s reply</TodoItem>
    <TodoItem icon="user" tone="lime" href="#creators/requests"><b>6 join requests</b> are with the TRNDR team for review</TodoItem>
    <TodoItem icon="flag" tone="butter" href="#motivation/challenges"><b>1 challenge request</b> is waiting for TRNDR approval</TodoItem>
  </TodoItems>
</Card>
// Built from data, with an empty state
{todos.length > 0 ? (
  <TodoItems>
    {todos.map((t) => <TodoItem key={t.href} icon={t.icon} tone={t.tone} href={t.href}>{t.text}</TodoItem>)}
  </TodoItems>
) : (
  <p className="kit-hint">Nothing needs you today.</p>
)}

Where it appears

  • Brand › Home › "To-do list" card, second row next to the seat usage gauge (mock P.home, .todo). Gallery screen home; screen Home.

Guidelines

Do

  • Keep to about four rows, most urgent first (money, then people waiting).
  • Wrap it in a Card with a header that says how many things need a look.
  • Use only TodoItem children, so every <li> is a link row.

Don't

  • Don't put buttons or plain text directly in it: the <ul> expects <li> children.
  • Don't use it for a feed of past events: use Timeline or AuditLogList.
  • Don't nest lists inside a row.

RTL and Arabic

  • Rows mirror: icon on the right, arrow on the left and flipped (scaleX(-1)).
  • Arabic copy from Home: "المطلوب منك", "4 حاجات تستاهل تبص عليها النهارده", "17 دعوة مستنية رد صانع المحتوى".
  • Arabic sentences run longer; let them wrap rather than truncating.

Tokens

List: none (layout only). Rows: --line, --card, --ink, --ink-3, --rasp-100, --rasp-50, --rasp, --sky, --sky-ink, --lime-50, --olive, --butter, --butter-ink, --focus-ring.

Accessibility

  • A real <ul> of <li>s, so screen readers expose it as a list with its item count. (Safari/VoiceOver drops list semantics when list-style: none is set without role="list"; the library does not add the role.)
  • Each row is one link (<a href>) whose name is the sentence; the icon and the arrow are decorative.
  • Links, not buttons: they navigate. Tab moves row to row; Enter follows.
  • The visible focus ring comes from the kit's shared :focus-visible rule.

Found in the source

  • ARIA attributes set: aria-hidden.

Read from the component's source and tests. See Accessibility for the patterns the library follows.

See also: Icon · Accordion · HeroCard · KeyValue

Source

src/kit/patterns/TodoItem.tsx (line 11) on GitHub.

On this page