Navigation

v0.0.4
Building

Choosing a component

Choose a component by the task, persistence and input it needs, then check its contract and script requirements.

On this page

Choose a component by what the reader needs to do and how the result should behave. A confirmation that blocks the next action needs a dialog; details that can be dismissed by clicking outside fit a popover. Both can have valid markup, so the checker cannot make this decision for you.

Read the row that matches the job, then check the component page for its markup, script requirement and browser fallback. Each contract carries the same choice guidance for one component, in use and instead.

Before choosing, decide whether the content must stay visible, whether a value belongs in a form, and whether the action blocks other work. Those constraints usually matter more than the shape of the control.

#Something appears over the page

The jobComponent
A task that must be finished or dismissed before going on: confirm, edit, sign indialog
A panel from an edge with a list, filters or details beside the pagedialog with dialog-drawer
A panel from the bottom on a phonedialog with dialog-sheet
A small surface with fields or details, opened by a button, that light-dismissespopover
A list of actions opened by a button, or at the pointermenu
A short label for a control, on hover and focustooltip
Search across every command and page, opened by a shortcutcommand

#A message

The jobComponent
The result of what the reader just did, which can leave by itselftoast
Something about this part of the page, which stays in the flowalert
One line everyone on the page should see, across the topbanner
A view has nothing to show yetempty
A field is wrongfield-error in field, with aria-invalid or :user-invalid on the control

#Work is under way

The jobComponent
Unknown duration, small, beside a labelspinner
Content is on its way and its shape is knownskeleton
Words that say work is under way: thinking, generatingshimmer
A known share of the work is doneprogress
A reading within a range, not a task: disk used, a scoremeter

#One or several of a set

Scanning or searching for a value

Choose by how the value is found. A select suits options that can be scanned directly. A combobox adds typing to find one option in a longer list; both return one chosen value.

The jobComponent
One of two to five options that stay visible, switching a viewsegmented
One of several, each a word or tworadio in check
One of several, each needing a sentencechoice
One from a list of up to a screenselect
One from a long list, found by typingcombobox
Several independent yes or nocheckbox in check
A setting that applies at onceswitch
Filters that toggle, or values that can be removedchip
A colorswatch
A score out of a fewrating
A plain date entered in a forminput with type="date", using the device's picker
A date or range with the month kept in viewcalendar, in a popover for a picker

#A number or a text

The jobComponent
An approximate value on a scaleslider
Two ends of a rangerange
A small exact count, stepped by onestepper
Any other number, a text, a fileinput
A value picked by turning, on touch: a time, a unitwheel
A short code sent to the readerotp
A message or a prompt with tools under itcomposer
Files, dropped or chosendropzone

#Getting around

The jobComponent
The bar at the top of a site or an appnavbar
The main destinations of a small-screen app, at the bottomtabbar
Destinations down the sidenav
Things that contain things: files, a document outlinetree
Views of one subject, one at a timetabs
Where this page is in the sitebreadcrumb
The pages of a long listpagination
A short sequence and where the reader is in itsteps
The headings of this pagetoc

#Records and figures

The jobComponent
Many records with the same columns, compared down a columntable
Records as rows with media, words and an actionlist
The facts about one thingdata-list
One figure and how it movedstat
A few numbers comparedchart
Many small numbers over time or a gridheatmap
Events in ordertimeline
One filefile
A turn of a conversationmessage

#Surfaces

The jobComponent
A raised face for contentsheet, or card when it has a header, media and a footer
A recess that holds sheetstray
A recess inside a sheet: a code sample, a read-only valuewell
The one ink surface of a page, for the moment that asks for somethingsheet-inverse
A screenshot or a demo in the frame of an applicationwindow

#It is not a component

Some jobs have no row above because no component does them.

The jobWhat it isWhat to write
How the room inside a region is arranged: a stack, tiles, a reading columnA layoutUtilities, or a layout class where they cannot say it: auto-grid, bento, masonry, breakout, sticky-stack, form
A stretch of a page with a purpose: a hero, a pricing table, a sign-in cardA blockIts markup, copied: components and utilities, composed
Where the regions of a whole screen go and what scrollsA pageIts markup, copied, on one of the two frames: page or shell

Start from those examples and compose the existing classes with utilities. The introduction explains when shared material, state, platform behavior or geometry warrants a component class.

#The same guidance in a contract

Every contract has a use field, which says when to reach for the component, and an instead list, which names the neighbor that is right in another situation. Read them from the command line:

npx master-ui contract combobox

The output is the whole contract. These are the fields that answer "is this the right one":

{  "name": "combobox",  "use": "One value from a list too long to scan, found by typing.",  "instead": [    { "when": "The list is short enough to read without typing", "use": "select" },    { "when": "The list runs commands instead of filling a field", "use": "command" }  ]}

contract also takes a class name, so npx master-ui contract dialog-drawer prints the contract of the dialog. npx master-ui list prints every contract with its description, one line each.

The tables on this page start from the job and lead to a component. instead starts from a component and leads away from it. An agent that has already picked a component reads its contract and gets the second check without reading this page.

Once a component fits, copy its example and check its script and platform fields before wiring it into the page. Run the markup checker, then exercise the intended task with the keyboard and pointer; a clean check establishes markup constraints, not that the component suits the task.