# Rax: calm React components for data-heavy apps Rax is a small React 19 system with flat surfaces, strong contrast and one accent you choose, in light and dark. ## Install ```sh pnpm add @a31labs/rax react react-dom lucide-react ``` ```css @import "@a31labs/rax/styles.css"; ``` Each component has its own entry, such as `@a31labs/rax/button`. The full rules are at https://rax.a31.at/foundations/rules.md. --- # All components Every component with a live preview, by group. ## Actions - [Button](https://rax.a31.at/components/button.md): Starts an action. One primary per view region. - [Icon button](https://rax.a31.at/components/icon-button.md): A button with only an icon, for universally known actions. The label is required. - [Theme toggle](https://rax.a31.at/components/theme-toggle.md): Switches the page between light, dark and system. ## Forms - [Field](https://rax.a31.at/components/field.md): Label on top, control, hint below. Validates on blur, then live. - [Input](https://rax.a31.at/components/input.md): Single-line text entry. - [Textarea](https://rax.a31.at/components/textarea.md): Multi-line text entry. - [Select](https://rax.a31.at/components/select.md): One value from a short list. Same shape as Input. - [Checkbox](https://rax.a31.at/components/checkbox.md): Choices in a form that submits. - [Radio](https://rax.a31.at/components/radio.md): One choice out of a few, all visible at once. - [Switch](https://rax.a31.at/components/switch.md): An on/off setting that applies immediately. - [Copy field](https://rax.a31.at/components/copy-field.md): A read-only value with a copy button that confirms inline. - [Search input](https://rax.a31.at/components/search-input.md): Text entry for filtering a list. Escape clears. - [Date picker](https://rax.a31.at/components/date-picker.md): One calendar day as a plain YYYY-MM-DD string. - [Date range picker](https://rax.a31.at/components/date-range-picker.md): A period of days, with presets beside two months. - [Time input](https://rax.a31.at/components/time-input.md): A time of day as HH:mm. - [Date time picker](https://rax.a31.at/components/date-time-picker.md): An instant, picked as wall-clock time in a chosen zone. - [Combobox](https://rax.a31.at/components/combobox.md): Type to find one or several values in a longer list. - [Tag input](https://rax.a31.at/components/tag-input.md): Free-form values entered as removable tags. - [Color input](https://rax.a31.at/components/color-input.md): A hex colour with a swatch. - [File drop](https://rax.a31.at/components/file-drop.md): Drop or choose files, with type and size limits. - [Tile group](https://rax.a31.at/components/tile-group.md): One choice from a few options that need a description. - [Chip group](https://rax.a31.at/components/chip-group.md): Pick several topics or filters, optionally ranked. - [Number input](https://rax.a31.at/components/number-input.md): Numeric entry with min, max, step, locale formatting and optional step buttons. - [Password input](https://rax.a31.at/components/password-input.md): Password field with a show/hide toggle. - [Slider](https://rax.a31.at/components/slider.md): Pick a value or a range by dragging or with the arrow keys. - [OTP input](https://rax.a31.at/components/otp-input.md): One-time code entry with one cell per character, auto-advance and paste. ## Display - [Badge](https://rax.a31.at/components/badge.md): Status and counts. Status always pairs a glyph with a word. - [Alert](https://rax.a31.at/components/alert.md): An inline message with a status. - [Avatar](https://rax.a31.at/components/avatar.md): Initials for a person. - [Kbd](https://rax.a31.at/components/kbd.md): A key or shortcut. - [Skeleton](https://rax.a31.at/components/skeleton.md): A placeholder while content loads. - [Spinner](https://rax.a31.at/components/spinner.md): Work in progress. Appears only after 100 ms. - [Stat](https://rax.a31.at/components/stat.md): Key figures in a divided grid. - [Key-value list](https://rax.a31.at/components/key-value-list.md): Labelled values, such as the details of a record. - [Empty state](https://rax.a31.at/components/empty-state.md): What to do when there is nothing to show yet. - [Timeline](https://rax.a31.at/components/timeline.md): Activity over time, newest first. - [Progress](https://rax.a31.at/components/progress.md): How far a task has come, or that it is running. - [Sparkline](https://rax.a31.at/components/sparkline.md): A tiny trend line beside a figure. - [Bar list](https://rax.a31.at/components/bar-list.md): Ranked values with proportional bars. - [Code block](https://rax.a31.at/components/code-block.md): A snippet with a copy button. - [Relative time](https://rax.a31.at/components/relative-time.md): A time such as 5 minutes ago, with the exact date on hover. - [Indicator](https://rax.a31.at/components/indicator.md): A dot or count bubble on a corner of an avatar, icon button or any other element. - [Highlight](https://rax.a31.at/components/highlight.md): Marks every match of a search query inside text. - [Aura](https://rax.a31.at/components/aura.md): A calm light travelling along the border of any component, to draw the eye to one recommended item. ## Navigation - [Tabs](https://rax.a31.at/components/tabs.md): Switches between views of the same content. - [Segmented control](https://rax.a31.at/components/segmented-control.md): Switches a mode or filter. One item is always pressed. - [Breadcrumbs](https://rax.a31.at/components/breadcrumbs.md): Where the page sits in the hierarchy. - [Steps](https://rax.a31.at/components/steps.md): Progress through a fixed sequence. ## Layout - [App shell](https://rax.a31.at/components/app-shell.md): Top bar with brand, navigation and actions. - [Sidebar shell](https://rax.a31.at/components/sidebar-shell.md): A wide sidebar with icon navigation, sections and the user at the bottom. - [Rail shell](https://rax.a31.at/components/rail-shell.md): A top bar with context pickers, an icon rail and an optional page column. - [Page header](https://rax.a31.at/components/page-header.md): Title, breadcrumbs and the page's actions. - [Panel](https://rax.a31.at/components/panel.md): Groups content on a surface. Never a panel inside a panel. - [Separator](https://rax.a31.at/components/separator.md): A 1px divider. - [Accordion](https://rax.a31.at/components/accordion.md): Show and hide sections of content. - [Card](https://rax.a31.at/components/card.md): A linked or static summary of one item, in a grid. ## Overlays - [Dialog](https://rax.a31.at/components/dialog.md): For blocking decisions only. Focus is trapped and Escape closes. - [Confirm dialog](https://rax.a31.at/components/confirm-dialog.md): Confirms an irreversible action. Focus starts on Cancel. - [Popover](https://rax.a31.at/components/popover.md): Extra detail anchored to a trigger. - [Menu](https://rax.a31.at/components/menu.md): A short list of actions behind a trigger. - [Tooltip](https://rax.a31.at/components/tooltip.md): A hint on hover and focus. Never the only place for information. - [Toast](https://rax.a31.at/components/toast.md): Feedback after an action. Stays until dismissed. - [Drawer](https://rax.a31.at/components/drawer.md): A sheet from the left or right edge. Focus is trapped. ## Data - [Data table](https://rax.a31.at/components/data-table.md): Sorting, filtering, selection and paging, on the client or the server. - [Filter bar](https://rax.a31.at/components/filter-bar.md): One row of filters above a table. - [Pagination](https://rax.a31.at/components/pagination.md): Moves through pages of results. - [Selection bar](https://rax.a31.at/components/selection-bar.md): Bulk actions for the current selection. - [Sortable list](https://rax.a31.at/components/sortable-list.md): Reorder rows by drag or keyboard. ## Charts - [Area chart](https://rax.a31.at/components/area-chart.md): One or more measures over time, on one axis. - [Bar chart](https://rax.a31.at/components/bar-chart.md): Compares values across categories: grouped, stacked or horizontal. - [Line chart](https://rax.a31.at/components/line-chart.md): Several series over time where fills would overlap. - [Pie and donut chart](https://rax.a31.at/components/pie-chart.md): Parts of a whole, up to five slices. - [Radial chart](https://rax.a31.at/components/radial-chart.md): One value against a target. - [Chart tooltip](https://rax.a31.at/components/chart-tooltip.md): Tooltip and legend content shared by every chart. Page: https://rax.a31.at/components/all --- # Button Starts an action. One primary per view region. Import from `@a31labs/rax/button`. ## Usage ```tsx ``` ## Rules Props: `variant` (`primary` | `secondary` default | `outline` | `ghost` | `danger`), `tone` (`accent` default | `ok` | `warn` | `danger`; colours primary and outline buttons), `size` (`default` | `sm`), `loading`, plus native button props (`type` defaults to `button`). Primary is accent fill; secondary is surface with an `edge` outline; ghost has no fill and ink-2 text; danger is danger-soft with a danger outline, solid on hover. Outline is transparent with a 1px edge in the tone and its label in the tone's text colour (`--rax-accent-text`, or the status ink), the soft fill on hover. `tone` adds colour to a decision row: Approve is `primary` + `ok` (ok-ink fill), Request changes `outline` + `warn` (or `primary` + `warn`: warn fill with `--rax-warn-on` text), Decline `outline` + `danger`. Labels always name the action; colour never carries it alone. Weight 600, active state moves 1px down, disabled at 50% opacity. `loading` shows a spinner after 100ms, keeps the width, ignores clicks and sets `aria-busy`. A button with `aria-disabled="true"` looks disabled and also ignores clicks (and form submit) while staying focusable. One primary per view region. `ButtonLink` (same import) is navigation that looks like a button: a real `` with `href`, `variant`, `tone` and `size`. Never put a link inside a Button or call navigate from a Button's onClick. Page: https://rax.a31.at/components/button --- # Icon button A button with only an icon, for universally known actions. The label is required. Import from `@a31labs/rax/icon-button`. ## Usage ```tsx } variant="ghost" /> ``` ## Rules Props: `label` (required: the aria-label and the native `title` tooltip), `icon`, plus Button props except `children`. Icons without words only for universally known actions (close, more, copy, delete with confirm); everything else gets icon plus text. Page: https://rax.a31.at/components/icon-button --- # Field Label on top, control, hint below. Validates on blur, then live. Import from `@a31labs/rax/field`. ## Usage ```tsx const { error, onBlur } = useBlurValidation(url, validate); setUrl(e.target.value)} onBlur={onBlur} /> ``` ## Rules Props: `label`, `hint`, `error`, `className`, `ref` (root element), one control as the child (Input, Textarea, Select, ...). Label on top (500), hint below in ink-2 at 14px. With `error` the control gets a danger outline and the hint is replaced by the error text in danger-ink, weight 500, with the danger glyph in front. In a grid the field keeps label and control at the top when its row is taller (a neighbour with a hint), so controls in one row line up. The hook `useBlurValidation(value, validate)` returns `{ error, onBlur }`: no error until the first blur, then live while the user fixes it. Page: https://rax.a31.at/components/field --- # Input Single-line text entry. Import from `@a31labs/rax/input`. ## Usage ```tsx setName(e.target.value)} /> ``` ## Rules Native input props plus `mono`. Surface fill, `edge` outline, hover outline `ink-3`, focus ring. Placeholder only shows a format example and never replaces the label. Read-only: surface-2 fill. Disabled: 55% opacity. Page: https://rax.a31.at/components/input --- # Textarea Multi-line text entry. Import from `@a31labs/rax/textarea`. ## Usage ```tsx