Small elements
The small elements that go with a row or a title: a chip, a filter, a source's or a household's avatar. Like Hodi's captions and metadata, chips are written in the mono font.
Chip
A small capsule of text, for a short piece of information such as a language, a state or a duration.
import { Chip } from 'hodi:sdk'
<Chip tone="success">Active</Chip>childrenReactNodeThe chip's text, in a few words.
tone?'success' | 'warning' | 'danger' | 'accent'The chip's colour: neutral by default, green, yellow, red or in the accent colour.
size?'capsule' | 'row'The chip's size: capsule by default, row at the end of a settings row.
title?stringWhat the chip means, shown on hover.
label?stringA fuller name than the text, for screen readers.
FilterChip
A filter in a row of filters. It is a pill, which turns white when chosen.
import { FilterChip } from 'hodi:sdk'
<FilterChip
selected={filter === 'all'}
count={12}
onClick={() => setFilter('all')}
>
All
</FilterChip>selectedbooleantrue when the filter is chosen.
childrenReactNodeThe filter's text.
onClick?() => voidWhat a click does, for a filter that changes the page without leaving it.
href?stringThe address to open, for a filter that leads to another page.
count?numberThe number of items the filter keeps, shown after the text.
icon?LucideIconA Lucide icon, shown before the text.
disabled?booleanThe filter is greyed out and can't be chosen.
SourceAvatar
A source's icon, taken from its site, or its initials when the site has none. It is never round: round is kept for people and households.
import { SourceAvatar } from 'hodi:sdk'
<SourceAvatar
sourceId={article.sourceId}
sourceName="Le Monde"
size={44}
/>sourceIdstringThe source's id, as an article gives it.
sourceNamestringThe source's name, whose initials the avatar takes when it has no icon.
size?18 | 20 | 22 | 26 | 44The avatar's size, in px. It is 18 by default.
HouseholdAvatar
A household's photo, or its initial when it has no photo. It is round, like a profile on the Who's in? screen.
import { HouseholdAvatar } from 'hodi:sdk'
<HouseholdAvatar
name="Smith"
photo={household.photo}
size={64}
/>namestringThe household's name, whose initial the avatar takes when it has no photo.
photostring | nullThe address of the household's photo (household.photo), or null.
sizenumberThe avatar's width, in px, ring included.
preview?string | nullA photo the person just chose but hasn't sent yet. It shows in place of photo.