Skip to content

Common components

The Common subpath holds the building blocks that work with ordinary React state and need no Arc command binding. Import them from @cratis/components/Common:

import { Button, ComboBox, DatePickerInput, TextInput } from '@cratis/components/Common';

CratisComponentsProvider is also re-exported here, but the conventional import is the package root, @cratis/components. Mount it once at the application root to supply the locale and Components-owned labels; see CratisComponentsProvider.

When the value belongs to an Arc command, use the matching CommandForm field instead of wiring a Common control to the command yourself.

You want to…UseReference
Enter free text on one or several linesTextInput, TextAreaBasic controls
Enter a number with locale separators, fraction rules, bounds, or a nullable valueNumberInputLocale-aware number input
Enter a date or a date and timeDatePickerInputDatePickerInput
Put an icon addon in front of your own inputFormElementFormElement
You want to…UseReference
Turn one option on or offCheckbox or SwitchBasic controls
Pick one of a few options that are all visibleRadio, or ToggleGroup for a segmented controlBasic controls, Collection controls
Pick one entity by typing to search, with loading, empty, failure and add-new statesComboBoxComboBox
Pick one or more values from a known, small listDropdown (separate subpath)Dropdown
Edit a set of values as removable tagsTagGroupCollection controls
You want to…UseReference
Run one actionButton, or IconButton for an icon-only actionBasic controls
Show a row of page-level command actionsActionMenubarActionMenubar
Switch between views of the same contentTabsCollection controls
Show where the user is in a hierarchyBreadcrumbsCollection controls
Give a routed view a full-height layout and titlePagePage
Group content in a bounded div, section, or articleSurfaceBasic controls
Show a short hint on hover and keyboard focus of one elementTooltipTooltips
You want to…UseReference
Pass an icon as a React node or icon-font classIcon, IconDisplayIcon
Set the locale, owned labels, icons, or the app-wide toasterCratisComponentsProviderCratisComponentsProvider
Stop a render failure from taking down the whole screenErrorBoundaryErrorBoundary

Modal content, confirmations, and busy states are in the separate Dialogs subpath. For choices that span several subpaths, such as a table versus a data page, see Choosing a component. To restyle any of these controls, start with the Styling overview.