Design system

The parts
of the app

The Chatto web app is built from a small set of shared parts. This page shows the best of them.

Each example is the real component of the web app, with its real styles. The controls below are the appearance settings of the app. Change them, and each example follows.

Theme
Accent

Four surface levels

Chatto separates the areas of a screen with fills. Four surface colours give four levels.

  • A nested element goes up one level at most. background contains surface, surface contains surface-emphasized, and surface-emphasized contains surface-strong.
  • If one level does not separate two areas sufficiently, add a border or change the composition. Do not skip a level.
  • The light theme and the dark theme are not mirror images. In the light theme, surface is a tinted grey for the parts that stay on the screen. In the dark theme, each level is lighter than the level below it.
  • In the light theme, white is for form fields.

Source themes.csstokens.css

A colour has a meaning

A colour token names an intent, not a look. Feature code uses action or danger, and never a palette colour such as blue.

  • action is the accent that the user selects. Nine accents exist, and cyan is the default. Change the accent above.
  • The warning, danger, presence, and server identity colours do not change with the accent.
  • The accent is never the only sign of a status.
  • A Pill is the label for a status or a scope. It replaces each one-off coloured badge.

Source Pill.sveltethemes.css

Depth is a setting

Raised controls have a faint highlight at the top and a soft rim. Empty indicators look recessed. The user decides how much.

  • The Depth setting goes from 0 to 100. At 0 the app is flat, 50 is the default, and 100 is very 3D. Move the slider above.
  • Feature code does not add its own gradient or shadow. It uses the shared depth utilities, such as control-raised and surface-lowered.
  • Buttons have no cast shadow. A pressed button changes its fill. A ghost button stays flat, and a disabled control has no depth.

Source controls.cssthemes.css

One recommended action

Button has one variant for each meaning. The default variant, action, marks the recommended action.

  • neutral gives emphasis without competition with the recommended action. secondary is for Cancel and for quiet alternatives. ghost is for commands of low emphasis.
  • warning and danger are for actions that have that meaning themselves.
  • danger-secondary stays quiet until hover or focus. danger-ghost is a state that becomes a destructive action, such as Joined, which changes to Leave.
  • Each settings panel has one recommended action.
  • A button with a label has large round corners at each size.

Source Button.svelteactions.css

Fields that agree

Each type of field has one component. The label, the description, and the error are in the same position in each of them.

  • A field with focus shows the action colour on its border. An invalid field shows the error colour in the same way. Type a capital letter in the room address.
  • Checkbox is for an independent setting that is on or off. ChoiceRow is for one choice from a short list that stays visible.
  • Select is for a compact choice from a long list. SegmentedControl is for a compact choice of one mode.

Source TextInput.svelteSelect.svelteCheckbox.svelteChoiceRow.svelteSegmentedControl.svelte

Small signals

Small parts tell the user what the state is: a chip, a badge, a bar, a notice.

  • A ToggleChip is a label that the user can switch on and off.
  • A Hint is a notice in its context. A plain Hint is a short note below a form or an action. A panel is not an alert.
  • LoadingDots shows that content loads. Chatto does not draw rows in the shape of the content that will come.

Source ToggleChip.svelteHint.svelteNotificationBadge.svelteProgressBar.svelteLoadingDots.svelte

Containers

A Panel holds content that stays. It gives the border, the corner radius, and the title, so feature code does not make its own cards.

  • A row in a panel uses surface-box. Do not put a panel in a panel.
  • EmptyState is the placeholder for an empty collection or an empty search result.
  • A StatCard shows one number with its label.

Source Panel.svelteEmptyState.svelteStatCard.svelte

The complete system

This page is a selection

The design system guide All rules, with the reasons: which part to use for each need, and what to avoid.
Storybook The catalogue of each component in each state. Run mise storybook in the repository.
Esc