# Sidebar (/docs/blocks/sidebar)
# Sidebar [#sidebar]
The `Sidebar` is a complete navigation block component designed in the style of Apple Music and Podcasts. It features collapsible groups, custom item selections, active/hover styles, glassmorphic layout options, profile/branding sections, and a responsive toggle to collapse to an icon-only view.
## Preview [#preview]
***
## Import [#import]
```tsx
import {
Sidebar,
SidebarAside,
SidebarMain,
SidebarHeader,
SidebarGroup,
SidebarItem,
SidebarFooter,
SidebarDivider,
} from '@moul-dev/ui';
```
***
## Layout Structure [#layout-structure]
The Sidebar is built as a set of compound components for complete flexibility:
```tsx
{/* Branding, search bar or logo */}
}>Home
}>Settings
{/* Account profile, user email, logout */}
{/* Main dashboard or route content */}
```
***
## Features [#features]
### Collapsible Groups [#collapsible-groups]
Wrapping navigation links in `SidebarGroup` automatically supports group collapsibility. When `collapsible` is enabled, clicking the group title toggles item visibility with a smooth grid-based transition.
### Icon-Only Collapse Mode [#icon-only-collapse-mode]
Setting the `isCollapsed` prop shrinks the sidebar to a slim icon-only strip. When collapsed:
* Text labels in `SidebarItem` are hidden.
* Hovering over a collapsed item displays a premium `Tooltip` showing the item's label.
* Group headers and sub-content are collapsed/hidden.
### Styling Variants [#styling-variants]
Supports both `solid` (flat background) and `glass` (glassmorphic translucent backdrop filter) modes out of the box using the `variant` prop.
***
## API Reference [#api-reference]
### Sidebar Props [#sidebar-props]
| Prop | Type | Default | Description |
| :------------------- | :----------------------------- | :-------- | :------------------------------------------------------------------ |
| `isCollapsed` | `boolean` | `false` | Controlled state for whether the sidebar is collapsed to icon-only. |
| `defaultCollapsed` | `boolean` | `false` | Uncontrolled default state for the collapse layout. |
| `onCollapseChange` | `(collapsed: boolean) => void` | — | Callback triggered when the collapse state changes. |
| `selectedKey` | `string` | — | The active/selected item ID (controlled). |
| `defaultSelectedKey` | `string` | — | The initial active item ID (uncontrolled). |
| `onSelectionChange` | `(key: string) => void` | — | Callback triggered when a new item is selected. |
| `variant` | `'solid' \| 'glass'` | `'solid'` | Aesthetic variant of the sidebar background. |
### SidebarAside Props [#sidebaraside-props]
| Prop | Type | Default | Description |
| :------------------- | :-------- | :------ | :------------------------------------------------------------- |
| `showCollapseToggle` | `boolean` | `true` | Renders a built-in floating chevron toggle at the bottom edge. |
### SidebarMain Props [#sidebarmain-props]
Accepts standard JSX children and compile-time StyleX layout overrides via the `style` prop.
### SidebarGroup Props [#sidebargroup-props]
| Prop | Type | Default | Description |
| :----------------- | :---------------------------- | :------ | :----------------------------------------------------- |
| `title` | `string` | — | The label text displayed at the top of the group. |
| `collapsible` | `boolean` | `true` | Whether the group can be expanded/collapsed. |
| `defaultExpanded` | `boolean` | `true` | The initial expansion state of the group. |
| `isExpanded` | `boolean` | — | Controlled expansion state. |
| `onExpandedChange` | `(expanded: boolean) => void` | — | Callback triggered when group expansion state toggles. |
### SidebarItem Props [#sidebaritem-props]
| Prop | Type | Default | Description |
| :----------- | :---------- | :------ | :------------------------------------------------------------------- |
| `id` | `string` | — | Unique key representing the item (used for selection modeling). |
| `href` | `string` | — | Render as a link using React Aria's Link capabilities. |
| `icon` | `ReactNode` | — | The SVG or custom react component rendered on the left of the label. |
| `isSelected` | `boolean` | — | Manual override to mark the item as selected. |
### SidebarFooter Props [#sidebarfooter-props]
| Prop | Type | Default | Description |
| :----------- | :-------- | :------ | :------------------------------------------------------------ |
| `showBorder` | `boolean` | `true` | Whether to display a divider border above the footer content. |
# Alert (/docs/components/alert)
# Alert [#alert]
## Preview [#preview]
The `Alert` component is built with React Aria and styled using StyleX. It supports multiple status variants, inline action buttons, close triggers, and rich custom layout slots.
## Import [#import]
```tsx
import { Alert } from '@moul-dev/ui';
```
## Variants [#variants]
You can customize the type of alert using the `variant` prop:
```tsx
```
## Actions and Closable [#actions-and-closable]
Alerts can accept an optional inline action element or a close button using `action` and `onClose` props:
```tsx
Refresh}
/>
handleClose()}
/>
```
## Rich Content (Children) [#rich-content-children]
You can pass custom children inside the `Alert` component to display nested lists, custom spacing, or elements:
We're experiencing connection issues. Please try the following:
We're experiencing connection issues. Please try the following:
Check your internet connection
Refresh the page
Clear your browser cache
);
}
```
# AlertDialog (/docs/components/alertdialog)
# AlertDialog [#alertdialog]
## Preview [#preview]
The `AlertDialog` component is built with React Aria and styled using StyleX.
## Import [#import]
```tsx
import { AlertDialog } from '@moul-dev/ui';
```
## Usage [#usage]
Here is a basic example of how to use the `AlertDialog` component:
```tsx
import {
AlertDialog,
AlertDialogHeader,
AlertDialogBody,
AlertDialogFooter,
Button
} from '@moul-dev/ui';
export default function Example() {
return (
Deactivate Account
Are you sure you want to deactivate your account? This action cannot be undone.
);
}
```
## Props [#props]
### AlertDialog Props [#alertdialog-props]
Default className: `react-aria-Dialog`
# Avatar (/docs/components/avatar)
# Avatar [#avatar]
## Preview [#preview]
The `Avatar` component is built with React Aria and styled using StyleX.
## Import [#import]
```tsx
import { Avatar } from '@moul-dev/ui';
```
## Usage [#usage]
Here is a basic example of how to use the `Avatar` component:
```tsx
import { Avatar } from '@moul-dev/ui';
export default function Example() {
return (
{/* Component content */}
);
}
```
# Badge (/docs/components/badge)
# Badge [#badge]
## Preview [#preview]
The `Badge` component is built with React Aria and styled using StyleX.
## Import [#import]
```tsx
import { Badge } from '@moul-dev/ui';
```
## Usage [#usage]
Here is a basic example of how to use the `Badge` component:
```tsx
import { Badge } from '@moul-dev/ui';
export default function Example() {
return (
{/* Component content */}
);
}
```
# Breadcrumbs (/docs/components/breadcrumbs)
# Breadcrumbs [#breadcrumbs]
## Preview [#preview]
Home
Components
Breadcrumbs
The `Breadcrumbs` component is built with React Aria and styled using StyleX.
## Import [#import]
```tsx
import { Breadcrumbs } from '@moul-dev/ui';
```
## Usage [#usage]
Here is a basic example of how to use the `Breadcrumbs` component:
```tsx
import { Breadcrumbs } from '@moul-dev/ui';
export default function Example() {
return (
{/* Component content */}
);
}
```
## Props [#props]
### Breadcrumbs Props [#breadcrumbs-props]
Default className: `react-aria-Breadcrumbs`
# Button (/docs/components/button)
# Button [#button]
## Preview [#preview]
The `Button` component is built with React Aria and styled using StyleX.
## Variants [#variants]
You can customize the appearance of the button using the `variant` prop:
```tsx
```
## Sizes [#sizes]
You can customize the size of the button using the `size` prop:
```tsx
```
## Import [#import]
```tsx
import { Button } from '@moul-dev/ui';
```
## Usage [#usage]
Here is a basic example of how to use the `Button` component:
```tsx
import { Button } from '@moul-dev/ui';
export default function Example() {
return (
);
}
```
## Props [#props]
### Button Props [#button-props]
Default className: `react-aria-Button`
| Render Prop | CSS Selector |
| :-------------------------------------------------------------- | :--------------------- |
| `isHovered` Whether the button is currently hovered. | `[data-hovered]` |
| `isPressed` Whether the button is currently pressed. | `[data-pressed]` |
| `isFocused` Whether the button is focused. | `[data-focused]` |
| `isFocusVisible` Whether the button is keyboard focused. | `[data-focus-visible]` |
| `isDisabled` Whether the button is disabled. | `[data-disabled]` |
| `isPending` Whether the button is in a pending state. | `[data-pending]` |
# ButtonGroup (/docs/components/buttongroup)
# ButtonGroup [#buttongroup]
## Preview [#preview]
The `ButtonGroup` component is built with React Aria and styled using StyleX.
## Import [#import]
```tsx
import { ButtonGroup } from '@moul-dev/ui';
```
## Usage [#usage]
Here is a basic example of how to use the `ButtonGroup` component:
```tsx
import { ButtonGroup } from '@moul-dev/ui';
export default function Example() {
return (
{/* Component content */}
);
}
```
# Card (/docs/components/card)
# Card [#card]
The `Card` component is a flexible container built with React Aria and styled using StyleX. It supports multiple design variants, sizing presets, and section borders.
## Import [#import]
```tsx
import { Card, CardHeader, CardBody, CardFooter } from '@moul-dev/ui';
```
## Preview [#preview]
***
## Variants [#variants]
Cards support three distinct aesthetic styles to match your design requirements:
### Default (Elevated) [#default-elevated]
Standard surface card featuring clean elevated shadows.
Elevated Card
Standard elevated container with shadow.
```tsx
Elevated CardStandard elevated container with shadow.
```
### Flat [#flat]
Clean card with no shadow and a subtle background fill.
Flat Card
Flat container with subtle solid background.
```tsx
Flat CardFlat container with subtle solid background.
```
### Glass [#glass]
Premium translucent glassmorphic look using backdrop blur and opacity.
Glass Card
Translucent glass card with elegant backdrop filters.
```tsx
Glass CardTranslucent glass card with elegant backdrop filters.
```
***
## Divided Layout [#divided-layout]
By default, card headers, bodies, and footers flow continuously without separation lines. Passing the `divided` boolean prop adds subtle separator lines between sections.
Divided Card
Borders separate the header, body, and footer sections.
```tsx
Divided CardBorders separate the header, body, and footer sections.
```
***
## Sizes [#sizes]
Choose between different sizing presets to customize block and inline paddings:
### Small (`sm`) [#small-sm]
Compact spacing suitable for dense layouts or list grids.
```tsx
...
```
### Medium (`md`) [#medium-md]
Balanced standard spacing (default).
```tsx
...
```
### Large (`lg`) [#large-lg]
Generous breathing spacing ideal for hero sections or details views.
```tsx
...
```
***
## API Reference [#api-reference]
### Card Props [#card-props]
| Prop | Type | Default | Description |
| :---------- | :--------------------------------------------------- | :---------- | :------------------------------------------------------------ |
| `variant` | `'default' \| 'flat' \| 'glass'` | `'default'` | The visual style variation of the card. |
| `size` | `'sm' \| 'md' \| 'lg'` | `'md'` | Padding sizes applied to the card sections. |
| `divided` | `boolean` | `false` | When true, renders borders between header, body, and footer. |
| `elevation` | `0 \| 1 \| 2 \| 3 \| 'none' \| 'sm' \| 'md' \| 'lg'` | `1` | Shadow elevation level (applies to `'default'` variant only). |
# AreaChart (/docs/components/charts/areachart)
# AreaChart [#areachart]
A modern, responsive area chart built with gradient fills and smooth curves on top of Recharts, styled with StyleX design tokens.
## Preview [#preview]
## Import [#import]
```tsx
import { AreaChart, ChartContainer } from '@moul-dev/ui';
```
## Usage [#usage]
Here is a standard example of rendering an `AreaChart` inside a `ChartContainer`:
```tsx
import { AreaChart, ChartContainer } from '@moul-dev/ui';
export default function Example() {
const data = [
{ date: 'Jan', Sales: 4000, Revenue: 2400 },
{ date: 'Feb', Sales: 3000, Revenue: 1398 },
{ date: 'Mar', Sales: 2000, Revenue: 9800 },
{ date: 'Apr', Sales: 2780, Revenue: 3908 },
{ date: 'May', Sales: 1890, Revenue: 4800 },
{ date: 'Jun', Sales: 2390, Revenue: 3800 },
];
return (
`$${val.toLocaleString()}`}
/>
);
}
```
## Edge-to-Edge Sparkline Variant [#edge-to-edge-sparkline-variant]
By setting `edgeToEdge` on `ChartContainer` and hiding axes (`showXAxis={false}`, `showYAxis={false}`), you can create compact sparkline cards:
```tsx
import { AreaChart, ChartContainer } from '@moul-dev/ui';
export default function SparklineExample() {
const sparkData = [
{ time: '01:00', load: 35 },
{ time: '02:00', load: 42 },
{ time: '03:00', load: 78 },
{ time: '04:00', load: 55 },
{ time: '05:00', load: 60 },
];
return (
);
}
```
## Props [#props]
### AreaChart Props [#areachart-props]
| Prop | Type | Default | Description |
| :--------------- | :----------------------- | :--------------------------------------------- | :----------------------------------------------------------- |
| `data` | `any[]` | — | Array of data points to plot. |
| `indexKey` | `string` | — | Object key to map onto the X-axis. |
| `categories` | `string[]` | — | Series keys to render as stacked/overlapping gradient areas. |
| `colors` | `string[]` | `CHART_COLORS` | Array of color strings or CSS variable references. |
| `height` | `number \| string` | `300` | Height of the chart container in pixels or CSS units. |
| `gridLines` | `boolean` | `true` | Whether to render background horizontal grid lines. |
| `showXAxis` | `boolean` | `true` | Show or hide X-Axis labels. |
| `showYAxis` | `boolean` | `true` | Show or hide Y-Axis labels. |
| `valueFormatter` | `(value: any) => string` | — | Formatter function for Y-axis ticks and tooltip values. |
| `margin` | `object` | `{ top: 10, right: 10, left: -20, bottom: 5 }` | Chart margin offsets. |
# BarChart (/docs/components/charts/barchart)
# BarChart [#barchart]
A highly configurable bar chart supporting vertical layouts, horizontal layouts, stacking, and custom category-based coloring.
## Preview [#preview]
## Import [#import]
```tsx
import { BarChart, ChartContainer } from '@moul-dev/ui';
```
## Usage [#usage]
### Categorical Bar Chart [#categorical-bar-chart]
Color each bar individually based on its row index (useful for single series):
```tsx
import { BarChart, ChartContainer } from '@moul-dev/ui';
export default function Example() {
const data = [
{ country: 'United States', Requests: 7530 },
{ country: 'Netherlands', Requests: 4670 },
{ country: 'Singapore', Requests: 1400 },
];
return (
);
}
```
## Props [#props]
### BarChart Props [#barchart-props]
| Prop | Type | Default | Description |
| :--------------- | :--------------------------- | :------------- | :------------------------------------------ |
| `data` | `any[]` | — | Array of data objects. |
| `indexKey` | `string` | — | Key representing the categories. |
| `categories` | `string[]` | — | Series dataKeys. |
| `colors` | `string[]` | `CHART_COLORS` | Color palette for bars. |
| `layout` | `'horizontal' \| 'vertical'` | `'horizontal'` | Orientation layout. |
| `stacked` | `boolean` | `false` | Enable stacked bars. |
| `categorical` | `boolean` | `false` | Color each bar individually based on index. |
| `valueFormatter` | `(value: any) => string` | — | Custom formatter for values. |
| `height` | `number \| string` | `300` | Height of the chart. |
| `gridLines` | `boolean` | `true` | Show horizontal/vertical grid lines. |
# DoughnutChart (/docs/components/charts/doughnutchart)
# DoughnutChart [#doughnutchart]
A beautiful doughnut (pie) chart featuring rounded sectors, animations, and active segment highlight interactions.
## Preview [#preview]
## Import [#import]
```tsx
import { DoughnutChart, ChartContainer } from '@moul-dev/ui';
```
## Usage [#usage]
```tsx
import { DoughnutChart, ChartContainer } from '@moul-dev/ui';
export default function Example() {
const data = [
{ country: 'United States', value: 7530 },
{ country: 'Netherlands', value: 4670 },
{ country: 'Singapore', value: 1400 },
];
return (
);
}
```
## Props [#props]
### DoughnutChart Props [#doughnutchart-props]
| Prop | Type | Default | Description |
| :--------------- | :----------------------- | :------------- | :--------------------------------- |
| `data` | `any[]` | — | Array of category data. |
| `nameKey` | `string` | — | Key representing slice labels. |
| `valueKey` | `string` | — | Key representing slice quantities. |
| `colors` | `string[]` | `CHART_COLORS` | Array of colors for slices. |
| `innerRadius` | `number \| string` | `'65%'` | Inner circle diameter cut-out. |
| `outerRadius` | `number \| string` | `'85%'` | Outer circle diameter. |
| `paddingAngle` | `number` | `3` | Angle gaps between slices. |
| `valueFormatter` | `(value: any) => string` | — | Tooltip values formatter. |
| `height` | `number \| string` | `300` | Render height. |
# LineChart (/docs/components/charts/linechart)
# LineChart [#linechart]
A premium, interactive line chart designed for time-series and trend data, built on top of Recharts and styled with StyleX design tokens.
## Preview [#preview]
## Edge-to-Edge Area Charts [#edge-to-edge-area-charts]
Create compact sparklines or real-time metric cards by combining `AreaChart` with an `edgeToEdge` styled `ChartContainer`. Hiding the axes and grid lines allows the chart to align perfectly with the container's borders.
## Import [#import]
```tsx
import { LineChart, AreaChart, ChartContainer } from '@moul-dev/ui';
```
## Usage [#usage]
Here is a basic example of how to render a timeseries chart inside a `ChartContainer`:
```tsx
import { LineChart, ChartContainer } from '@moul-dev/ui';
export default function Example() {
const data = [
{ date: '08:00', Requests: 120, Users: 80 },
{ date: '12:00', Requests: 450, Users: 320 },
{ date: '16:00', Requests: 890, Users: 520 },
];
return (
);
}
```
## Props [#props]
### LineChart Props [#linechart-props]
| Prop | Type | Default | Description |
| :--------------- | :----------------------- | :------------- | :------------------------------------------------ |
| `data` | `any[]` | — | Array of data objects to plot. |
| `indexKey` | `string` | — | The object key to plot on the X-axis. |
| `categories` | `string[]` | — | Keys corresponding to series lines. |
| `colors` | `string[]` | `CHART_COLORS` | Array of hex/style variables to color the lines. |
| `height` | `number \| string` | `300` | Height of the chart container. |
| `gridLines` | `boolean` | `true` | Whether to display background grid lines. |
| `showXAxis` | `boolean` | `true` | Show/hide X-Axis ticks. |
| `showYAxis` | `boolean` | `true` | Show/hide Y-Axis ticks. |
| `valueFormatter` | `(value: any) => string` | — | Function to format the Y-Axis and Tooltip values. |
# Percentage (/docs/components/charts/percentage)
# Percentage [#percentage]
Progress indicators that render percentage values in horizontal bars or SVG circular progress rings.
## Preview [#preview]
## Import [#import]
```tsx
import { PercentageBar, PercentageCircle } from '@moul-dev/ui';
```
## Usage [#usage]
### Horizontal Percentage Bar [#horizontal-percentage-bar]
```tsx
import { PercentageBar } from '@moul-dev/ui';
export default function Example() {
return (
);
}
```
### Circular Progress Ring [#circular-progress-ring]
```tsx
import { PercentageCircle } from '@moul-dev/ui';
export default function Example() {
return (
);
}
```
## Props [#props]
### PercentageBar Props [#percentagebar-props]
| Prop | Type | Default | Description |
| :-------------- | :--------------------- | :------------------- | :--------------------------------- |
| `value` | `number` | — | Progress percentage (0 - 100). |
| `label` | `ReactNode` | — | Text label shown above the bar. |
| `showValueText` | `boolean` | `true` | Show percentage text on the right. |
| `color` | `string` | `tokens.colorChart1` | Color of the progress filled bar. |
| `size` | `'sm' \| 'md' \| 'lg'` | `'md'` | Height thickness. |
### PercentageCircle Props [#percentagecircle-props]
| Prop | Type | Default | Description |
| :-------------- | :---------- | :------------------- | :------------------------------------------- |
| `value` | `number` | — | Progress percentage (0 - 100). |
| `label` | `ReactNode` | — | Label shown underneath the circle. |
| `showValueText` | `boolean` | `true` | Display progress percentage inside the ring. |
| `color` | `string` | `tokens.colorChart1` | Color of the filled ring segment. |
| `size` | `number` | `80` | Diameter size in pixels. |
| `strokeWidth` | `number` | `8` | Border stroke thickness of the circle. |
# Stat (/docs/components/charts/stat)
# Stat [#stat]
A KPI metric card component displaying a large value, label, and trend indicators with status coloring.
## Preview [#preview]
## Import [#import]
```tsx
import { Stat } from '@moul-dev/ui';
```
## Usage [#usage]
```tsx
import { Stat } from '@moul-dev/ui';
export default function Example() {
return (
);
}
```
## Props [#props]
### Stat Props [#stat-props]
| Prop | Type | Default | Description |
| :--------------- | :---------------------------- | :---------- | :-------------------------------------- |
| `label` | `ReactNode` | — | Label or title for the stat card. |
| `value` | `ReactNode` | — | Main value text. |
| `trend` | `string \| number` | — | Trend percentage or text. |
| `trendDirection` | `'up' \| 'down' \| 'neutral'` | `'neutral'` | Arrow direction and badge styling. |
| `trendLabel` | `ReactNode` | — | Additional description text for footer. |
# TopList (/docs/components/charts/toplist)
# TopList [#toplist]
A ranked list visualization that maps rows with custom mini horizontal progress bars representing the values relative to the maximum list value.
## Preview [#preview]
## Import [#import]
```tsx
import { TopList } from '@moul-dev/ui';
```
## Usage [#usage]
```tsx
import { TopList, ChartContainer } from '@moul-dev/ui';
export default function Example() {
const data = [
{ label: 'United States', value: 7530 },
{ label: 'Netherlands', value: 4670 },
{ label: 'Singapore', value: 1400 },
];
return (
);
}
```
## Props [#props]
### TopList Props [#toplist-props]
| Prop | Type | Default | Description |
| :--------------- | :-------------------------- | :------------------- | :------------------------------------------------------------------ |
| `data` | `TopListItem[]` | — | Array of `{ label: string, value: number, color?: string }`. |
| `maxValue` | `number` | — | Override maximum scale value. Defaults to maximum value in dataset. |
| `barColor` | `string` | `tokens.colorChart1` | Default color for all progress bars. |
| `multiColor` | `boolean` | `false` | Enable index-based color mapping for progress bars. |
| `valueFormatter` | `(value: number) => string` | — | Custom formatter for values. |
# Checkbox (/docs/components/checkbox)
# Checkbox [#checkbox]
## Preview [#preview]
Unchecked
Checked
Disabled
The `Checkbox` component is built with React Aria and styled using StyleX.
## Import [#import]
```tsx
import { Checkbox } from '@moul-dev/ui';
```
## Usage [#usage]
Here is a basic example of how to use the `Checkbox` component:
```tsx
import { Checkbox } from '@moul-dev/ui';
export default function Example() {
return (
Checkbox Label
);
}
```
## Variants [#variants]
The `Checkbox` component supports three visual variants: `primary` (default), `secondary`, and `tertiary`.
Primary (default)
Unchecked
Checked
Secondary
Unchecked
Checked
Tertiary
Unchecked
Checked
### Primary Variant [#primary-variant]
The primary variant uses the primary accent brand colors, suited for main user actions.
```tsx
Primary
```
### Secondary Variant [#secondary-variant]
The secondary variant uses monochrome neutral styling, providing a clean alternative for lists and tables.
```tsx
Secondary
```
### Tertiary Variant [#tertiary-variant]
The tertiary variant is a hollow outline checkbox style that stays transparent and applies primary colors to the border and checkmark itself.
```tsx
Tertiary
```
## Props [#props]
### Checkbox Props [#checkbox-props]
Default className: `react-aria-Checkbox`
| Render Prop | CSS Selector |
| :---------------------------------------------------------------- | :--------------------- |
| `isSelected` Whether the checkbox is selected. | `[data-selected]` |
| `isIndeterminate` Whether the checkbox is indeterminate. | `[data-indeterminate]` |
| `isHovered` Whether the checkbox is hovered. | `[data-hovered]` |
| `isPressed` Whether the checkbox is pressed. | `[data-pressed]` |
| `isFocused` Whether the checkbox is focused. | `[data-focused]` |
| `isFocusVisible` Whether the checkbox is keyboard focused. | `[data-focus-visible]` |
| `isDisabled` Whether the checkbox is disabled. | `[data-disabled]` |
# CheckboxGroup (/docs/components/checkboxgroup)
# CheckboxGroup [#checkboxgroup]
## Preview [#preview]
Email
SMS
The `CheckboxGroup` component is built with React Aria and styled using StyleX.
## Import [#import]
```tsx
import { CheckboxGroup, Checkbox } from '@moul-dev/ui';
```
## Usage [#usage]
Here is a basic example of how to use the `CheckboxGroup` component:
```tsx
import { CheckboxGroup, Checkbox } from '@moul-dev/ui';
export default function Example() {
return (
Accept cookiesReceive marketing
);
}
```
## Features [#features]
### Group Variants [#group-variants]
Setting `variant` on `CheckboxGroup` propagates the variant style (`primary`, `secondary`, or `tertiary`) to all nested `Checkbox` components automatically.
Checkbox A
Checkbox B
Checkbox A
Checkbox B
Checkbox A
Checkbox B
```tsx
// Nested checkboxes inherit the group's secondary variant
AdminUser
```
### Orientation [#orientation]
Lays out checkboxes vertically (default) or horizontally using the `orientation` prop.
Vertical option
Horizontal option
Grid option
```tsx
Option 1Option 2
```
## Props [#props]
### CheckboxGroup Props [#checkboxgroup-props]
Default className: `react-aria-CheckboxGroup`
| Render Prop | CSS Selector |
| :----------------------------------------------------- | :---------------- |
| `isDisabled` Whether the group is disabled. | `[data-disabled]` |
| `isInvalid` Whether the group value is invalid. | `[data-invalid]` |
# ComboBox (/docs/components/combobox)
# ComboBox [#combobox]
## Preview [#preview]
Cat
Dog
Panda
The `ComboBox` component is built with React Aria and styled using StyleX.
## Import [#import]
```tsx
import { ComboBox } from '@moul-dev/ui';
```
## Usage [#usage]
Here is a basic example of how to use the `ComboBox` component:
```tsx
import { ComboBox } from '@moul-dev/ui';
export default function Example() {
return (
{/* Component content */}
);
}
```
## Multi-select with TagGroup [#multi-select-with-taggroup]
You can build a multi-select ComboBox by managing the selection state in a list/set, filtering out the selected items from the dropdown, and rendering them as a `TagGroup` below the ComboBox.
```tsx
import { ComboBox, ComboBoxItem, TagGroup, Tag } from '@moul-dev/ui';
import { useState } from 'react';
export default function Example() {
const provinces = [
{ id: 'phnom-penh', name: 'Phnom Penh' },
{ id: 'siem-reap', name: 'Siem Reap' },
{ id: 'battambang', name: 'Battambang' },
{ id: 'sihanoukville', name: 'Sihanoukville' },
{ id: 'kampot', name: 'Kampot' },
{ id: 'kandal', name: 'Kandal' },
{ id: 'kampong-cham', name: 'Kampong Cham' },
{ id: 'koh-kong', name: 'Koh Kong' },
{ id: 'kep', name: 'Kep' },
];
const [selectedKeys, setSelectedKeys] = useState>(new Set());
const [inputValue, setInputValue] = useState('');
const availableProvinces = provinces.filter(
(p) => !selectedKeys.has(p.id)
);
const handleSelectionChange = (key: any) => {
if (key) {
setSelectedKeys((prev) => {
const next = new Set(prev);
next.add(key);
return next;
});
setInputValue('');
}
};
const handleRemove = (keys: Set) => {
setSelectedKeys((prev) => {
const next = new Set(prev);
for (const k of keys) {
next.delete(k);
}
return next;
});
};
return (
);
}
```
## Props [#props]
### ComboBox Props [#combobox-props]
Default className: `react-aria-ComboBox`
| Render Prop | CSS Selector |
| :---------------------------------------------------------------- | :--------------------- |
| `isOpen` Whether the combobox list popover is open. | `[data-open]` |
| `isFocused` Whether the combobox is focused. | `[data-focused]` |
| `isFocusVisible` Whether the combobox is keyboard focused. | `[data-focus-visible]` |
| `isDisabled` Whether the combobox is disabled. | `[data-disabled]` |
# Form (/docs/components/form)
# Form [#form]
## Preview [#preview]
The `Form` component is built with React Aria and styled using StyleX.
## Import [#import]
```tsx
import { Form } from '@moul-dev/ui';
```
## Usage [#usage]
Here is a basic example of how to use the `Form` component:
```tsx
import { Form } from '@moul-dev/ui';
export default function Example() {
return (
);
}
```
## Props [#props]
### Form Props [#form-props]
Default className: `react-aria-Form`
# InputOTP (/docs/components/inputotp)
# InputOTP [#inputotp]
## Preview [#preview]
The `InputOTP` component is a flexible, highly accessible one-time password input component. It is built on top of the headless `input-otp` library by `@guilhermerodz` and styled using StyleX.
## Import [#import]
```tsx
import {
InputOTP,
InputOTPGroup,
InputOTPSlot,
InputOTPSeparator
} from '@moul-dev/ui';
```
## Features [#features]
### Basic Layout (6-digit) [#basic-layout-6-digit]
A standard 6-digit passcode layout utilizing a separator in the middle.
```tsx
import { useState } from 'react';
import {
InputOTP,
InputOTPGroup,
InputOTPSlot,
InputOTPSeparator
} from '@moul-dev/ui';
export default function Example() {
const [value, setValue] = useState('');
return (
);
}
```
### Label & Helper Text [#label--helper-text]
The component supports standard form control label and description props.
```tsx
```
### Validation State [#validation-state]
Marking the input as invalid highlights the slot borders and renders a custom error message.
```tsx
```
### Custom Separator [#custom-separator]
You can provide any React node inside `InputOTPSeparator` to customize the visual divider.
```tsx
-
```
# Kbd (/docs/components/kbd)
# Kbd [#kbd]
## Preview [#preview]
⌘
K
The `Kbd` component is built with React Aria and styled using StyleX.
## Import [#import]
```tsx
import { Kbd } from '@moul-dev/ui';
```
## Usage [#usage]
Here is a basic example of how to use the `Kbd` component:
```tsx
import { Kbd } from '@moul-dev/ui';
export default function Example() {
return (
{/* Component content */}
);
}
```
# Link (/docs/components/link)
# Link [#link]
## Preview [#preview]
Visit Khmer Dev
The `Link` component is built with React Aria and styled using StyleX.
## Import [#import]
```tsx
import { Link } from '@moul-dev/ui';
```
## Usage [#usage]
Here is a basic example of how to use the `Link` component:
```tsx
import { Link } from '@moul-dev/ui';
export default function Example() {
return (
{/* Component content */}
);
}
```
## Props [#props]
### Link Props [#link-props]
Default className: `react-aria-Link`
| Render Prop | CSS Selector |
| :------------------------------------------------------------ | :--------------------- |
| `isCurrent` Whether the link is the current item. | `[data-current]` |
| `isHovered` Whether the link is hovered. | `[data-hovered]` |
| `isPressed` Whether the link is pressed. | `[data-pressed]` |
| `isFocused` Whether the link is focused. | `[data-focused]` |
| `isFocusVisible` Whether the link is keyboard focused. | `[data-focus-visible]` |
| `isDisabled` Whether the link is disabled. | `[data-disabled]` |
# Modal (/docs/components/modal)
# Modal [#modal]
## Preview [#preview]
The `Modal` component is built with React Aria and styled using StyleX.
## Import [#import]
```tsx
import { Modal } from '@moul-dev/ui';
```
## Usage [#usage]
Here is a basic example of how to use the `Modal` component:
```tsx
import { Modal } from '@moul-dev/ui';
export default function Example() {
return (
{/* Component content */}
);
}
```
## Sizing and Variants [#sizing-and-variants]
The `Modal` component supports size variants via the `size` prop:
* `sm`: Max width of `400px` on desktop.
* `md`: Max width of `500px` on desktop (default).
* `lg`: Max width of `640px` on desktop.
```tsx
{/* Small Modal */}
```
## Mobile Responsive Layout [#mobile-responsive-layout]
On mobile viewports (`<= 640px`), the modal is optimized to behave like a bottom drawer/sheet:
* Aligned to the bottom of the screen.
* Extends to `100%` viewport width.
* Bottom corner radiuses are set to `0` for seamless edge-to-edge styling.
* Renders with a smooth, subtle fade-in and slide-up animation from the bottom of the viewport.
## Props [#props]
### Modal Props [#modal-props]
Default className: `react-aria-Modal`
| Render Prop | CSS Selector |
| :---------------------------------------------------------------- | :---------------- |
| `isOpen` Whether the modal is open. | `[data-open]` |
| `isEntering` Whether the entrance transition is animating. | `[data-entering]` |
| `isExiting` Whether the exit transition is animating. | `[data-exiting]` |
# NumberField (/docs/components/numberfield)
# NumberField [#numberfield]
## Preview [#preview]
The `NumberField` component is built with React Aria and styled using StyleX.
## Import [#import]
```tsx
import { NumberField } from '@moul-dev/ui';
```
## Usage [#usage]
Here is a basic example of how to use the `NumberField` component:
```tsx
import { NumberField } from '@moul-dev/ui';
export default function Example() {
return (
{/* Component content */}
);
}
```
## Props [#props]
### NumberField Props [#numberfield-props]
Default className: `react-aria-NumberField`
| Render Prop | CSS Selector |
| :-------------------------------------------------------- | :---------------- |
| `isDisabled` Whether the number field is disabled. | `[data-disabled]` |
| `isInvalid` Whether the value is invalid. | `[data-invalid]` |
# Popover (/docs/components/popover)
# Popover [#popover]
## Preview [#preview]
This is the content inside the popover.
The `Popover` component is built with React Aria and styled using StyleX.
## Import [#import]
```tsx
import { Popover } from '@moul-dev/ui';
```
## Usage [#usage]
Here is a basic example of how to use the `Popover` component:
```tsx
import { Popover } from '@moul-dev/ui';
export default function Example() {
return (
{/* Component content */}
);
}
```
## Props [#props]
### Popover Props [#popover-props]
Default className: `react-aria-Popover`
| Render Prop | CSS Selector |
| :------------------------------------------- | :----------------- |
| `isOpen` Whether the popover is open. | `[data-open]` |
| `placement` The current placement. | `[data-placement]` |
# RadioGroup (/docs/components/radiogroup)
# RadioGroup [#radiogroup]
## Preview [#preview]
Free
Pro
Enterprise
The `RadioGroup` component is built with React Aria and styled using StyleX.
## Import [#import]
```tsx
import { RadioGroup } from '@moul-dev/ui';
```
## Usage [#usage]
Here is a basic example of how to use the `RadioGroup` component:
```tsx
import { RadioGroup } from '@moul-dev/ui';
export default function Example() {
return (
{/* Component content */}
);
}
```
## Props [#props]
### RadioGroup Props [#radiogroup-props]
Default className: `react-aria-RadioGroup`
| Render Prop | CSS Selector |
| :----------------------------------------------------- | :---------------- |
| `isDisabled` Whether the group is disabled. | `[data-disabled]` |
| `isInvalid` Whether the group value is invalid. | `[data-invalid]` |
# SearchField (/docs/components/searchfield)
# SearchField [#searchfield]
## Preview [#preview]
The `SearchField` component is built with React Aria and styled using StyleX.
## Import [#import]
```tsx
import { SearchField } from '@moul-dev/ui';
```
## Usage [#usage]
Here is a basic example of how to use the `SearchField` component:
```tsx
import { SearchField } from '@moul-dev/ui';
export default function Example() {
return (
{/* Component content */}
);
}
```
## Props [#props]
### SearchField Props [#searchfield-props]
Default className: `react-aria-SearchField`
| Render Prop | CSS Selector |
| :-------------------------------------------------------- | :---------------- |
| `isDisabled` Whether the search field is disabled. | `[data-disabled]` |
| `isInvalid` Whether the search field is invalid. | `[data-invalid]` |
# Select (/docs/components/select)
# Select [#select]
## Preview [#preview]
The `Select` component is built with React Aria and styled using StyleX.
## Import [#import]
```tsx
import { Select } from '@moul-dev/ui';
```
## Usage [#usage]
Here is a basic example of how to use the `Select` component:
```tsx
import { Select } from '@moul-dev/ui';
export default function Example() {
return (
);
}
```
## Props [#props]
### Select Props [#select-props]
Default className: `react-aria-Select`
| Render Prop | CSS Selector |
| :-------------------------------------------------------------- | :--------------------- |
| `isOpen` Whether the select popover is open. | `[data-open]` |
| `isFocused` Whether the select is focused. | `[data-focused]` |
| `isFocusVisible` Whether the select is keyboard focused. | `[data-focus-visible]` |
| `isDisabled` Whether the select is disabled. | `[data-disabled]` |
# Separator (/docs/components/separator)
# Separator [#separator]
## Preview [#preview]
Blog
Docs
Source
The `Separator` component is built with React Aria and styled using StyleX.
## Import [#import]
```tsx
import { Separator } from '@moul-dev/ui';
```
## Usage [#usage]
Here is a basic example of how to use the `Separator` component:
```tsx
import { Separator } from '@moul-dev/ui';
export default function Example() {
return (
{/* Component content */}
);
}
```
## Props [#props]
### Separator Props [#separator-props]
Default className: `react-aria-Separator`
# Skeleton (/docs/components/skeleton)
# Skeleton [#skeleton]
## Preview [#preview]
The `Skeleton` component is built with React Aria and styled using StyleX.
## Import [#import]
```tsx
import { Skeleton } from '@moul-dev/ui';
```
## Usage [#usage]
Here is a basic example of how to use the `Skeleton` component:
```tsx
import { Skeleton } from '@moul-dev/ui';
export default function Example() {
return (
{/* Component content */}
);
}
```
# Slider (/docs/components/slider)
# Slider [#slider]
## Preview [#preview]
The `Slider` component is built with React Aria and styled using StyleX.
## Import [#import]
```tsx
import { Slider } from '@moul-dev/ui';
```
## Usage [#usage]
Here is a basic example of how to use the `Slider` component:
```tsx
import { Slider } from '@moul-dev/ui';
export default function Example() {
return (
{/* Component content */}
);
}
```
## Props [#props]
### Slider Props [#slider-props]
Default className: `react-aria-Slider`
| Render Prop | CSS Selector |
| :-------------------------------------------------- | :------------------- |
| `isDisabled` Whether the slider is disabled. | `[data-disabled]` |
| `orientation` The orientation of the slider. | `[data-orientation]` |
# Spinner (/docs/components/spinner)
# Spinner [#spinner]
## Preview [#preview]
The `Spinner` component is built with React Aria and styled using StyleX.
## Import [#import]
```tsx
import { Spinner } from '@moul-dev/ui';
```
## Usage [#usage]
Here is a basic example of how to use the `Spinner` component:
```tsx
import { Spinner } from '@moul-dev/ui';
export default function Example() {
return (
{/* Component content */}
);
}
```
# Switch (/docs/components/switch)
# Switch [#switch]
## Preview [#preview]
The `Switch` component is built with React Aria and styled using StyleX.
## Import [#import]
```tsx
import { Switch } from '@moul-dev/ui';
```
## Usage [#usage]
Here is a basic example of how to use the `Switch` component:
```tsx
import { Switch } from '@moul-dev/ui';
export default function Example() {
return (
{/* Component content */}
);
}
```
## Props [#props]
### Switch Props [#switch-props]
Default className: `react-aria-Switch`
| Render Prop | CSS Selector |
| :-------------------------------------------------------------- | :--------------------- |
| `isSelected` Whether the switch is checked. | `[data-selected]` |
| `isHovered` Whether the switch is hovered. | `[data-hovered]` |
| `isPressed` Whether the switch is pressed. | `[data-pressed]` |
| `isFocused` Whether the switch is focused. | `[data-focused]` |
| `isFocusVisible` Whether the switch is keyboard focused. | `[data-focus-visible]` |
| `isDisabled` Whether the switch is disabled. | `[data-disabled]` |
| `isReadOnly` Whether the switch is read-only. | `[data-readonly]` |
# Table (/docs/components/table)
# Table [#table]
## Preview [#preview]
Name
Type
Status
Button
Action
Stable
Select
Form
Beta
The `Table` component is built with React Aria and styled using StyleX.
## Import [#import]
```tsx
import { Table } from '@moul-dev/ui';
```
## Usage [#usage]
Here is a basic example of how to use the `Table` component:
```tsx
import { Table } from '@moul-dev/ui';
export default function Example() {
return (
{/* Component content */}
);
}
```
## Props [#props]
### Table Props [#table-props]
Default className: `react-aria-Table`
# Tabs (/docs/components/tabs)
# Tabs [#tabs]
Tabs organize content into multiple sections and allow users to navigate between them. It is built using React Aria Components and styled compile-time using StyleX, featuring smooth selection sliding indicator animations.
## Preview [#preview]
Profile
Notifications
Security
Profile settings and account parameters.
Configure email and push notification preferences.
Manage password, two-factor authentication, and active sessions.
## Import [#import]
```tsx
import { Tabs, TabList, Tab, TabPanels, TabPanel } from '@moul-dev/ui';
```
## Variants [#variants]
The `Tabs` component supports three visual variants through the `variant` prop: `primary` (default brand indicator), `secondary` (foreground indicator), and `tertiary` (sliding pill background bubble).
### Primary (Default) [#primary-default]
The primary variant uses the brand accent color for the selection indicator underline.
```tsx
Tab 1Tab 2Content 1Content 2
```
### Secondary [#secondary]
The secondary variant uses the default foreground text color for the selection indicator underline.
Tab 1
Tab 2
Secondary variant content 1
Secondary variant content 2
### Tertiary (Sliding Pill) [#tertiary-sliding-pill]
The tertiary variant renders a premium sliding rounded pill background under the selected tab and removes borders from the tab list.
Tab 1
Tab 2
Tab 3
Pill style layout content 1
Pill style layout content 2
Pill style layout content 3
## Vertical Orientation [#vertical-orientation]
Tabs can be stacked vertically using the `orientation="vertical"` prop. The selection indicator animates along the vertical axis, and the tab panels are laid out inline to the right.
General
Appearance
Security
General account settings configuration.
Customize themes, dark mode, font sizes, and layout choices.
Manage active authentication keys and access logs.
## Props [#props]
### Tabs Props [#tabs-props]
Default className: `react-aria-Tabs`
| Render Prop | CSS Selector |
| :----------------------------------------------------- | :------------------- |
| `orientation` The layout orientation. | `[data-orientation]` |
| `isDisabled` Whether the component is disabled. | `[data-disabled]` |
# TagGroup (/docs/components/taggroup)
# TagGroup [#taggroup]
A tag group is a focusable list of labels, categories, keywords, filters, or other items, with support for keyboard navigation, selection, and removal.
## Preview [#preview]
The `TagGroup` component is built with React Aria and styled using StyleX.
## Import [#import]
```tsx
import { TagGroup, Tag } from '@moul-dev/ui';
```
## Usage [#usage]
Here is a basic example of how to use the `TagGroup` component:
```tsx
import { TagGroup, Tag } from '@moul-dev/ui';
export default function Example() {
return (
NewsTravelGamingShopping
);
}
```
## Variants [#variants]
TagGroup and Tag support three variants: `primary`, `secondary` (default), and `tertiary`. You can pass the variant to the `TagGroup` to apply it to all tags, or override it on individual `Tag`s.
```tsx
AnalyticsSecurityAnalyticsSecurityAnalyticsSecurity
```
## Sizes [#sizes]
TagGroup and Tag support three sizes: `sm`, `md` (default), and `lg`. You can set the size on the `TagGroup` to apply it to all tags, or override it on individual `Tag`s.
```tsx
Small tagMedium tagLarge tag
```
## Selection [#selection]
Use the `selectionMode` prop to enable single or multiple selection.
```tsx
import { TagGroup, Tag } from '@moul-dev/ui';
import { useState } from 'react';
import type { Selection } from 'react-aria-components';
export default function Example() {
const [selected, setSelected] = useState(new Set(['news']));
return (
NewsTravelGaming
);
}
```
## Removal [#removal]
Pass an `onRemove` callback to the `TagGroup` component to allow items to be removed. When specified, tags will automatically render close buttons suited to their sizes and variants.
```tsx
import { TagGroup, Tag } from '@moul-dev/ui';
import { useState } from 'react';
export default function Example() {
const [tags, setTags] = useState([
{ id: '1', label: 'News' },
{ id: '2', label: 'Travel' },
{ id: '3', label: 'Gaming' },
]);
const handleRemove = (keys) => {
setTags((prev) => prev.filter((tag) => !keys.has(tag.id)));
};
return (
{tags.map((tag) => (
{tag.label}
))}
);
}
```
## Props [#props]
### TagGroup Props [#taggroup-props]
Default className: `react-aria-TagGroup`
# TextArea (/docs/components/textarea)