# Xerobi UI usage guide for AI tools

Package: `@xerobi/ui` (React 19, Tailwind CSS v4, Base UI). 84 components, 9 blocks.

## Setup

```css
@import "tailwindcss";
@import "@xerobi/ui/styles.css";
```

```tsx
import { Button } from "@xerobi/ui/button"
```

Granular imports (`@xerobi/ui/<name>`) are preferred. The barrel `@xerobi/ui` also works.

## Rules for generated code

1. Use tokens through Tailwind utilities: `bg-primary`, `text-text-secondary`, `rounded-md`, `z-modal`. Never write hex values or numeric z-index.
2. Semantic colours are `primary`, `secondary`, `info`, `success`, `warning`, `error`. Change the brand by changing the primary only.
3. Breakpoints are `sm` 600, `md` 900, `lg` 1200, `xl` 1536. They are not Tailwind's defaults.
4. Use the component's own variants before adding classes. Pass `className` for layout only (margin, width, grid placement).
5. Icons are Lucide, stroke width 2, 16px inside controls. Icon-only buttons need `aria-label`.
6. Forms use the `form` block (TanStack Form). Tables use the `data-table` block (TanStack Table).
7. Every interactive element keeps a visible focus style. Do not add `outline-none` without `focus-visible` styles.
8. Components that need the client are marked `"use client"`; they work in Next.js, TanStack Start and Astro (use a client directive).

## Variants at a glance

- Alert: variant (default, destructive, info, success, warning, outlined-info, outlined-success, outlined-warning, outlined-error)
- Badge: variant (default, secondary, destructive, outline, ghost, link, filled, soft, outlined, inverted)
- Button: variant (default, outline, secondary, ghost, destructive, link, soft); size (default, xs, sm, lg, icon, icon-xs, icon-sm, icon-lg)
- Button Group: orientation (horizontal, vertical)
- Chip: size (medium, small); variant (filled, soft, outlined); clickable (true, false)
- Input Group: align (inline-start, inline-end, block-start, block-end); size (xs, sm, icon-xs, icon-sm)
- Item: variant (default, icon, image); size (default, sm, xs)
- Tabs: variant (default, line, pill)
- Toggle: variant (default, outline); size (default, sm, lg)

## Components

### Actions

- `button`: Primary interactive control with variants, sizes, semantic colours, loading state and press ripple.
- `button-group`: Joins related buttons into one segmented control.
- `toggle`: Two-state button that stays pressed.
- `toggle-group`: Set of toggles with single or multiple selection.

### Forms

- `calendar`: Month grid for choosing a single date, several dates or a range.
- `checkbox`: Binary or indeterminate selection control.
- `combobox`: Input with a filterable list of options and optional multiple selection.
- `country-select`: Country picker with flags and search.
- `custom-date-range-picker`: Date range input with a calendar popover and range presets.
- `editor`: Rich text editor with toolbar, built on Tiptap.
- `form-label`: Label with required and optional markers for form fields.
- `input`: Single-line text field.
- `input-group`: Input with leading and trailing addons, icons and buttons.
- `input-otp`: One-time passcode field split into separate slots.
- `native-select`: Styled native select element.
- `number-input`: Numeric field with increment and decrement controls.
- `phone-input`: Telephone field with country calling code selection.
- `radio-group`: Single choice from a set of options.
- `rating`: Star rating input and display.
- `select`: Choose one option from a list in a popup.
- `slider`: Select a value or range by dragging a thumb.
- `switch`: On and off toggle with immediate effect.
- `textarea`: Multi-line text field.
- `upload`: Drag-and-drop file picker with previews and validation.

### Navigation

- `breadcrumb`: Path of links showing where the current page sits in the hierarchy.
- `custom-breadcrumbs`: Page header breadcrumb with heading, actions and link list.
- `custom-tabs`: Tab bar with labelled panels in scrollable and fixed layouts.
- `menubar`: Horizontal bar of menus, as in a desktop application.
- `navigation-menu`: Site navigation with dropdown content panels.
- `pagination`: Page controls for long lists and tables.
- `tabs`: Switch between related panels in the same context.

### Overlays

- `alert-dialog`: Modal that interrupts the flow to confirm a destructive or irreversible action.
- `command`: Searchable command palette with groups, shortcuts and keyboard navigation.
- `context-menu`: Menu opened by right click or long press on a target.
- `custom-dialog`: Dialog with title, content and action slots wired for forms.
- `custom-popover`: Popover positioned from a trigger with arrow and placement options.
- `dialog`: Modal window that traps focus and blocks the page behind it.
- `drawer`: Panel that slides in from an edge of the screen.
- `dropdown-menu`: Menu of actions opened from a trigger button.
- `hover-card`: Preview card shown when hovering or focusing a link.
- `popover`: Floating panel anchored to a trigger.
- `sheet`: Edge-anchored panel for secondary tasks, built on the dialog.
- `tooltip`: Short text label shown on hover or focus.
- `walktour`: Guided product tour that highlights elements in sequence.

### Feedback

- `alert`: Inline message with title and description for info, success, warning and error states.
- `empty-content`: Empty state with icon, title, description and call to action.
- `loading-screen`: Full-page loading and splash states.
- `progress`: Bar showing completion of a task.
- `progress-bar`: Thin page-level progress indicator for navigation and loading.
- `search-not-found`: No-results state for searches and filters.
- `skeleton`: Placeholder shaped like content while it loads.
- `snackbar`: Brief message that appears at the edge of the screen and dismisses itself.
- `spinner`: Indeterminate loading indicator.

### Data display

- `avatar`: User image with fallback initials, status badge and grouping.
- `badge`: Small label for status, counts and categories in filled, soft, outlined and inverted styles.
- `chart`: ApexCharts wrapper themed from design tokens; loaded on demand.
- `chip`: Compact element for tags, filters and selected values, optionally removable.
- `item`: List row with media, title, description and actions.
- `kbd`: Keyboard key and shortcut hint.
- `label`: Coloured status label for tables and lists.
- `map`: Mapbox GL map with markers, popups and controls; loaded on demand.
- `markdown`: Renders Markdown with the design system's typography and code styles.
- `organizational-chart`: Hierarchical tree of people or units.
- `table`: Semantic table primitives: header, body, row, cell and caption.

### Disclosure

- `accordion`: Vertically stacked sections that expand and collapse, one or several open at a time.
- `collapsible`: Single region that shows or hides its content from a trigger.

### Layout

- `aspect-ratio`: Container that holds its content to a fixed width to height ratio.
- `card`: Surface with header, content, footer and action regions.
- `resizable`: Panels the user can resize with a drag handle or keyboard.
- `scroll-area`: Scroll container with themed scrollbars.
- `scrollbar`: Custom scrollbar for overflow regions.
- `separator`: Horizontal or vertical divider.

### Media

- `carousel`: Horizontally scrolling set of slides with previous and next controls.
- `file-thumbnail`: Preview tile for a file by type, with image preview and actions.
- `flag-icon`: Country flag by ISO code.
- `image`: Image with lazy loading, blur placeholder and aspect ratio.
- `lightbox`: Full-screen image viewer with zoom and navigation.
- `logo`: Xerobi logo as a link or inline mark.
- `svg-color`: SVG rendered as a mask so it takes the current text colour.

### Utilities

- `animate`: Motion primitives: animated borders, scroll progress and entrance transitions.
- `color-utils`: Helpers for colour conversion and contrast on the client.
- `direction`: Provider that sets left-to-right or right-to-left reading direction.
- `ripple`: Material-style press ripple, used by buttons, toggles and tabs.
- `theme-provider`: Provides colour mode, direction and brand colour to the tree, and applies them to the document.

## Blocks

- `data-table`: Table with sorting, filtering, pagination, column visibility and row selection on TanStack Table.
- `filters-result`: Applied-filter chips with a clear-all action and result count.
- `form`: Form and field components on TanStack Form with validation and error display.
- `mega-menu`: Multi-column navigation menu for the top bar. Requires: nav-core.
- `nav-basic`: Simple vertical navigation list. Requires: nav-core.
- `nav-core`: Shared navigation item, group and link primitives used by the other nav blocks.
- `nav-section`: Grouped navigation with section headings and collapsible items. Requires: nav-core.
- `settings`: Settings drawer for colour mode, direction, contrast, font and brand preset.
- `sidebar`: Collapsible application sidebar with mini variant.

## Platforms

This registry currently describes the web (React) library. Entries sit under `platforms.web` so React Native and Flutter definitions can be added beside it without changing consumers.
