Components¶
Every reusable UI primitive in frontend/components/ui/. These are theme-aware, presentation-only — no service calls, no business logic. Feature composites belong in higher-level folders (components/auth/, components/chat/, etc.).
This page is the catalog. For implementation details (the makeStyles(theme) factory pattern, how useTheme() flows in), see Frontend → Architecture.
Foundational¶
md border radius.
surfaceContainerHighest and label to primary — no border swap.
sm radius. Distinct from SelectableChip (the pressable toggle).
{ icon, label, tint? }). The single source for the location / people / category / time meta lines on cards; replaces the inline <Ionicons> + <Text> repetition.
+N overflow ({ tags, getLabel?, max? }). Used wherever a truncated tag list is shown.
{ label, selected?, onPress? }). Gold fill when selected, pill radius. Distinct from Chip: Chip is a passive status tag, SelectableChip is a pressable toggle. Renamed from the old planner/Chip.
{ options, value, onChange, labels }), generic over a string-literal union. The active tab sinks to the page background for an inset feel. Use this + a conditional pane render for an in-page 2/N-way toggle — never react-native-tab-view (its web pager lays panes side-by-side and clips).
{ icon, size=36, iconSize=20, color?, bg? }): rounded-square, radius 12, glyph on primary at 10%. Every leading icon-circle (SettingsRow, InfoRow) routes through it; don't hand-roll another.
{ icon, size=84, color? }): an outer solid ring around an inner dashed ring with a centred glyph, no fill. One source of truth for the welcome-screen slides, the error boundary, and every EmptyState, so the stamp reads identically wherever it appears. Colour is the accent only; never tilt or fill it.
Page shell¶
The three nested width caps every screen composes. Details: Frontend → Routing.
components/layout/). Desktop constrains to maxWidth 900 centered; mobile is a flex-1 passthrough. Always transparent so the app backdrop shows through.
children is a render-prop giving the screen { onScroll, scrollEventThrottle, scrollRef } to spread onto its list. On desktop it renders content only; the sidebar + a global header (via useSetPageHeader) own title/actions. Never hand-roll a top bar.
{ maxWidth=640, style }, paddingHorizontal:16). Default 640 for settings/detail; pass 420 for forms. Width tiers are 900 / 640 / 420 only.
react-native-keyboard-controller): a focused input scrolls above the keyboard identically on iOS and Android. Drops into Page's render-prop seam (onScroll/scrollEventThrottle); web falls back to Animated.ScrollView. Sheets use TrueSheet's native handling instead; never nest a keyboard-controller view inside a TrueSheet.
Cards & rows¶
The shared card + row + metadata vocabulary. Every screen composes these; there are no bespoke event/plan/place/settings cards left.
{ children, leading?, onPress? }), radius 16, background via cardSurface(theme). Its boundary is a surface-ladder tonal step, never a stroke (the no-line rule). leading steps one tone brighter for lift. Both the event and plan canvases route their cards through it.
variant="tile"|"hero"|"row" (browse tile / next-up hero / agenda row). Every surface-specific field is an optional slot. Search, horizon, and profile all use it; a plan renders as a tile fed plan data through the generic slots (the old plan-fold). No bespoke event or plan cards.
leading thumb and icon preset are mutually exclusive; surface frames the row: 'card' (default) is a standalone AccentCard; 'flat' keeps the padding but drops the surface/radius/hairline so stacked results read as one whitespace-separated list (used by LocationRow); 'none' drops the padding too, for embedding inside a card or band (used by PlaceCard).
{ icon?, title, subtitle?, onPress?, value?, trailing?, danger?, disabled? }). Leading IconChip. Chevron shows only when onPress && !trailing (value rows keep their chevron); toggle rows pass trailing={<Toggle/>}. Replaced the per-screen nav/preference rows.
{ label, value, last? }): small-caps label left, value (string or node) right. Used for account/detail readouts.
{ uri, name, handle?, size=44, trailing?, onPress?, href? }): avatar + name + @handle, name always 16/semibold. Friends, chat pickers, any people list. Delegates the avatar to UserAvatar.
{ people, size=24, max=4, overflowCount? }) with a surface-colored ring so overlaps read as separate circles, plus a trailing +N bubble. What EventCard's attendee foot uses.
Form fields & pickers¶
The components/ui/fields/ kit + the shared pickers. Compose these instead of raw TextInput/picker plumbing.
{ label?, required?, error?, children }): optional uppercase caption with a red * when required, optional error text below.
DetailRow + optional muted hint carrying one inline text-link ({ label, value, hint?, link? }).
SelectionSheet ({ label?, icon, value, placeholder, options, onSelect, searchable? }). section options render as non-interactive dividers.
{ label?, value, onSave, validate?, multiline? }); reveals revert/confirm only once dirty and flashes a check on save. Adopts an external value change only when the draft is clean.
Popover menu with a checkmark on the selected option), { value, options, onChange, width? }. Presentational: the caller supplies options. Used by capture, event, and plan. Replaced the old VisibilityChip. Note: the control is shared, but event (3 options) and plan/moment (4 options) still differ on the option set (a deferred product decision).
Layout & containers¶
{ icon, label?, value, sub? }), with optional colour overrides for non-theme surfaces (e.g. a dark hero). The read-only metadata row on the event card and public event view.
{ day, month, active? }); active gives the "today" primary fill. Used in event list rows.
expo-blur on native, CSS backdrop-filter on web. Use sparingly — every glass surface is a moment.
isNavHidden via SheetContext). Pair with rich content that wants the full screen.
header + floating footer chrome; the consumer provides the body via SheetView (auto-height content) or SheetScrollView (a fixed-height detent's scroll region) — both apply the standard 24px gutter and hasFooter clears the floating footer. height is auto or a detent array (e.g. [0.5, 1]); never auto when content can exceed the viewport (auto has no scroll region). footerBare renders the footer as-is; footerOptions.keyboardOffset tunes keyboard avoidance.
right) or several (rightActions, ~46px each); a single action can full-swipe to fire. Snaps open and holds until tapped or another row opens. Built on Reanimated + gesture-handler.
Platform.OS handles dispatch.
Feedback¶
StampMedallion, a tight headline, an optional one-line body, an optional primary CTA + secondary text link, and a compact mode for in-sheet / in-list use. tone is semantic, never decorative: default (primary) for content-empty, error (ember) for failures / not-found, love (#FF3B6B) for likes. Copy is playful and warm, matching the not-found / error pages.
ToastContext. Single queue. Variants: success, warning, error, info.
useConfirm() (planner) and ConfirmSheet; destructive renders the confirm CTA in the danger tone.
Media & social¶
expo-image with memory-disk caching and a stable cacheKey derived from the URL path so cache entries survive base_url drift (DHCP, CDN swap). Pass cacheKey explicitly when the immutable storage key is available directly (e.g. chat metadata.images.keys).
sm, md, lg.
Decorative & motion¶
Composition rules¶
- Use the primitive as-is. If you need a variant, add it to the primitive — don't fork.
- Stylesheet factories. Every component declares
const makeStyles = (theme) => StyleSheet.create({...})at the top. Components readthemeviauseTheme()once and memoize the resulting sheet — the factory runs on theme change, not on every render. - Compose, don't extend. Build feature components by composing primitives. A
ChatMessageBubbleis aViewwrappingUserAvatar+body-lgtext + (optional)Toast-style reaction tray. It doesn't subclass anything.
Buttons and i18n length¶
Translated labels can be 20–40% longer than English (German for compound nouns, Finnish for case suffixes, Polish for long roots). The button primitive uses a three-tier graceful degradation so non-English labels never overrun siblings and almost never truncate with ….
Tier 1 — Standard row (default)¶
Wrap a row of buttons in <ButtonRow> from frontend/components/ui/Button.tsx. Every child is forced to flex: 1, so widths stay matched and side-by-side buttons render at the same font size. The label uses numberOfLines={1} + ellipsizeMode="tail" + flexShrink: 1. (We deliberately do not use adjustsFontSizeToFit — it shrinks each Text independently and produces mismatched font sizes across buttons in a row.)
Tier 2 — Compact size¶
For rows known to be tight even in English ("Accept" / "Decline" + "Block"; "Join" / "Chat" + "Manage"), pass size="compact" to the children. The primitive shrinks font (15→12) and horizontal padding (20→12), buying ~25% horizontal headroom before any stacking kicks in.
<ButtonRow>
<Button size="compact" title={t('friend_detail.message')} ... />
<Button size="compact" title={t('friend_detail.profile')} ... />
<Button size="compact" title={t('common.share')} ... />
</ButtonRow>
Tier 3 — Auto-stack¶
If the natural label widths still wouldn't fit at the container's available width, <ButtonRow> flips to a vertical column (each child rendered full-width). Triggered only when text truly overflows — a small slack threshold prevents cosmetic stacking when labels are at the edge.
Set autoStack={false} if you've already designed for the worst case and want the row to stay horizontal regardless.
Authoring rule¶
Action-button text in feature components (actionBtnText, cancelBtnText, etc.) should follow the same pattern: add flexShrink: 1 to the style and pass numberOfLines={1} ellipsizeMode="tail" on the <Text>. Prefer <Button> + <ButtonRow> over hand-rolled <TouchableOpacity> for any new action surface.
Adding a primitive¶
- Drop the file in
frontend/components/ui/. - Follow the
makeStyles(theme)pattern. No service calls inside, no business logic — just rendering. - Add an entry to this page in the same PR, under the appropriate grouping above. Include: purpose, key variants, sizing if relevant.
- If the new primitive uses a previously-unused color token, also update Color.
- If it introduces a new motion duration or easing, also update Motion.
Storybook?¶
Not today. The catalog above + the source files are the canonical references. A live Storybook is a candidate future addition; for now, pull the component into a temporary playground screen if you need to iterate visually.