Skip to content
DocsBuild
Build

Components

The component kit in src/components/ui/. Every component on this page is used on the demo pages, and the Design kit pages show each one live in every state.

#How the components work

  • Import each component from its own file. For example import { Button } from '@/components/ui/Button'.
  • Each component renders one CSS class, such as .am-btn or .am-switch. Its look lives in src/styles/components.css, and every value comes from a token. Change the tokens and every component follows. See Theming.
  • Theme and density are never props. The attributes on <html> switch them. No component needs to know which theme is active.
  • Icons are passed as components, never as names: icon={IconPlus}. Only the icons you import are in your build.
  • Native props work. Button accepts every <button> prop, Input every <input> prop, and so on.
  • Every state is built in: hover, pressed, keyboard focus, disabled and, where it applies, loading, selected and invalid.
Design kit page Shows
/ui/buttons Every keycap variant, size and state
/ui/inputs Text, units, invalid, search, select, textarea, disabled
/ui/selection Checkbox, radio, switch, segmented control
/ui/dials Thermostat dial, rings, gauges, sliders, progress
/ui/status LED chips, status keys, priority pills, badges
/ui/navigation Keypad, tabs, breadcrumb, pagination, menu, command palette
/ui/feedback Alerts, toasts, dialog, drawer, tooltip, empty state, skeleton
/ui/surfaces Raised, well, keycap and slab, with a live light switch
/ui/typography Both fonts, the type scale, tabular numbers
/ui/charts Every chart
/ui/tables Sorting, selection, and a live density switch
/ui/icons Icon sizes and a catalog of 258 icons
/ui/motion Every animation, with a live reduced motion switch

#Button

The keycap. It stands on a solid edge and travels down when pressed.

TSX
import { IconPlus, IconTrash } from '@tabler/icons-react';
import { Button } from '@/components/ui/Button';

<Button>Cancel</Button>
<Button variant="accent" icon={IconPlus}>New work order</Button>
<Button variant="danger" icon={IconTrash}>Delete</Button>
<Button iconOnly icon={IconPlus} aria-label="Add" />
<Button loading>Saving</Button>
Prop Type Default What it does
variant 'default' | 'accent' | 'info' | 'ghost' | 'danger' 'default' accent is the main action (tangerine). info is the cool action (ice). ghost has no keycap.
size 'sm' | 'md' | 'lg' 'md' The height.
icon Tabler icon An icon before the text.
iconEnd Tabler icon An icon after the text, for menus.
iconOnly boolean false A square key with only the icon. Always add an aria-label.
dot boolean false A small dot on the key: something is waiting.
on boolean false Shows the key pressed in, for toggle buttons.
block boolean false Full width.
loading boolean false Shows a busy state and disables the key.

#Inputs

#Field

Wraps any control with a label, a hint and an error message.

TSX
import { Field, Input } from '@/components/ui/Input';

<Field label="Email" htmlFor="email" hint="We never share it." error={emailError} required>
  <Input id="email" type="email" value={email} onChange={(e) => setEmail(e.target.value)} invalid={!!emailError} />
</Field>;
Prop Type What it does
label string The label text.
htmlFor string The id of the control, so the label is connected to it.
hint string Help text under the control.
error string An error message. It replaces the hint.
required boolean Marks the field as required.
grow boolean Lets the field take the free space in a row.

#Input, Textarea and Select

All three are carved wells. Keyboard focus adds a ring on top of the carving.

TSX
import { IconSearch } from '@tabler/icons-react';
import { Input, Textarea } from '@/components/ui/Input';
import { Select } from '@/components/ui/Select';

<Input icon={IconSearch} placeholder="Search devices" />
<Input type="number" affix="kWh" />
<Textarea rows={4} />
<Select
  placeholder="Choose a floor"
  options={[
    { value: '1', label: 'Floor 1' },
    { value: '2', label: 'Floor 2' },
  ]}
/>
Component Extra props Notes
Input icon, affix (a unit at the end), invalid, wrapClassName Plus every <input> prop.
Textarea invalid Plus every <textarea> prop. Resizes up and down only.
Select options, placeholder, invalid A native <select>, so it works well on phones and with screen readers.

For dates, use <Input type="date" />. It uses the browser's own date picker.

#Checkbox and radio

TSX
import { Checkbox } from '@/components/ui/Checkbox';

<Checkbox checked={notify} onChange={(e) => setNotify(e.target.checked)}>Email me</Checkbox>
<Checkbox radio name="mode" value="heat">Heat</Checkbox>

A real <input> sits under the carved box, so forms and keyboards work as usual. Add radio for a round radio button.

#Switch

A toggle with a physical knob that overshoots a little when it moves.

TSX
import { Switch } from '@/components/ui/Switch';

<Switch checked={on} onChange={setOn} label="Lobby lights" showLabel />
Prop Type What it does
checked boolean Required.
onChange (next: boolean) => void Required.
label string Required. Screen readers read it.
showLabel boolean Also shows the label next to the switch.
tone 'accent' | 'info' Use info for anything that cools.
disabled boolean

#Slider, Stepper and Progress

TSX
import { Progress, Slider, Stepper } from '@/components/ui/Slider';
import { temp } from '@/lib/format';

<Slider label="Fan speed" value={speed} onValueChange={setSpeed} min={0} max={100} ticks />
<Stepper label="Setpoint" value={target} onValueChange={setTarget} step={0.5} min={16} max={28} format={(v) => temp(v)} />
<Progress value={72} tone="good" label="Battery" />
Component Props Notes
Slider value, onValueChange, label, min, max, step, tone, ticks A real range input carries the keyboard and touch input.
Stepper value, onValueChange, label, step, min, max, format Two keys and a value.
Progress value (0 to 100), tone, thin, animate, label Fills from the start once. Set animate={false} inside long lists.

#Status

Component Use it for Example
Chip A small read-only label, with an optional LED or icon <Chip led="good">Online</Chip>
Led A colored dot. Always put a word next to it. <Led tone="bad" />
Status A status word on a small key <Status tone="warn">Waiting</Status>
PriorityPill Work order priority <PriorityPill level="urgent" />
Badge A count <Badge tone="accent">4</Badge>

All of them import from @/components/ui/Badge.

  • Tones for Chip, Led and Status: neutral, accent, info, good, warn, bad.
  • Levels for PriorityPill: urgent, high, normal, low.
  • Tones for Badge: neutral, accent, bad.

#Avatar

TSX
import { Avatar, AvatarGroup } from '@/components/ui/Avatar';

<Avatar name="Riley Amara" tone="accent" size="lg" />
<AvatarGroup names={['Riley Amara', 'Sam Okafor', 'Lena Ito', 'Joe Park', 'Ana Ruiz']} max={4} />

An avatar shows the person's initials on a colored disc. Tones are neutral, accent, info, good and warn. Sizes are sm, md and lg. AvatarGroup shows up to max avatars (default 4) and counts the rest.

#Surfaces

#Card

TSX
import { Card, CardHead } from '@/components/ui/Card';

<Card span={6} hover>
  <CardHead title="Zones" aside={<Chip small>12</Chip>} />
  ...
</Card>;
Prop Type What it does
span 3 | 4 | 5 | 6 | 7 | 8 | 9 | 12 The width inside .am-grid.
hover boolean Lifts the card 3px under the mouse.
flush boolean Removes the padding, for a table or map that fills the card.
as 'section' | 'div' | 'article' The HTML element.

CardHead takes a title and an aside for anything on the right.

#The three surface classes

You can make any element raised, carved or a keycap with one class:

Class Looks like
.am-raised A panel that stands up from the background
.am-well A carved hollow. .am-well-sm and .am-well-xs are shallower.
.am-key A keycap with an edge, hover lift and press travel. Add .am-key--accent or .am-key--info for a colored key, .is-on for a pressed-in key.
.am-slab A flat fill with no depth, like a table row
.am-float A floating layer, like a menu or dialog

#Feedback

#Alert

TSX
import { Alert } from '@/components/ui/Alert';

<Alert tone="info" title="Firmware 4.3 is ready" action={<Button size="sm">Update</Button>}>
  Six gateways can update tonight.
</Alert>;

Tones are accent, info, good and bad. icon replaces the default icon.

#Toast

A short message in the corner. Every shell already has a toast area, so you only call the hook:

TSX
import { useToast } from '@/components/ui/toastContext';

const toast = useToast();

toast.push({ message: 'Scene saved.', tone: 'good' });
toast.push({
  message: 'Device removed.',
  action: { label: 'Undo', onClick: restore },
  duration: 6000,
});
Option Type Default
message string Required
tone 'good' | 'info' | 'warn' | 'bad'
action { label, onClick }
duration number (milliseconds) 4200

#Tooltip

TSX
import { Tooltip } from '@/components/ui/Tooltip';

<Tooltip content="Refresh readings">
  <Button iconOnly icon={IconRefresh} aria-label="Refresh readings" />
</Tooltip>;

It opens on hover and on keyboard focus. placement defaults to 'top' and delay to 220 milliseconds.

#Dialog and Drawer

TSX
import { Dialog, Drawer } from '@/components/ui/Dialog';

<Dialog
  open={open}
  onClose={() => setOpen(false)}
  title="Delete this scene?"
  description="Rooms that use it go back to their schedule."
  footer={
    <>
      <Button onClick={() => setOpen(false)}>Cancel</Button>
      <Button variant="danger" onClick={remove}>Delete</Button>
    </>
  }
/>

<Drawer open={filters} onClose={() => setFilters(false)} title="Filters">
  ...
</Drawer>

Both keep keyboard focus inside while open, close on Esc or a click outside, stop the page behind from scrolling, and return focus to the button that opened them. Dialog also takes wide for a form, and children for content between the description and the footer.

TSX
import { IconDots } from '@tabler/icons-react';
import { Dropdown, MenuItem, MenuLabel, MenuSeparator } from '@/components/ui/Dropdown';

<Dropdown trigger={<Button iconOnly icon={IconDots} aria-label="More" />}>
  <MenuLabel>Device</MenuLabel>
  <MenuItem index={0} onSelect={rename}>Rename</MenuItem>
  <MenuItem index={1} onSelect={restart}>Restart</MenuItem>
  <MenuSeparator />
  <MenuItem index={2} danger onSelect={remove}>Remove</MenuItem>
</Dropdown>;

Arrow keys move between items, Esc closes the menu, and focus goes back to the trigger. Give each MenuItem its position as index. placement defaults to 'bottom-end'. Pass open and onOpenChange to control it yourself.

#EmptyState and Skeleton

TSX
import { IconPlug } from '@tabler/icons-react';
import { EmptyState, Skeleton } from '@/components/ui/EmptyState';

<EmptyState
  icon={IconPlug}
  title="No devices yet"
  description="Pair your first device to see it here."
  action={<Button variant="accent">Add device</Button>}
/>

<Skeleton width="60%" height="18px" />

Show a Skeleton while data loads. It stops moving when reduced motion is on.

#Data

#Table

A sortable table with optional row selection. Rows are flat slabs. In compact density they are 44px high and lose their fill.

TSX
import { Table, type Column } from '@/components/ui/Table';

const columns: Column<Device>[] = [
  { key: 'name', header: 'Device', cell: (d) => d.name, sortBy: (d) => d.name },
  { key: 'floor', header: 'Floor', cell: (d) => d.floor, sortBy: (d) => d.floor, align: 'end' },
];

<Table
  label="Devices"
  rows={devices}
  columns={columns}
  rowKey={(d) => d.id}
  selectable
  selected={selected}
  onSelectedChange={setSelected}
/>;
Table prop What it does
rows, columns, rowKey The data, the columns and a unique ID per row. Required.
label The table's name for screen readers. Required.
selectable, selected, onSelectedChange Turn on the checkbox column and control the selection.
onRowClick Runs when a row is clicked.
empty What to show when there are no rows.
Column field What it does
key A unique ID for the column. Required.
header The header text. Required.
cell (row) => ReactNode. Draws the cell. Required.
sortBy (row) => string | number. Leave it out to make the column not sortable.
align 'start' or 'end'. Use 'end' for numbers.
wrap Lets the cell wrap, for a name with a second line under it.
width A CSS width, such as '120px'.

Useful classes inside cells: .am-table__id for IDs, .am-table__num for numbers. In a wrap cell, put the main text in <b> and the second line in <small>.

If you need a table with many features, see ListPage on the Page patterns page. It adds search, filters, bulk actions and pagination.

#Pagination

TSX
import { Pagination } from '@/components/ui/Pagination';

<Pagination page={page} pages={12} onPageChange={setPage} />;

It shows five page keys at a time, and the first and last pages are always reachable.

#Tabs

A segmented control. Use it for tabs, filters and modes.

TSX
import { Tabs } from '@/components/ui/Tabs';

<Tabs
  label="Mode"
  value={mode}
  onChange={setMode}
  items={[
    { value: 'heat', label: 'Heat', icon: IconFlame },
    { value: 'cool', label: 'Cool', icon: IconSnowflake },
    { value: 'auto', label: 'Auto' },
  ]}
  accent
/>;

Arrow keys move between tabs. accent colors the active tab tangerine. Each item can also have a badge.

#Icons

Atmosphere uses Tabler Icons, outline style, through the @tabler/icons-react package. All 5,000+ icons are available.

TSX
import { IconBolt } from '@tabler/icons-react';
import { Icon } from '@/components/ui/Icon';

<Icon icon={IconBolt} size={20} />
<Icon icon={IconBolt} label="Energy" />
Prop What it does
icon The icon component. Required.
size 16, 18, 20 or 24. Default 18.
label Makes the icon readable by screen readers. Without it, the icon is hidden from them, which is right when a word is next to it.

<Mark size={44} /> draws the product logo: a house with a flame on a tangerine keycap. It appears in the sidebar and on the sign-in pages. See Theming to replace it.