Getting started
Installation
Two packages, two stylesheets, no build plugins.
Install the packages
ReactLoom uses the @reactloom package scope. Start with the core components and theme.
pnpm add @reactloom/ui @reactloom/theme
# npm install @reactloom/ui @reactloom/theme
# yarn add @reactloom/ui @reactloom/theme
Peer dependencies: react and react-dom 18.2 or newer (19 supported).
Import the styles
Import both stylesheets once, at your application entry. Their order does not matter — both declare the same cascade-layer order.
import '@reactloom/theme/theme.css'; // tokens + built-in themes
import '@reactloom/ui/styles.css'; // component stylesPer-component CSS (optional)
styles.css contains every component. If CSS size matters, import only the modules you use instead — each file is under 2.5 kB gzip:
import '@reactloom/theme/theme.css';
// Instead of '@reactloom/ui/styles.css':
import '@reactloom/ui/css/button.css';
import '@reactloom/ui/css/actions.css'; // IconButton, CloseButton (used by Dialog)
import '@reactloom/ui/css/dialog.css';| Components | Import |
|---|---|
| Box, Stack, Grid, Container, Divider, AspectRatio | css/layout.css |
| Text, Heading, Link, Code, Kbd, lists | css/typography.css |
| Button | css/button.css |
| IconButton, CloseButton, ButtonGroup, ToggleButton | css/button.css + css/actions.css |
| Spinner | css/spinner.css |
| Input, Textarea, PasswordInput, SearchInput | css/field.css + css/button.css + css/actions.css + css/input.css |
| Checkbox, Radio, Switch, SegmentedControl | css/field.css + css/choice.css |
| FormField, Fieldset | css/field.css |
| Card | css/card.css |
| Dialog | css/button.css + css/actions.css + css/dialog.css |
| Alert, Banner, Badge, Tag, Progress, Skeleton | css/feedback.css |
| Avatar, AvatarGroup | css/avatar.css |
| Accordion, Collapsible | css/disclosure.css |
The same mapping ships as @reactloom/ui/css/manifest.json for tooling.
Optional packages
Heavier families ship as separate packages, so apps that do not need them pay nothing. Each one adds its own stylesheet after the core one.
pnpm add @reactloom/dates
import '@reactloom/theme/theme.css';
import '@reactloom/ui/styles.css';
import '@reactloom/dates/styles.css'; // DatePicker, Calendar, DateField…Bundle size
Every component is a separate ES module, so you only ship what you import. Measured sizes (minified + brotli, React excluded):
| Import | Size |
|---|---|
| Stack, Text | < 1 kB each |
| Button, Input, Card, Tabs, Pagination | 1–1.5 kB each |
| Dialog, Drawer | ~3 kB |
| Popover (positioning engine included) | ~8 kB |
| Tooltip, Menu, Select, Combobox (React Aria) | 13–45 kB individually; ~44 kB for all four together |
The interactive widgets use React Aria for their keyboard and screen-reader behaviour. Its core is shared, so each additional React Aria component adds only a few kilobytes. If you support few languages, React Aria’s @react-aria/optimize-locales-plugin removes unused translations (~2 kB).
Add a ThemeProvider (optional)
Without a provider, components use the light theme declared on :root. Wrap your app to follow the OS preference or switch at runtime:
import { ThemeProvider } from '@reactloom/theme';
import { Button } from '@reactloom/ui';
export function App() {
return (
<ThemeProvider defaultTheme="system">
<Button onClick={() => alert('Hello')}>Get started</Button>
</ThemeProvider>
);
}If you have global CSS
ReactLoom’s CSS lives in cascade layers, so un-layered CSS wins — including global element rules such as a { color }. Put resets in a layer declared before ReactLoom’s:
<style>@layer reset, base, pl;</style>Compatibility
| React | 18.2+, 19 — tested on both in CI |
|---|---|
| Browsers | Last two versions of Chrome, Edge, Firefox and Safari (incl. iOS) |
| Bundlers | Any ESM bundler: Vite, webpack 5, Rspack, Next.js, Parcel |
| TypeScript | 5.0+; types resolve with moduleResolution bundler and node16 |
| SSR | Yes — see Next.js & SSR |
| Policy | Semantic versioning with documented deprecation notices across major releases. |