Skip to Content
BBRICKSv0.7.4
KitPatterns

TodoItem

One to-do: a link to the view that answers it (#view/tab), drawn as the mock's .todo row: a tinted icon square, the sentence, an arrow. A link, not a button: it goes somewhere, and keeps the component pure.

import { TodoItem } 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 TodoItem. Written in docs/content/components/TodoItem.md; the props above are read from the code, which wins where the two disagree.

One row of Home's "What needs you" list: a tinted icon square, a sentence and an arrow, linking to the view that answers it; put several inside TodoItems in a card.

It is the mock's .todo row (padding 12 14, 1px line, radius 16, white). Each item is a link, not a button: it goes to the screen and tab that resolve it (#payments/wallet, #creators/requests). TodoItems is the <ul> around them with 10px gaps.

Anatomy

  1. List: ul.kit-todos (from TodoItems), flex column, 10px gap.
  2. Row link: a.kit-todo, flex, 14px gap, --line border, radius 16, --card.
  3. Icon square: .kit-ic, 38px, radius 12, tint + ink from tone, 18px stroke icon.
  4. Sentence: your children; bold the count or the key fact.
  5. Arrow: .kit-todo-go "→", --ink-3, aria-hidden, mirrored in RTL.

Variants

toneIcon squareWhen to use
rasp--rasp-50 / --raspMoney or urgent (wallet low).
sky--sky / --sky-inkWaiting on someone else (invites).
lime--lime-50 / --oliveGrowth (join requests).
butter--butter / --butter-inkPending approval (challenge requests).

States

StateTrigger
Default—
Hoverborder --rasp-100, background #FFFBFC.
Pressedmoves 1px down (none under reduced motion).
Focus-visiblekit focus ring.
Long textwraps; icon and arrow stay centred.

Types

TodoItems: children: ReactNode (required).

Usage

// Brand › Home › To-do card
<Card title="What needs you">
  <TodoItems>
    <TodoItem icon="wallet" tone="rasp" href="#payments/wallet">Your wallet is <b>low (17% left)</b>. 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"><b>1 challenge request</b> is waiting for TRNDR approval</TodoItem>
  </TodoItems>
</Card>

Where it appears

  • Brand › Home › To-do list card (BrandHome).

Guidelines

Do

  • One sentence per item, the count in bold, the consequence after it.
  • Order by urgency; hide items with nothing to do.

Don't

  • Don't use a TodoItem to run an action in place; link to the screen that does it.
  • Don't show more than ~5 items.

RTL and Arabic

  • Icon at the inline start, arrow at the end and flipped (scaleX(-1)) in RTL.

Tokens

--card, --line, --ink, --ink-3, --rasp-100, --focus-ring; tone pairs --rasp-50/--rasp, --sky/--sky-ink, --lime-50/--olive, --butter/--butter-ink.

Accessibility

  • Each row is a real link inside a list item; its name is the sentence (icon and arrow are decorative).
  • Visible focus ring; hover and press feedback are not the only cue.

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 · TodoItems · Accordion · HeroCard · KeyValue

Source

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

On this page