About Atomic Design
Shared components let Hello Tractor reuse interface patterns across its web platforms while tailoring access, features, and themes to each audience.
Design for reuse across products
The learning management system (LMS) and Tractor Owner (TO) web app can share buttons, field composition, helper text, validation, and the navigation shell. The LMS can supply training content while TO supplies tractor records. Build recurring interaction and accessibility patterns early so both products can use them as requirements emerge.
Documenting every theoretical scenario upfront can waste time if business priorities shift. Start by documenting core Atoms and Molecules thoroughly, and build Organism/Page scenarios incrementally as product requirements solidify.
This demo’s sidebar uses a fixed-width navigation column beside a flexible main column on desktop. On phones the navigation reflows above the content, and the demo controls follow it below the main area.
Open a level to try the component and read the code. Component Story Format (CSF) uses the default export for component metadata, default args and Docs descriptions. Named exports define individual scenarios. Play functions simulate interactions in the story.
Brad Frost’s Atomic Design methodologyAtom · Save Note button
Basic building blocks like buttons, inputs, labels, and icons.
The button exposes disabled and onClick. Its text supplies the accessible name. Hover uses primary.dark and common.white. Tab shows a focus ring using text.primary. Enter and Space activate it.
Activations: 0
Button.stories.tsx · CSF excerpt
import type { Meta, StoryObj } from '@storybook/react-vite';
import { fn } from 'storybook/test';
import { SaveNoteButton } from './components';
const meta = {
title: 'Atomic Design/Atom/Button',
component: SaveNoteButton,
args: { disabled: false, onClick: fn() },
} satisfies Meta<typeof SaveNoteButton>;
export default meta;
type Story = StoryObj<typeof meta>;
export const Default: Story = {};
export const Disabled: Story = { args: { disabled: true } };Test code
// Button.stories.tsx · keyboard interaction
export const KeyboardFocus: Story = {
play: async ({ canvas, userEvent, args }) => {
const button = canvas.getByRole('button', { name: 'Save note' });
await userEvent.tab();
await expect(button).toHaveFocus();
await userEvent.keyboard('{Enter}');
await expect(args.onClick).toHaveBeenCalled();
},
};Open Save Note button Docs in StorybookMolecule · Notes Editor
Small groups of atoms working together, such as a search bar or form.
This molecule combines a labeled field, helper or validation text, and the Save Note atom. Clear the field to see the linked error. Type a valid change to enable Save. Storybook also shows read-only and unavailable states.
Field notes
Include the nearest landmark for the next operator.
components.tsx · Notes Editor excerpt
<TextField
id={inputId}
label="Note"
error={!!error}
helperText={error || helperText}
/>
<SaveNoteButton
disabled={!!error || !trimmed || trimmed === value}
onClick={() => onSave(trimmed)}
/>Test code
// NotesEditor.stories.tsx · validation and accessibility
export const ValidationError: Story = {
play: async ({ canvas, userEvent }) => {
const field = canvas.getByRole('textbox', { name: 'Note' });
await userEvent.clear(field);
await expect(field).toHaveAttribute('aria-invalid', 'true');
await expect(field).toHaveAccessibleDescription('Enter a note before saving.');
await expect(canvas.getByRole('button', { name: 'Save note' })).toBeDisabled();
},
};Open Notes Editor Docs in StorybookOrganism · Tractor Details
Larger UI sections made of molecules and atoms, like a header, footer, or product grid.
The panel combines the Status Badge atom, tractor context, and the Notes Editor molecule. Try Narrow preview to stack cards and Show notes to see how the cards change height. The same preview mixes inside, overlap, and outside tractors with editable, read-only, and hidden notes.
Thika 01
HT-1042 · DEMO 042
Thika North
Assigned territory · Thika NorthOperator · Grace Wanjiku-1.105° lat · 37.091° lonField notes
160 characters maximum.
Thika 04
HT-1168 · DEMO 168 · Archived
Thika North / Juja East
Assigned territory · Thika NorthOperator · Mercy Chebet-1.129° lat · 37.150° lonField notes
Juja 03
HT-2086 · DEMO 086
Outside mapped territories
Assigned territory · Juja EastOperator · Brian Otieno-1.197° lat · 37.191° lonTractor Details · composition and CSF excerpts
// Inside TractorDetails, using props supplied by the workflow
<StatusBadge status={statusOf(tractor)} />
<NotesEditor {...notes} />
// In TractorDetails.stories.tsx
export const ResponsiveCombinations: Story = {
render: () => <DetailsDemo />,
};Test code
// Chrome smoke check · mixed-state details preview
const row = page.locator('.details-demo');
assert.equal(await row.locator('.details-card').count(), 3);
await page.getByRole('checkbox', { name: 'Narrow preview' }).click();
assert.ok((await row.boundingBox()).width <= 301);
await page.getByRole('checkbox', { name: 'Show notes' }).click();
assert.equal(await row.getByRole('region', { name: 'Notes' }).count(), 0);Open Tractor Details Docs in StorybookTemplate · Workspace layout
Page-level wireframes or layouts that arrange organisms into a content structure.
WorkspaceTemplate arranges slots. The geofence workflow supplies a map and results. Tractor Activity fills the same layout with an event list.
Thika 01
HT-1042 · DEMO 042
Thika North
Assigned territory · Thika NorthOperator · Grace Wanjiku-1.105° lat · 37.091° lonField notes
160 characters maximum.
Workflow.tsx · template usage
<WorkspaceTemplate
map={<TerritoryMap {...mapProps} />}
results={<TractorResults {...resultProps} />}
details={<DetailInstances {...props} />}
/>Open Workspace layout Docs in StorybookPage · Geofence workspace
Final screens populated with real content to test how the system holds up.
The running workspace fills the template with realistic Kenyan demo records, selection, and resolved access. The live route also connects its filters to the URL.
Hub Geofence
Monitor tractor locations and territory activity.
Territory map
Kiambu County, Kenya · Synthetic boundaries
Tractors
3 visible · Demo records
| Tractor | Territory | Status |
|---|---|---|
| HT-1042 | Thika North | Inside |
| HT-2086 | Juja East | Outside |
| HT-1168 | Thika North | Overlap |
Thika 01
HT-1042 · DEMO 042
Thika North
Assigned territory · Thika NorthOperator · Grace Wanjiku-1.105° lat · 37.091° lonField notes
160 characters maximum.
pages/geofence.tsx · route composition
const { workflow } = useDemoWorkflow();
return <GeofencePage {...workflow} filters={filters} />;Open the Geofence page story