App components
The 111 components an app draws with, by what they're for. They're Isolink's own, so an app looks at home on every device, in light and dark.
Import components from isolink by name: import { Screen, Stack, Text, Button } from 'isolink';. Each is controlled by its props; inputs take value and give the new one to onChange. Every component also takes class, style, key, hidden, pad, width, height, disabled, grow and transition (what they do). Space is a step from 0 to 6 (0, 4, 8, 12, 16, 24 and 32 px) or, above 6, px.
Layout
Boxes that place what's inside them.
Box
A plain box. Its children stack downwards; with display: flex in its class they go in a row, with display: grid in columns.
| Prop | Takes | What it does |
|---|---|---|
gap | space | Space between children. Lays them out as a flex box. |
align | start, center, end, stretch | How children line up across. |
justify | start, center, end, between, around, evenly | How children spread along. |
wrap | bool | Children wrap onto more lines. |
center | bool | Puts its content in the middle. |
mark | string | A name useScroll().to(name) scrolls to, such as a letter in an A to Z list. Any component takes it. |
onWidth | (w) => void | How wide it may be, once laid out and again when that changes; for laying things out in rows yourself. Any component takes it. |
cursor | string | The mouse pointer over it: pointer, grab, grabbing, text, move, crosshair, zoom-in, not-allowed… Any component takes it. |
onHover | (over) => void | The mouse came over it (true) or left (false). Any component takes it. |
<Box class={s.card} gap={2}>
<Text variant="title">Monstera</Text>
<Text tone="muted">Every 7 days</Text>
</Box>
Stack
Children one under another.
| Prop | Takes | What it does |
|---|---|---|
gap | space | Space between them. |
align | start, center, end, stretch | Across. stretch by default. |
justify | start, center, end, between, around, evenly | Along. |
wrap | bool | Wrap onto more lines. |
<Stack gap={3}>
<TextField value={name} onChange={setName} placeholder="Name" />
<Button expand onPress={add}>Add</Button>
</Stack>
Row
Children side by side. Give one grow to take the room left.
| Prop | Takes | What it does |
|---|---|---|
gap | space | Space between them. |
align | start, center, end, stretch | Across. center by default. |
justify | start, center, end, between, around, evenly | Along. |
wrap | bool | Wrap onto more lines. |
<Row gap={2}>
<Icon name="eco" tone="accent" />
<Text grow>Monstera</Text>
<Badge count={2} />
</Row>
Grid
Children in equal columns.
| Prop | Takes | What it does |
|---|---|---|
columns | number | How many. Without it, as many as fit min wide. |
min | number | The narrowest a column gets when columns isn't set. 140 by default. |
gap | space | Space between cells. 8 px by default. |
<Grid columns={2} gap={3}>
{timers.map((t) => <Card key={t.id}><Text>{t.name}</Text></Card>)}
</Grid>
Masonry
Columns of different heights, filled in turn so the order reads across, like a board of notes. A long press drags one to a new place.
| Prop | Takes | What it does |
|---|---|---|
columns | number | How many. Without it, as many as fit min wide, up to 6. |
min | number | The narrowest a column gets. 150 by default. |
gap | space | 12 px by default. |
onReorder | (id, index) => void | One was dragged to index. Give each child an id (or key). |
onHold | (id) => void | One was held and let go without moving: open its menu. |
<Masonry columns={2} onReorder={move} onHold={menu}>
{notes.map((n) => (
<StickyNote key={n.id} id={n.id} color={n.color} onPress={() => open(n.id)}>
<Markdown text={n.body} />
</StickyNote>
))}
</Masonry>
Spacer
Empty space. Inside a Row or Stack it takes the room left.
| Prop | Takes | What it does |
|---|---|---|
size | space | A fixed size instead. |
<Row>
<Text>Total</Text>
<Spacer />
<Text bold>£12.40</Text>
</Row>
Divider
A thin line.
| Prop | Takes | What it does |
|---|---|---|
space | space | Room it takes up and down. |
<Divider space={4} />
Scroll
Its children scroll, for a strip wider than the screen. A screen scrolls already.
| Prop | Takes | What it does |
|---|---|---|
direction | vertical or horizontal | vertical by default. |
<Scroll direction="horizontal">
{days.map((d) => <Chip key={d} label={d} />)}
</Scroll>
Split
Two children side by side on a wide screen, one under the other on a phone. Resizable is the same.
| Prop | Takes | What it does |
|---|---|---|
first | number | The first one's share, 0 to 1. 0.38 by default. |
stackBelow | number | Narrower than this, one goes under the other. 720 by default. |
<Split first={0.35}>
<List>…</List>
<Box>…</Box>
</Split>
Overlay
Its first child fills it; the rest sit on top. Give one an at to place it in a corner or along an edge, kept clear of the bars, the sidebar and the home indicator.
| Prop | Takes | What it does |
|---|---|---|
safeArea | bool | false lets placed children run right to the edges. |
gap | space | How far placed children sit from the edges, 3 by default. |
<Overlay>
<Map fill rows={stops} />
<Glass at="bottom-right"><Button onPress={add}>Add stop</Button></Glass>
</Overlay>
Glass
What floats over a full-bleed view, in each platform's own material: Liquid Glass on a Mac, frosted on iOS, a solid layer on Windows, a tonal surface on Android.
| Prop | Takes | What it does |
|---|---|---|
radius | number | Its corners. A pill by default. |
padding | space | Room inside, 2 by default. |
<Glass at="top"><Segmented value={mode} onChange={setMode} options={['Map', 'List']} /></Glass>
Section
A titled group, like the parts of a settings screen.
| Prop | Takes | What it does |
|---|---|---|
title | string | Its heading. |
folded | bool | With it, the heading folds the section. true starts folded. |
action | element | Something by the heading, such as an IconButton. |
<Section title="Done" folded>
{done.map((t) => <ListItem key={t.id} title={t.title} />)}
</Section>
Accordion
A heading that opens to show its children.
| Prop | Takes | What it does |
|---|---|---|
title | string | The heading. |
open | bool | Starts open. |
<Accordion title="Ingredients">
<Markdown text={recipe.ingredients} />
</Accordion>
Card
A raised card. Its children stack with no gap; use gap on a Stack inside for more.
| Prop | Takes | What it does |
|---|---|---|
onPress | () => void | Makes it tappable. |
pad | space | 16 px by default. |
<Card onPress={() => nav.push('Plant', { id: p.id })}>
<Text variant="title">{p.name}</Text>
<Text tone="muted">Watered {format.relative(p.wateredAt)}</Text>
</Card>
StickyNote
A paper note with a folded corner, in one of six colours. Text on it is in dark ink on any theme.
| Prop | Takes | What it does |
|---|---|---|
color | yellow, pink, blue, green, orange, purple | yellow by default. |
tilt | number | Degrees. |
fold | number | The folded corner's size. 20 by default. |
pinned | bool | Shows a pin. |
onPress | () => void | Tapped. |
onLongPress | () => void | Held, or right-clicked. |
<StickyNote color="pink" tilt={-1.5} pinned onPress={open}>
<Text bold>Call the vet</Text>
<Text>Before Friday</Text>
</StickyNote>
Corkboard
A cork board with its children pinned where they were dropped. Drag one with a mouse, or hold and drag with a finger, to move it. On a full-bleed screen it fills the whole view and fits every note in it, so it never scrolls: the board grows to the window's shape and the notes stay clear of the bars. Otherwise it fills the width. + and − zoom in, and a zoomed board pans any way and pinches. Each child gives its own id, x and y (in the board's units); one without x and y goes in rows across the top.
| Prop | Takes | What it does |
|---|---|---|
width | number | The board's units across, 1000 by default. |
height | number | Its units down, 700 by default. Not used full bleed, where it fits the view. |
item | number | How wide each child is, in its units. 180 by default. |
links | [id, id][] | Red string between these children's pins. |
onMove | (id, x, y) => void | One was dragged and let go there. Without it nothing moves. |
onHold | (id) => void | One was held, or clicked, and let go without moving. |
zoom | number | How far in, 1 to 3. The app can set it. |
onZoom | (zoom) => void | Zoomed in or out. |
onTapEmpty | ({x, y}) => void | Bare cork tapped, in board units: add a note there. |
selected | string[] | Notes drawn picked. |
onSelect | (ids) => void | A box dragged over bare cork with the mouse: the notes in it. |
<Corkboard height={800} onMove={(id, x, y) => edit('notes', id, { x, y })}>
{notes.map((n) => (
<StickyNote key={n.id} id={n.id} x={n.x} y={n.y} tilt={n.tilt} color={n.color}>
<Text bold>{n.title}</Text>
</StickyNote>
))}
</Corkboard>
Text
Words, formatted.
Text
Words. Its children are the text.
| Prop | Takes | What it does |
|---|---|---|
variant | display, title, headline, label, caption, mono | Its size and weight. Body text without it. |
bold | bool | Bold body text. |
tone | tone | Its colour: accent, success, warning, danger or muted. |
strike | bool | Struck through, for something done. |
lines | number | At most this many lines, then … |
align | center or end | Where it sits. |
<Text variant="title">Today</Text>
<Text tone="muted" lines={2}>{note.body}</Text>
<Text strike={task.done}>{task.title}</Text>
Markdown
Markdown: headings, bold, lists, checkboxes, links and code. The words can be picked and copied.
| Prop | Takes | What it does |
|---|---|---|
text | string | The Markdown. Or give it as children. |
onChange | (text) => void | Makes its - [ ] boxes tickable: the text with the box ticked or unticked. |
<Markdown text={note.body} />
Code
Monospaced text in a box, with a Copy button.
| Prop | Takes | What it does |
|---|---|---|
text | string | The code. Or as children. |
<Code text={'curl https://example.com'} />
Highlight
Text with every match of a search marked.
| Prop | Takes | What it does |
|---|---|---|
text | string | The text. Or as children. |
query | string | What to mark, case ignored. |
<Highlight text={note.title} query={search} />
Buttons and menus
Things to tap.
Button
A button. Its children, or label, are its words.
| Prop | Takes | What it does |
|---|---|---|
label | string | Its words. |
icon | icon | An icon before them. |
variant | filled, tonal, plain, danger | filled by default. |
onPress | () => void | Tapped. |
loading | bool | A spinner instead of the words. |
expand | bool | As wide as it can be. |
disabled | bool | Faded; taps do nothing. |
<Button icon="add" onPress={add}>Add</Button>
<Button variant="tonal" onPress={skip}>Skip</Button>
<Button variant="danger" onPress={remove}>Delete</Button>
IconButton
A button that's an icon.
| Prop | Takes | What it does |
|---|---|---|
icon | icon | The icon. |
label | string | What it does, for screen readers and the tooltip. |
variant | filled | Filled with the accent. |
onPress | () => void | Tapped. |
<IconButton icon="search" label="Search" onPress={() => setSearching(true)} />
Fab
The screen's main button. Put it in <Screen fab={…}> and Isolink draws it the platform's way: a round button of glass on Mac, iPhone and iPad, a command button that says what it does on Windows, a Material button on Android. People who can only view the database don't get it.
| Prop | Takes | What it does |
|---|---|---|
icon | icon | add by default. |
label | string | With words, it's a wide button. |
onPress | () => void | Tapped. |
<Screen title="Plants" fab={<Fab icon="add" onPress={() => setAdding(true)} />}>…</Screen>
Toolbar
A row of actions. As many as fit show as buttons; the rest go in a ⋯ menu. Computers show their names when there's room, phones show icons.
| Prop | Takes | What it does |
|---|---|---|
items | {id, label, icon, onPress, danger}[] | The actions, most used first. |
max | number | The most shown before ⋯: 5 on a computer, 3 on a phone. |
labels | bool | false keeps a computer to icons too. |
<Toolbar items={[
{ id: 'share', label: t('Share'), icon: 'share', onPress: share },
{ id: 'print', label: t('Print'), icon: 'print', onPress: print },
{ id: 'delete', label: t('Delete'), icon: 'delete', danger: true, onPress: remove },
]} />
SplitButton
A button with a menu beside it for the other choices.
| Prop | Takes | What it does |
|---|---|---|
label | string | The main button's words. |
icon | icon | Its icon. |
onPress | () => void | The main button. |
items | menu items | A list of {id, label, icon, danger}, or {divider: true} for a line. |
onPick | (id) => void | A menu item was picked. |
<SplitButton label="Send" onPress={send}
items={[{ id: 'later', label: 'Send later', icon: 'schedule' }]}
onPick={(id) => id === 'later' && setScheduling(true)} />
Menu
A button that opens a menu.
| Prop | Takes | What it does |
|---|---|---|
items | menu items | {id, label, icon, danger, checked, shortcut, disabled, items}, or {divider: true} for a line. shortcut shows as ⌘N on a Mac and Ctrl+N on Windows, and not on phones; checked ticks it; items opens a submenu. |
onPick | (id) => void | The id picked. |
icon | icon | The button's icon, more by default. Or give children to be the button. |
<Menu items={[{ id: 'rename', label: 'Rename', icon: 'edit' },
{ id: 'delete', label: 'Delete', icon: 'delete', danger: true }]}
onPick={pick} />
ContextMenu
A menu on its children: a long press on a phone, a right click on a computer.
| Prop | Takes | What it does |
|---|---|---|
items | menu items | The same rows as a Menu's, dividers, shortcuts, ticks and submenus too. |
onPick | (id) => void | The id picked. |
<ContextMenu items={[{ id: 'pin', label: 'Pin', icon: 'push_pin' }]} onPick={pick}>
<ListItem title={n.title} />
</ContextMenu>
Chip
A small pill to pick or filter with.
| Prop | Takes | What it does |
|---|---|---|
label | string | Its words. Or as children. |
icon | icon | An icon before them. |
selected | bool | Picked. |
onPress | () => void | Tapped. |
{tags.map((t) => <Chip key={t} label={t} selected={t === tag} onPress={() => setTag(t)} />)}
Filter
One of a few choices to narrow what shows. On a computer it is a row of chips; in a full-bleed screen's top row on a Mac, one round of glass the bar's height, with the picked one lifted; on phones and tablets it is one pill that drops down a menu.
| Prop | Takes | What it does |
|---|---|---|
options | options | A list of strings, or {value, label, icon}. |
value | string | The one picked. |
onChange | (value) => void | Another was picked. |
onAdd | () => void | Adds a way to add another, at the end. |
addLabel | string | Words for adding, New by default. |
<Filter value={folder} options={[{ value: '', label: 'All' }, ...folders]} onChange={setFolder}
onAdd={newFolder} addLabel="Folder" />
FilterTabs
A row of icon tabs to narrow what shows, like Mail's: only the picked one opens up to show its name. Glass rounds on a Mac, toggle buttons on Windows, filter chips on Android. Too many for the row and it scrolls sideways. Check has('filterTabs') and fall back to Filter on older Isolinks.
| Prop | Takes | What it does |
|---|---|---|
options | options | {value, label, icon, color, badge}. label shows on the picked tab and as the others' tooltip. color is the picked tab's own: blue, green, red, orange, yellow, purple, pink, teal, indigo, brown, grey, or any CSS colour; the theme's otherwise. badge is a count. |
value | string | The one picked. |
onChange | (value) => void | Another was picked. |
onHold | (value) => void | A tab was right-clicked or held: its menu. |
labels | 'picked' | 'all' | Name only the picked tab (the default), or every tab. |
<FilterTabs value={box} onChange={setBox} options={[
{ value: 'people', label: 'People', icon: 'person' },
{ value: 'orders', label: 'Orders', icon: 'shopping_cart', color: 'green', badge: 3 },
{ value: 'all', label: 'All', icon: 'inbox' },
]} />
Segmented
Two to five choices joined in one control.
| Prop | Takes | What it does |
|---|---|---|
options | options | A list of strings, or {value, label, icon} (id and name work too). |
value | string | The one picked. |
onChange | (value) => void | Another was picked. |
<Segmented options={['Day', 'Week', 'Month']} value={view} onChange={setView} />
Pressable
Makes anything tappable. Its class can style :pressed and :hover; display: flex lays its children in a row.
| Prop | Takes | What it does |
|---|---|---|
onPress | () => void | Tapped. |
onLongPress | () => void | Held. |
onDoubleTap | () => void | Tapped twice. |
<Pressable class={s.tile} onPress={open} onLongPress={menu}>
<Icon name="timer" />
<Text>{t.name}</Text>
</Pressable>
KeyboardShortcut
Runs something when keys are pressed while its children are shown. For the whole app, useKeys is simpler.
| Prop | Takes | What it does |
|---|---|---|
keys | string | Such as ctrl+k, cmd+enter, shift+n or esc. |
onPress | () => void | Pressed. |
<KeyboardShortcut keys="ctrl+n" onPress={add}>…</KeyboardShortcut>
Input
Fields and pickers. Each is controlled: give it value and change it in onChange.
TextField
A text box.
| Prop | Takes | What it does |
|---|---|---|
value | string | What's in it. |
onChange | (text) => void | Typed in. A number field gives a number when it reads as one. |
placeholder | string | Shown while it's empty. |
label | string | A label above it. |
error | string | A problem, in red under it. |
type | text, number, email, phone, url, password | The keyboard, and hides a password. |
multiline | bool | Up to 4 lines. |
lines | number | Up to this many lines. |
max | number | At most this many characters, with a count. |
autofocus | bool | The keyboard opens on it. |
onSubmit | (text) => void | Enter, or the keyboard's Done. |
plain | bool | No box: just the words, in the text style around it. With onSubmit it's one line and Enter submits, from Isolink 0.26.47 (has('field.submit')). |
<TextField value={name} onChange={setName} placeholder="Name" max={40} onSubmit={add} autofocus />
SearchField
A search box with a magnifier.
| Prop | Takes | What it does |
|---|---|---|
value | string | What's in it. |
onChange | (text) => void | Typed in. |
placeholder | string | Shown while it's empty. |
<SearchField value={search} onChange={setSearch} placeholder="Search" />
Editor
A big box for writing. With toolbar, buttons add Markdown (heading, bold, italic, list, checkbox, code, quote).
| Prop | Takes | What it does |
|---|---|---|
value | string | The text. |
onChange | (text) => void | Changed. |
placeholder | string | Shown while it's empty. |
lines | number | 12 by default. |
toolbar | bool | The Markdown buttons. |
plain | bool | No box, for writing straight onto a note. |
autofocus | bool | The keyboard opens on it. |
<StickyNote color={note.color}>
<Editor plain value={body} onChange={save} placeholder="Note" autofocus />
</StickyNote>
MoneyField
A TextField with a number keyboard. onChange gives a number.
| Prop | Takes | What it does |
|---|---|---|
value | number | The amount. |
onChange | (amount) => void | Changed. |
label | string | A label. |
<MoneyField label="Price" value={price} onChange={setPrice} />
MentionField
A TextField for now; suggesting people as you type @ is still to come.
| Prop | Takes | What it does |
|---|---|---|
value | string | What's in it. |
onChange | (text) => void | Typed in. |
<MentionField value={text} onChange={setText} placeholder="Comment" />
TagInput
Tags as chips, with a box to add more (Enter adds one).
| Prop | Takes | What it does |
|---|---|---|
value | string[] | The tags. |
onChange | (tags) => void | One added or removed. |
placeholder | string | In the box. |
<TagInput value={note.tags ?? []} onChange={(tags) => data.edit('notes', note.id, { tags })} placeholder="Add a tag" />
Composer
The chat's own message box, for an add bar: a pill while it's one line that grows as the text wraps, the buttons you put in it before a send button on a round of the accent. Put it in a Screen's footer and it floats over the page as the chat's does. Inside it, IconButtons and Menus look like the chat's attach and camera. From Isolink 0.26.52 (has('composer')).
| Prop | Takes | What it does |
|---|---|---|
value | string | What's typed. |
onChange | (text) => void | Typed in. |
onSubmit | (text) => void | Send pressed, or Enter (the keyboard's send key on a phone). Only while there's text, or ready. |
placeholder | string | In the box. |
sendIcon | string | The send button's icon. Default arrow_upward. |
sendLabel | string | The send button's tooltip. Default "Send". |
ready | bool | Send works with no text, as when a file is picked. |
multiline | bool | Enter on a phone's keyboard starts a new line rather than sending. |
max | number | The most characters. |
maxWidth | number | How wide it gets on a big screen. Default 720. |
<Composer value={draft} onChange={setDraft} onSubmit={add} placeholder="New task" sendIcon="add" sendLabel="Add">
<IconButton icon="event" label="Date" onPress={pickDate} />
</Composer>
Checkbox
A tick box, with words beside it.
| Prop | Takes | What it does |
|---|---|---|
checked | bool | Ticked. |
onChange | (checked) => void | Tapped. |
label | string | Its words. Or as children. |
round | bool | A circle, as in Todo. |
<Checkbox round checked={!!t.done} onChange={(done) => data.edit('tasks', t.id, { done })}>{t.title}</Checkbox>
Toggle
An on and off switch, with words before it.
| Prop | Takes | What it does |
|---|---|---|
checked | bool | On. value works too. |
onChange | (on) => void | Flipped. |
label | string | Its words. Or as children. |
<Toggle label="Remind me" checked={remind} onChange={setRemind} />
Radio
One of a list.
| Prop | Takes | What it does |
|---|---|---|
options | options | A list of strings, or {value, label, icon} (id and name work too). |
value | string | The one picked. |
onChange | (value) => void | Another was picked. |
<Radio options={['Daily', 'Weekly', 'Monthly']} value={every} onChange={setEvery} />
Select
One of a list, from a menu.
| Prop | Takes | What it does |
|---|---|---|
options | options | A list of strings, or {value, label, icon} (id and name work too). |
value | string | The one picked. |
onChange | (value) => void | Another was picked. |
placeholder | string | Shown while none is picked. |
label | string | A label. |
variant | chip | A small chip instead of a field. |
<Select label="Aisle" value={item.aisle} onChange={(aisle) => data.edit('items', item.id, { aisle })}
options={[{ value: 'dairy', label: 'Dairy' }, { value: 'bakery', label: 'Bakery' }]} />
Slider
A number on a track.
| Prop | Takes | What it does |
|---|---|---|
value | number | Where it is. |
min | number | 0 by default. |
max | number | 100 by default. |
step | number | Snaps to these steps. |
label | string | Shown while dragging. |
onChange | (value) => void | Dragged. |
<Slider value={volume} min={0} max={10} step={1} onChange={setVolume} />
RangeSlider
Two ends on a track.
| Prop | Takes | What it does |
|---|---|---|
value | [number, number] | The two ends. |
min | number | 0 by default. |
max | number | 100 by default. |
step | number | Snaps to these steps. |
onChange | ([from, to]) => void | Dragged. |
<RangeSlider value={[low, high]} min={0} max={500} step={10} onChange={([a, b]) => { setLow(a); setHigh(b); }} />
Stepper
A number with − and + buttons.
| Prop | Takes | What it does |
|---|---|---|
value | number | The number. |
step | number | 1 by default. |
min | number | The lowest. |
max | number | The highest. |
onChange | (value) => void | Changed. |
<Stepper value={qty} min={1} max={99} onChange={setQty} />
Rating
Stars, or an emoji, to tap. Tapping the one picked clears it.
| Prop | Takes | What it does |
|---|---|---|
value | number | How many. |
max | number | 5 by default. |
emoji | string | An emoji instead of stars. |
onChange | (value) => void | Tapped. |
<Rating value={r.stars ?? 0} onChange={(stars) => data.edit('recipes', r.id, { stars })} />
ColorPicker
Dots of the theme's colours: accent, success, warning, danger and muted.
| Prop | Takes | What it does |
|---|---|---|
value | string | The name picked. |
onChange | (name) => void | Another was picked. |
<ColorPicker value={label.color} onChange={(color) => data.edit('labels', label.id, { color })} />
DatePicker
A chip that opens the date picker. Dates are YYYY-MM-DD.
| Prop | Takes | What it does |
|---|---|---|
value | string | The date. |
onChange | (date) => void | Picked. |
placeholder | string | Shown while none is set. |
late | bool | In red, for something overdue. |
min | string | The earliest day it offers. 1900-01-01 if not set. |
max | string | The latest day it offers. 2100-12-31 if not set. |
<DatePicker value={t.due} late={!!t.due && t.due < today} onChange={(due) => data.edit('tasks', t.id, { due })} />
TimePicker
A chip that opens the time picker. Times are HH:MM.
| Prop | Takes | What it does |
|---|---|---|
value | string | The time. |
onChange | (time) => void | Picked. |
placeholder | string | Shown while none is set. |
<TimePicker value={alarm} onChange={setAlarm} />
DurationPicker
A chip that opens an hours and minutes wheel. Durations are whole minutes, shown as 1:30.
| Prop | Takes | What it does |
|---|---|---|
value | number | The minutes. |
onChange | (minutes) => void | Picked. |
placeholder | string | Shown while none is set. |
min | number | The fewest minutes. |
max | number | The most minutes. |
<DurationPicker value={minutes} min={5} onChange={setMinutes} />
PersonPicker
Picks one of the database's members. Shows their picture once picked.
| Prop | Takes | What it does |
|---|---|---|
value | string | The account id. |
onChange | (id) => void | Picked. |
<PersonPicker value={chore.who} onChange={(who) => data.edit('chores', chore.id, { who })} />
PlacePicker
A row showing a place, opening a sheet with search and a map to drag under a pin. My location is there when the app has needs.device location.
| Prop | Takes | What it does |
|---|---|---|
value | {lat, lng, name} | The place. |
onChange | (place) => void | Picked. |
label | string | Place by default. |
disabled | bool | Shown, not changed. |
<PlacePicker value={trip.place} onChange={(place) => data.edit('trips', trip.id, { place })} />
Keypad
A number pad.
| Prop | Takes | What it does |
|---|---|---|
onKey | (key) => void | 0 to 9, . or back. |
<Keypad onKey={(k) => setAmount(k === 'back' ? amount.slice(0, -1) : amount + k)} />
EmojiPicker
A row of emoji to pick from.
| Prop | Takes | What it does |
|---|---|---|
onPick | (emoji) => void | Picked. |
<EmojiPicker onPick={(icon) => data.edit('habits', h.id, { icon })} />
Reactions
The same row, for reacting.
| Prop | Takes | What it does |
|---|---|---|
onReact | (emoji) => void | Picked. |
<Reactions onReact={(e) => data.add('reactions', { post: post.id, emoji: e })} />
Form
A group of fields, one under another. Pair it with useForm.
| Prop | Takes | What it does |
|---|---|---|
gap | space | Space between fields. |
const form = useForm({ name: { required: true, max: 40 } }, { onSubmit: (v) => data.add('plants', v) });
<Form gap={3}>
<TextField label="Name" {...form.field('name')} />
<Button onPress={form.submit}>Save</Button>
</Form>
Showing things
Pictures, numbers and progress.
Icon
An icon by name (see Icons).
| Prop | Takes | What it does |
|---|---|---|
name | icon | Which one. Or as children. |
size | number | 20 by default. |
tone | tone | Its colour: accent, success, warning, danger or muted. Muted by default. |
<Icon name="cake" tone="accent" size={24} />
Avatar
Someone's picture.
| Prop | Takes | What it does |
|---|---|---|
person | string | An account id: their own picture. |
name | string | Without person, a circle drawn from this name. |
size | number | 36 by default. |
<Avatar person={row.who} size={28} />
AvatarStack
Pictures overlapping, and +n for more.
| Prop | Takes | What it does |
|---|---|---|
people | string[] | Account ids. |
max | number | How many pictures before +n. 4 by default. |
size | number | 28 by default. |
onPress | () => void | Tapped. |
<AvatarStack people={trip.going ?? []} onPress={() => setPicking(true)} />
Image
A picture: a file field's value, or an https address on a host in needs.web.
| Prop | Takes | What it does |
|---|---|---|
src | file or string | The picture. |
alt | string | What it shows, for screen readers, and shown if it can't load. |
fit | cover, contain, fill | cover by default. |
ratio | number or '16:9' | Its shape. |
onPress | () => void | Tapped. |
<Image src={recipe.photo} alt={recipe.name} ratio="4:3" />
Gallery
Files' pictures in a grid. Tapping one opens them full screen.
| Prop | Takes | What it does |
|---|---|---|
files | file[] | The pictures. |
columns | number | 3 by default. |
onPress | (index) => void | Tapped, instead of opening them. |
<Gallery files={trip.photos ?? []} columns={3} />
Viewer
Photos one at a time, filling its box: swipe between them, pinch or double-tap to zoom. Use it as a lightbox on a full-bleed screen.
| Prop | Takes | What it does |
|---|---|---|
files | file[] | The photos. |
index | number | The one showing. |
onIndex | (i) => void | Swiped to another. |
onClose | () => void | Swiped down: close the lightbox. |
background | string | none for no black behind. |
<Screen immersive statusBar={false}>
<Viewer files={photos} index={i} onIndex={setI} onClose={nav.pop} />
</Screen>
Carousel
Its children side by side, swiped through one at a time.
| Prop | Takes | What it does |
|---|---|---|
height | number | 180 by default. |
<Carousel height={200}>{ideas.map((i) => <Card key={i.id}><Text>{i.title}</Text></Card>)}</Carousel>
SwipeDeck
The first child as a card to swipe away left or right.
| Prop | Takes | What it does |
|---|---|---|
onSwipe | ('left' | 'right') => void | Swiped. Drop that child to show the next. |
<SwipeDeck onSwipe={(side) => vote(films[0].id, side)}>
{films.map((f) => <Card key={f.id}><Text variant="title">{f.name}</Text></Card>)}
</SwipeDeck>
Badge
A count, or a small label.
| Prop | Takes | What it does |
|---|---|---|
count | number | A number in a dot. |
label | string | Words in a pill instead. Or as children. |
tone | tone | The pill's colour: accent, success, warning, danger or muted. |
<Badge count={waiting} />
<Badge label="Today" tone="accent" />
Stat
A big number with a label.
| Prop | Takes | What it does |
|---|---|---|
label | string | What it is. |
value | string | The number. Or as children. |
tone | tone | The number's colour: accent, success, warning, danger or muted. |
change | string | Such as +12%, green, or -3, red. |
<Stat label="This week" value={format.money(spent)} change="-8%" />
Progress
A bar.
| Prop | Takes | What it does |
|---|---|---|
value | number | 0 to 1. |
tone | tone | Its colour: accent, success, warning, danger or muted. The accent by default. |
label | bool or string | true shows the percentage beside it; a string shows that. |
<Progress value={got / items.length} label />
ProgressRing
A ring, with its children in the middle.
| Prop | Takes | What it does |
|---|---|---|
value | number | From min to max. |
min | number | 0 by default. |
max | number | 1 by default. |
size | number | 44 by default. |
stroke | number | The ring's width. A tenth of size by default. |
tone | tone | Its colour: accent, success, warning, danger or muted. |
label | string | Words in the middle, without children. |
<ProgressRing value={left / total} size={104} stroke={7}>
<Text class={s.time}>{clock(left)}</Text>
</ProgressRing>
Gauge
A ProgressRing from 0 to 100 by default, 96 across, showing its value.
| Prop | Takes | What it does |
|---|---|---|
value | number | The value. |
min | number | 0 by default. |
max | number | 100 by default. |
label | string | Instead of the value. |
<Gauge value={score} />
Steps
Numbered steps along a line, with those done ticked.
| Prop | Takes | What it does |
|---|---|---|
steps | string[] | Their names. |
current | number | The one you're on, from 0. |
<Steps steps={['Pack', 'Travel', 'Arrive']} current={1} />
Countdown
Time left until a moment, ticking every second.
| Prop | Takes | What it does |
|---|---|---|
to | ms or ISO string | The moment. |
done | string | Shown once it's passed. 0:00 by default. |
label | string | A label above it. |
<Countdown to={trip.leaves} label="Leaving in" done="Off we go" />
Timer
Counts down from when it's first shown, and says so when it's done. For a timer that keeps going when the app closes, store when it ends and use notify.
| Prop | Takes | What it does |
|---|---|---|
seconds | number | 60 by default. |
onDone | () => void | Reached zero. |
label | string | A label above it. |
<Timer seconds={180} label="Tea" onDone={() => toast('Tea’s ready')} />
Stopwatch
Counts up, with a play and pause button.
| Prop | Takes | What it does |
|---|---|---|
label | string | A label above it. |
<Stopwatch label="Run" />
Timeline
Events down a line.
| Prop | Takes | What it does |
|---|---|---|
items | {title, time, body}[] | The events, in order. |
<Timeline items={days.map((d) => ({ title: d.title, time: format.date(d.date), body: d.notes }))} />
QR
A QR code.
| Prop | Takes | What it does |
|---|---|---|
value | string | What it holds. Or as children. |
size | number | 160 by default. |
<QR value={`https://example.com/t/${ticket.id}`} />
Skeleton
Grey lines while something loads.
| Prop | Takes | What it does |
|---|---|---|
lines | number | 3 by default. |
{weather.loading ? <Skeleton lines={2} /> : <Text>{weather.data.summary}</Text>}
Banner
A strip with a message, and maybe a button.
| Prop | Takes | What it does |
|---|---|---|
text | string | The message. Or as children. |
icon | icon | An info icon by default, an error icon with tone="danger". |
tone | danger | For a problem. |
action | string | A button's words. |
onAction | () => void | The button. |
onDismiss | () => void | Shows a close button. |
<Banner tone="danger" text="Couldn't reach the weather" action="Retry" onAction={reload} />
Tooltip
Words shown when its children are hovered or held.
| Prop | Takes | What it does |
|---|---|---|
text | string | The words. label works too. |
shortcut | string | Its keys, as mod+n: shown as ⌘N on a Mac and Ctrl+N elsewhere. |
<Tooltip text="Every 7 days"><Icon name="autorenew" /></Tooltip>
Motion
Its children fade, slide or grow in as they appear. Any component's transition prop does the same.
| Prop | Takes | What it does |
|---|---|---|
enter | fade, slide, scale | fade by default. |
<Motion enter="slide"><Card>…</Card></Motion>
Confetti
A burst of confetti, again each time active turns true.
| Prop | Takes | What it does |
|---|---|---|
active | bool | true by default. |
{allDone && <Confetti />}
Dice
A die to tap.
| Prop | Takes | What it does |
|---|---|---|
value | number | 1 to 6. |
size | number | 48 by default. |
onRoll | () => void | Tapped. |
<Dice value={roll} onRoll={() => setRoll(1 + Math.floor(Math.random() * 6))} />
Toast
Draws nothing: call useToast() instead.
const toast = useToast();
toast('Saved');
Lists and data
Rows from the database, as lists, tables, boards and charts.
List
Rows in a group. With onReorder, a long press drags one to a new place. It can also take items and a function as its children.
| Prop | Takes | What it does |
|---|---|---|
items | any[] | With a function as children, draws each item; each is keyed by its id. |
onReorder | (id, index) => void | One was dragged to index. Give each child an id (or key). |
<List items={tasks}>
{(t) => <ListItem title={t.title} onPress={() => open(t.id)} />}
</List>
ListItem
A row in a list: a title, a line under it, and something at each end. Swipe actions are optional.
| Prop | Takes | What it does |
|---|---|---|
title | string | Its words. Or as children. |
subtitle | string | A line under them. |
subtitleTone | tone | That line's colour: accent, success, warning, danger or muted. |
leading | element or string | At the start, such as a Checkbox or Avatar. |
trailing | element or string | At the end. |
onPress | () => void | Tapped. |
onLongPress | () => void | Held. |
onSwipe | {start, end} | Swipe actions, each {icon, tone, do, keep}: do runs when swiped; with tone: 'danger' the row goes unless keep. |
<ListItem
key={t.id}
title={t.title}
subtitle={t.due ? format.date(t.due) : undefined}
leading={<Checkbox round checked={!!t.done} onChange={(done) => data.edit('tasks', t.id, { done })} />}
onSwipe={{ end: { icon: 'delete', tone: 'danger', do: () => data.remove('tasks', t.id) } }}
/>
VirtualList
A long list. With height, it scrolls inside that height; with onEnd, it asks for more as the end shows. InfiniteScroll is the same.
| Prop | Takes | What it does |
|---|---|---|
items | any[] | With a function as children, draws each item. |
height | number | Scrolls inside this height. |
onEnd | () => void | The end came into view: load more. |
<VirtualList items={rows} height={480} onEnd={() => setLimit(limit + 50)}>
{(r) => <ListItem title={r.name} />}
</VirtualList>
PullToRefresh
Pull down on its children to refresh.
| Prop | Takes | What it does |
|---|---|---|
onRefresh | () => void | Pulled. |
<PullToRefresh onRefresh={reload}>…</PullToRefresh>
Table
Rows in columns, like a planner. A column can draw any component in its cells. Columns sort when tapped, rows group by a field, and on a phone it can show cards instead.
| Prop | Takes | What it does |
|---|---|---|
rows | row[] | The rows, each with an id. |
columns | column[] | {key, title, width, grow, sort, align, hidden}. Or <Table.Column> children, whose function draws each cell. |
select | bool | A tick box on each row. With <Table.Bulk>, a Done button runs its function with the ticked ids. |
group | string | A field to group rows by, each group folding. |
phone | cards | Under 600 px wide, a card for each row. |
onAdd | (group, title) => void | An Add row under the rows (under each group). |
onRowPress | (id) => void | A row was opened. <Table.Detail> does the same with the row itself. |
<Table rows={tasks} group="status" onAdd={(status, title) => data.add('tasks', { status, title })}>
<Table.Column key="title" title="Task" grow />
<Table.Column key="who" title="Who" width={80}>{(t) => <Avatar person={t.who} size={24} />}</Table.Column>
<Table.Column key="due" title="Due" sort>{(t) => <DatePicker value={t.due} onChange={(due) => data.edit('tasks', t.id, { due })} />}</Table.Column>
<Table.Detail>{(t) => nav.push('Task', { id: t.id })}</Table.Detail>
</Table>
Board
Columns by a field, a card for each item, dragged between columns.
| Prop | Takes | What it does |
|---|---|---|
items | row[] | The items, each with an id. |
by | string | The field the columns are, status by default. |
columns | options | A list of strings, or {value, label, icon} (id and name work too): the field's values. |
height | number | 420 by default. |
onMove | (id, column) => void | An item was dropped in a column. |
<Board items={tasks} by="status" columns={[{ value: 'todo', label: 'To do' }, { value: 'done', label: 'Done' }]}
onMove={(id, status) => data.edit('tasks', id, { status })}>
{(t) => <Card><Text>{t.title}</Text></Card>}
</Board>
Calendar
A month, with a dot on each day that has items.
| Prop | Takes | What it does |
|---|---|---|
items | {id, date, title}[] | Items by their date (YYYY-MM-DD). |
month | string | A date in the month to show first. This month by default. |
onPick | (date) => void | A day was tapped. |
<Calendar items={plans} onPick={setDay} />
Schedule
One day's items in time order.
| Prop | Takes | What it does |
|---|---|---|
items | {id, date, title, start, end}[] | Items, with start and end times. |
day | string | The day, YYYY-MM-DD. Today by default. |
onPick | (id) => void | An item was tapped. |
<Schedule day={day} items={plans} onPick={(id) => nav.push('Plan', { id })} />
Chart
A chart of numbers.
| Prop | Takes | What it does |
|---|---|---|
kind | bar, line, area, pie, ring, sparkline | bar by default. |
data | number[] or {label, value}[] | The numbers. |
height | number | 160 by default, 36 for a sparkline. |
<Chart kind="bar" data={weeks.map((w) => ({ label: w.name, value: w.total }))} />
Heatmap
Weeks of days, darker the more each has, like a streak.
| Prop | Takes | What it does |
|---|---|---|
days | {[date]: number} | A number for each YYYY-MM-DD. |
weeks | number | 12 by default. |
<Heatmap days={Object.fromEntries(checkins.map((c) => [c.day, 1]))} weeks={16} />
Leaderboard
Names and scores, first at the top.
| Prop | Takes | What it does |
|---|---|---|
rows | {name, score}[] | In order. |
<Leaderboard rows={players.map((p) => ({ name: p.name, score: p.points }))} />
Poll
Options with bars for their votes.
| Prop | Takes | What it does |
|---|---|---|
options | {id, label, votes}[] | The options. |
onVote | (id) => void | One was tapped. |
<Poll options={places.map((p) => ({ id: p.id, label: p.name, votes: p.votes }))}
onVote={vote} />
Comments
Its children one under another, for now. Outline is the same.
<Comments>{comments.map((c) => <ListItem key={c.id} title={c.text} />)}</Comments>
DatabasePicker
The database's name, and when this app has more than one database, a menu to switch. The top bar already has one.
<DatabasePicker />
Camera, sound and drawing
Components that make or play files. What they make is a value for a file field: sealed like a chat file, sent to every member's devices, at most 25 MB.
Upload
A box to pick a file, then the files under it.
| Prop | Takes | What it does |
|---|---|---|
onUpload | (file) => void | One was picked and kept. Put it in a file field. |
value | file or file[] | The files to list. |
onRemove | (file) => void | Shows a remove button on each. |
accept | string | Extensions, such as pdf,png,jpg. |
label | string | Add a file by default. |
<Upload value={trip.tickets ?? []} accept="pdf,png,jpg"
onUpload={(f) => data.edit('trips', trip.id, { tickets: [...(trip.tickets ?? []), f] })} />
Camera
The camera, with a shutter. Needs needs.device camera.
| Prop | Takes | What it does |
|---|---|---|
onCapture | (file) => void | A photo was taken, as a JPEG. |
size | number | The longest side of the photo. 2048 by default. |
facing | front | The front camera. |
height | number | 260 by default. |
<Camera onCapture={(photo) => data.edit('plants', p.id, { photo })} />
Scanner
Reads barcodes and QR codes. Needs needs.device camera.
| Prop | Takes | What it does |
|---|---|---|
onScan | ({text, format}) => void | A code was read (the same one again only after 3 seconds). |
formats | string[] | Only these, such as qr, ean13. All by default. |
height | number | 180 by default. |
<Scanner formats={['ean13']} onScan={({ text }) => data.add('items', { name: text })} />
Recorder
Records sound. Needs needs.device microphone.
| Prop | Takes | What it does |
|---|---|---|
onDone | (file) => void | A recording, with its duration in ms. |
label | string | Record by default. |
<Recorder onDone={(memo) => data.add('memos', { memo })} />
Video
Plays a video file.
| Prop | Takes | What it does |
|---|---|---|
src | file | The video. |
autoplay | bool | Starts as soon as it's loaded. |
loop | bool | Plays again from the start. |
muted | bool | No sound. |
controls | bool | false for a bare picture with no play button or bar, as a backdrop. |
fullscreen | bool | A button that opens it over everything. |
fill | bool | Fills its box, cropped to fit. |
onEnd | () => void | Played to the end. |
<Video src={clip.file} />
Audio
Plays a sound file, with its waveform.
| Prop | Takes | What it does |
|---|---|---|
src | file | The sound. |
<Audio src={m.memo} />
ImageCrop
Crops a picture to a shape.
| Prop | Takes | What it does |
|---|---|---|
src | file | The picture. |
ratio | string | The shape it starts on, 1:1 by default. |
ratios | string[] | Shapes to pick from. 1:1, 4:3 and 16:9 by default. |
onDone | (file) => void | The cropped picture. |
size | number | Its width. 1600 by default. |
<ImageCrop src={photo} ratios={['1:1', '4:3']} onDone={(cover) => data.edit('recipes', r.id, { cover })} />
Sketch
A pad to draw on with a finger.
| Prop | Takes | What it does |
|---|---|---|
value | file | A drawing to start from. |
onChange | (file) => void | The drawing, when it's saved. |
height | number | 200 by default. |
<Sketch value={plan.map} onChange={(map) => data.edit('plans', plan.id, { map })} />
Svg
A picture drawn from SVG the app writes: shapes, paths and gradients. Nothing it names is fetched.
| Prop | Takes | What it does |
|---|---|---|
src | string | The SVG markup, up to 64 KB. |
width | number | Its width. Its own by default. |
height | number | Its height. |
<Svg width={40} height={40} src={`<svg viewBox="0 0 40 40"><circle cx="20" cy="20" r="16" fill="#f5a524"/></svg>`} />
Canvas
Shapes the app draws, in the canvas's own units. {t: 'image', src, x, y, w, h, rotate} draws a file. With useFrame it redraws about 30 times a second, for games.
| Prop | Takes | What it does |
|---|---|---|
width | number | Units across, 300 by default. It fills the width and keeps its shape. |
height | number | Units down, 200 by default. |
shapes | shape[] | {t: 'rect', x, y, w, h, r}, {t: 'circle', x, y, r}, {t: 'line', x1, y1, x2, y2}, {t: 'path', points: [[x, y], …], closed} and {t: 'text', x, y, text, size, bold}, each with fill, stroke and width. Colours can be tokens such as accent. |
onPress | ({x, y}) => void | Tapped, in its units. |
fill | bool | Takes its whole box. Without a width its units are the box's own points. |
zoomable | bool | Pans and pinches. |
maxZoom | number | The furthest in, 6 by default. |
onDrag | ({phase, x, y}) => void | A drag across it, in its units: phase is start, move or end. |
<Canvas width={100} height={100} shapes={[
{ t: 'circle', x: 50, y: 50, r: 40, stroke: 'outline', width: 6 },
{ t: 'text', x: 38, y: 40, text: `${done}`, size: 18, bold: true },
]} />
Map
A map with pins, lines and areas, and where the person is when the app has needs.device location. Drag to look round; pinch, scroll or use + and − to zoom. Tiles come from OpenStreetMap when the person allows map tiles, darkened in a dark theme.
| Prop | Takes | What it does |
|---|---|---|
pins | {lat, lng, label}[] | Pins. |
rows | row[] | Rows to pin by their place field. |
place | string | The rows' place field, place by default. |
pin | string | The rows' label field, name by default. |
center | {lat, lng} | Where it looks. It fits the pins by default. |
zoom | number | Where it starts. It fits the pins by default. |
minZoom | number | The furthest out. 2 by default. |
maxZoom | number | The furthest in. 18 by default. |
me | bool | Shows where the person is. |
height | number | 260 by default. |
onPress | (pin) => void | A pin was tapped: its row or pin. |
lines | {points, color, width}[] | Routes: points are {lat, lng}. |
areas | {points, color, fill}[] | Shapes on the map. |
follow | bool | Keeps the person's place in the middle as they move. |
fill | bool | Takes its whole box, full bleed, with its buttons clear of the bars. |
dark | bool | Darkened tiles. Follows the theme by default. |
controls | bool | false hides the zoom buttons. |
onRegion | ({lat, lng, zoom}) => void | Moved or zoomed, once it settles. |
onZoom | (zoom) => void | Zoomed. |
onLongPress | ({lat, lng}) => void | Held: where, to drop a pin. |
<Map rows={stops} place="where" pin="title" me onPress={(stop) => nav.push('Stop', { id: stop.id })} />
Screens and sheets
Screen
A screen's frame. Its children scroll; the rest go in the app's bars.
| Prop | Takes | What it does |
|---|---|---|
title | string | Shown in the top bar once you've gone a screen deeper. The first screen shows the database's name. |
subtitle | string | A line under the first screen's big title, such as a count. Don't draw your own heading: the first screen already shows the database's name big, as the system does. From Isolink 0.26.48 (has('screen.title')). |
actions | element | Buttons in the top bar, before the ⋯ menu. |
fab | element | A Fab, drawn the platform's way. Hidden from people who can only view. |
footer | element | A bar along the bottom, kept above the keyboard. |
tabs | options | The app's own tabs, 2 to 5: strings, or {value, label, icon}. Drawn the platform's way: a Liquid Glass bar on Mac, iPhone and iPad, a Material bar on Android phones and a rail on wider Android screens, along the top on Windows, and in the sidebar beside the app on a computer. |
tab | string | The tab showing. |
onTab | (value) => void | Another tab was picked. |
awake | bool | Keeps the display on while this screen shows, such as for cooking from it. |
immersive | bool | Full bleed: the last child fills the whole view, under the bars, with the back button, title and menu floating over it. The other children float along its top, or on a computer sit in the top row beside the title. Same as safeArea={false}. For a Corkboard or a map. |
safeArea | bool | edges | On by default: content stays clear of the bars and glass. false runs it under them on every edge (full bleed); a list such as ['bottom'] keeps only those edges clear. Read the gaps with useSafeArea(). |
shell | auto | collapsed | fixed | On a computer, the sidebar beside a full-bleed app: auto the person can fold it away, collapsed it starts folded, fixed it can't fold. Nothing on phones. |
menu | list | Rows of the app's own in the ⋯ menu, after Isolink's: {label, icon, onPress}. |
statusBar | bool | false hides the system's bars on phones and tablets, for photos and video. |
orientation | 'portrait' | 'landscape' | Holds the screen one way on phones and tablets. |
<Screen
title="Shopping"
actions={<IconButton icon="search" label="Search" onPress={toggleSearch} />}
footer={<TextField value={item} onChange={setItem} placeholder="Add an item" onSubmit={add} />}
>
…
</Screen>
Tabs
Tabs along the top, with the picked one's content under them.
| Prop | Takes | What it does |
|---|---|---|
tabs | options | A list of strings, or {value, label, icon} (id and name work too). options works too. |
value | string | The tab picked. |
onChange | (value) => void | Another was tapped. |
<Tabs tabs={['To do', 'Done']} value={tab} onChange={setTab}>
{tab === 'Done' ? <DoneList /> : <TodoList />}
</Tabs>
Sheet
Shown while open is true. Sheet slides up from the bottom (it drops down where you clicked on a computer); Dialog is a centred box with its own buttons; Popover opens beside its anchor.
| Prop | Takes | What it does |
|---|---|---|
open | bool | Shown. |
onClose | () => void | Closed by the person: set open back to false. |
detents | ('small' | 'medium' | 'large' | number)[] | A sheet that rests part way up and drags to full, as iOS's do: ['medium', 'large']. On phones and tablets. |
title | string | A dialog's heading. |
actions | {label, onPress, primary, danger, close}[] | A dialog's buttons, laid out as the platform does. Each closes it unless close is false. |
dismissible | bool | false: a dialog stays when you click outside it. |
anchor | node | What a popover opens from: drawn in its place. |
width | number | A popover's or dialog's width. |
<Sheet open={adding} onClose={() => setAdding(false)}>
<Stack gap={3}>
<TextField value={name} onChange={setName} placeholder="Name" autofocus />
<Button expand onPress={add}>Add</Button>
</Stack>
</Sheet>
Draggable
Its children can be held and dragged onto a DropZone.
| Prop | Takes | What it does |
|---|---|---|
data | any | What a DropZone gets. id works too. |
lifted | node | What it looks like in the hand. A copy of itself by default. |
forms | {[kind]: node} | What it turns into over a DropZone of each kind, such as a spine over a shelf of spines. |
away | 'fade' or 'collapse' | What's left in its place: faded, or closed up so the things beside it move in. |
onDragStart | () => void | Picked up. |
onDragEnd | (dropped) => void | Let go: true when a DropZone took it. |
<Draggable data={item.id}><Card>{item.name}</Card></Draggable>
DropZone
Takes a Draggable dropped on it, and lights up while one is over it.
| Prop | Takes | What it does |
|---|---|---|
onDrop | (data) => void | Something was dropped. |
accept | 'files' | string[] | Files dragged in from Finder or Explorer, on a computer: 'files' for any, or kinds such as ['image', 'pdf']. |
onFiles | (files) => void | Files dropped, each kept as the app's file. |
kind | string | What it is, for a Draggable's forms. |
onEnter | (data) => void | A Draggable came over it: make room for it. |
onLeave | (data) => void | It went again. |
tint | bool | false: it doesn't light up. |
<DropZone onDrop={(id) => data.edit('items', id, { got: true })}><Text>Got</Text></DropZone>
Gesture
Pans, pinches, turns, swipes and the mouse wheel on its children. Each says where (x, y in its box) and with what (pointer: touch, mouse, pen or trackpad).
| Prop | Takes | What it does |
|---|---|---|
onPan | ({dx, dy}) => void | Moved since last time: {dx, dy, x, y, pointer}. |
onPinch | (scale) => void | Pinched: (scale, {x, y}), around the point between the fingers. |
onRotate | (degrees) => void | Turned. |
onSwipe | ('left' | 'right') => void | Swiped. |
onDoubleTap | () => void | Tapped twice. |
onStart | ({x, y, pointer, fingers}) => void | A pan or pinch began. |
onEnd | ({vx, vy}) => void | Let go, with the fling's speed in points a second. |
onTap | () => void | Tapped. |
onLongPress | ({x, y}) => void | Held. |
onWheel | ({dx, dy, x, y, zoom}) => void | The mouse wheel or a trackpad: zoom is true while ⌘ or Ctrl is held. |
<Gesture onSwipe={(side) => setDay(side === 'left' ? next(day) : prev(day))}>…</Gesture>
FocusScope
Keeps the keyboard's focus moving inside its children.
<FocusScope>…</FocusScope>
Icons
Icons are named: add, cake, timer, shopping_cart and the rest below. A name it doesn't know is drawn as a circle. These short names work too: plus (add), minus (remove), trash (delete_outline), delete (delete_outline), cart (shopping_cart), gear (settings), cog (settings), x (close), tick (check), done (check), more (more_horiz), pen (edit), pencil (edit), calendar (calendar_month), clock (schedule), note (sticky_note_2), list (format_list_bulleted), info (info_outline), warning (warning_amber), heart (favorite), user (person), people (groups), chat (chat_bubble), pin (push_pin), flag (flag), dice (casino), book (menu_book), mail (mail_outline), bell (notifications), up (arrow_upward), down (arrow_downward), back (arrow_back), next (arrow_forward).
ac_unit account_box account_circle account_tree add add_box add_circle_outline add_comment add_location_alt add_photo_alternate add_reaction admin_panel_settings air alarm alarm_off alarm_on all_inclusive alt_route animation app_shortcut archive arrow_back arrow_downward arrow_drop_down arrow_forward arrow_upward article assignment attach_file auto_awesome auto_fix_high autorenew back_hand backspace backup badge bar_chart battery_alert battery_charging_full battery_saver beach_access bedtime block bluetooth bluetooth_connected bluetooth_disabled bluetooth_searching blur_on bolt bookmark bookmark_add bookmark_added border_bottom border_color border_left border_outer border_right border_top brightness_auto broken_image brush bubble_chart bug_report build burst_mode cake calculate calendar_month call call_end call_split camera_alt cameraswitch campaign cancel casino category celebration cell_tower center_focus_weak chat_bubble chat_bubble_outline check check_box check_box_outline_blank check_circle check_circle_outline checklist chevron_left chevron_right circle close close_fullscreen cloud cloud_done cloud_off cloud_queue cloud_sync cloud_upload code collections compress computer confirmation_number connect_without_contact construction contact_page contacts content_copy content_paste content_paste_go contrast copy copy_all create_new_folder crop_portrait cyclone dark_mode dashboard_customize data_object data_saver_on data_usage delete_forever delete_outline delete_sweep description desktop_windows devices devices_other directions_car directions_run diversity_3 dns do_not_disturb_on done_all double_arrow download download_done download_for_offline downloading drag_handle drag_indicator drive_file_move drive_folder_upload eco edit edit_calendar edit_note emoji_emotions emoji_events emoji_people emoji_symbols enhanced_encryption error error_outline event event_available expand_less expand_more explore explore_off extension extension_off face face_retouching_natural favorite fiber_manual_record file_copy file_download file_open file_upload fingerprint flag flare flash_auto flash_off flash_on flight flip folder folder_open folder_zip format_align_center format_align_left format_align_right format_bold format_italic format_list_bulleted format_list_numbered format_quote format_shapes format_size forum forward forward_10 fullscreen fullscreen_exit functions gavel gpp_bad gpp_maybe gradient graphic_eq grid_off grid_on grid_view group group_add groups health_and_safety hearing help help_outline hide_image hiking history history_toggle_off home horizontal_rule hourglass_bottom hourglass_empty hourglass_top how_to_reg how_to_vote hub image image_not_supported inbox info_outline insert_drive_file insights install_mobile inventory_2 ios_share key keyboard keyboard_arrow_down keyboard_arrow_up keyboard_command_key keyboard_hide keyboard_tab keyboard_voice label_outline lan landscape language laptop laptop_mac layers layers_clear lens_blur light_mode lightbulb lightbulb_outline linear_scale link link_off local_bar local_cafe local_shipping location_off location_on lock lock_open lock_outline lock_person login logout luggage mail_outline manage_accounts manage_search map maps_ugc mark_chat_read mark_chat_unread menu menu_book menu_open mic mic_none mic_off monitor monitor_heart mood more_horiz more_vert motion_photos_off motion_photos_paused move_to_inbox movie music_note my_location navigation new_releases nightlight noise_aware notes notification_important notifications notifications_active notifications_none notifications_off open_in_full open_in_new open_with outbox outlined_flag palette panorama password pause pause_circle_outline payments pending people people_alt people_outline perm_media person person_add_alt person_add_alt_1 person_outline person_remove pets phone_android phone_in_talk phonelink_erase phonelink_off phonelink_setup photo photo_album photo_camera photo_filter photo_library photo_size_select_large photo_size_select_small picture_as_pdf picture_in_picture_alt pin pinch place play_arrow play_circle play_circle_fill play_circle_outline poll privacy_tip psychology public public_off push_pin qr_code qr_code_2 qr_code_scanner quiz radar radio_button_checked radio_button_off radio_button_unchecked receipt_long record_voice_over redeem redo refresh remove remove_circle_outline replay_10 reply report restart_alt restaurant rocket_launch rotate_right route rule save_alt schedule schedule_send school science screen_share search search_off security_update_good segment sell send send_to_mobile sensors sentiment_neutral settings settings_backup_restore settings_remote settings_suggest settings_voice share shield shield_moon shop shopping_bag shopping_cart short_text shortcut shuffle signal_cellular_connected_no_internet_0_bar smart_button smart_toy smartphone sms sos space_bar space_dashboard speed sports_esports sports_soccer star star_outline sticky_note_2 stop stop_circle stop_screen_share storefront straighten style subdirectory_arrow_right support_agent swap_horiz swap_vert sync sync_problem system_update system_update_alt tab tablet tablet_android tag tap_and_play terminal text_decrease text_fields text_format text_increase timer timer_off title token touch_app train translate tune unarchive undo unfold_less unfold_more update upgrade upload upload_file verified verified_user vertical_align_top vibration video_library videocam videocam_off view_agenda view_carousel view_column view_kanban view_sidebar visibility visibility_off volume_off volume_up wallpaper warning warning_amber watch waving_hand wb_cloudy wb_sunny web_asset where_to_vote widgets wifi wifi_off wifi_tethering work wrap_text