### Dev Setup: Run VitePress for Docs
Source: https://github.com/unovue/reka-ui/blob/v2/packages/core/README.md
Follow these steps to set up the development environment for the Reka UI documentation using VitePress. This includes installing dependencies, building the library locally, and starting the dev server.
```bash
pnpm i
pnpm build
pnpm docs:dev
```
--------------------------------
### Start Documentation Development Server
Source: https://github.com/unovue/reka-ui/blob/v2/CONTRIBUTING.md
Installs documentation dependencies and starts the documentation development server.
```bash
pnpm docs:install && pnpm docs:dev
```
--------------------------------
### Example prompts for LLM assistance with Reka UI
Source: https://github.com/unovue/reka-ui/blob/v2/docs/content/docs/overview/getting-started.md
These example prompts demonstrate how to leverage LLM-optimized documentation for Reka UI to get AI-powered assistance with component implementation, styling, and accessibility.
```text
"Using the Reka UI documentation at https://reka-ui.com/llms.txt, help me implement a custom Dialog component with form validation."
"Based on the Reka UI llms.txt documentation, show me how to create an accessible Select component with custom styling."
"Refer to the Reka UI llms.txt file and explain how to properly implement keyboard navigation for a Combobox component."
```
--------------------------------
### Install dependencies for Docs
Source: https://github.com/unovue/reka-ui/blob/v2/README.md
After cloning the repository, run this command to install all necessary dependencies for the documentation.
```bash
pnpm i
```
--------------------------------
### Install Dependencies
Source: https://github.com/unovue/reka-ui/blob/v2/CLAUDE.md
Run this command from the repository root to install all project dependencies.
```bash
pnpm i
```
--------------------------------
### Dev Setup: Run Histoire for Storybook
Source: https://github.com/unovue/reka-ui/blob/v2/packages/core/README.md
Follow these steps to set up the development environment for Reka UI components using Histoire (Storybook). This includes installing dependencies, starting the Storybook dev server, and running tests.
```bash
pnpm i
pnpm story:dev
pnpm test
```
--------------------------------
### Custom hotkey Example
Source: https://github.com/unovue/reka-ui/blob/v2/docs/content/docs/components/toast.md
Example demonstrating how to customize the hotkey for the ToastViewport using an array of key combinations.
```APIDOC
## Examples
### Custom hotkey
Override the default hotkey using the `event.code` value for each key from [keycode.info](https://keycode.info/).
```vue line=4
...
```
```
--------------------------------
### Force Mount Example
Source: https://github.com/unovue/reka-ui/blob/v2/docs/content/docs/utilities/presence.md
Example demonstrating the use of the `forceMount` prop to ensure content is always rendered, even when not visually present.
```APIDOC
## Force Mount Example
When you need to ensure content is always rendered regardless of the present state:
```vue
This content will always be rendered
This content is hidden
```
```
--------------------------------
### Clone and Install Project Dependencies
Source: https://github.com/unovue/reka-ui/blob/v2/CONTRIBUTING.md
Clone the repository and install project dependencies using pnpm.
```bash
git clone https://github.com/unovue/reka-ui.git
cd reka-ui
pnpm i
```
--------------------------------
### Basic Usage Example
Source: https://github.com/unovue/reka-ui/blob/v2/docs/content/docs/components/time-range-field.md
A basic example demonstrating how to use the TimeRangeFieldRoot and TimeRangeFieldInput components to create a time range input.
```APIDOC
```vue
:to:
```
```
--------------------------------
### OTP mode Example
Source: https://github.com/unovue/reka-ui/blob/v2/docs/content/docs/components/pin-input.md
Example of how to configure the Pin Input component for OTP mode by setting the `otp` prop to `true`.
```APIDOC
### OTP mode
You can set the pin input to `otp` mode by setting otp to `true`.
```vue{6}
…
```
```
--------------------------------
### Pagination Example: With first/last button
Source: https://github.com/unovue/reka-ui/blob/v2/docs/content/docs/components/pagination.md
Example showing how to include PaginationFirst and PaginationLast buttons for direct navigation to the first and last pages.
```APIDOC
## With first/last button
You can add `PaginationFirst` to allow user to navigate to first page, or `PaginationLast` to navigate to last page.
```vue line=8,10
...
```
```
--------------------------------
### Install Dependencies for Nuxt 3 Project
Source: https://github.com/unovue/reka-ui/blob/v2/playground/nuxt/README.md
Use these commands to install project dependencies using npm, pnpm, or yarn.
```bash
npm install
```
```bash
pnpm install
```
```bash
yarn install
```
--------------------------------
### Install @internationalized/date Package
Source: https://github.com/unovue/reka-ui/blob/v2/docs/content/docs/components/month-picker.md
Install the date utility package required for date-related components. This is a prerequisite for using the Month Picker.
```bash
npm install @internationalized/date
# or
yarn add @internationalized/date
```
--------------------------------
### Nested Dialog Example
Source: https://github.com/unovue/reka-ui/blob/v2/docs/content/docs/components/dialog.md
Example demonstrating how to nest multiple layers of dialogs.
```APIDOC
## Nested dialog
You can nest multiple layers of dialogs.
```
--------------------------------
### Pagination Example: With ellipsis
Source: https://github.com/unovue/reka-ui/blob/v2/docs/content/docs/components/pagination.md
Example demonstrating how to use PaginationEllipsis for visual cues in long page lists.
```APIDOC
## With ellipsis
You can add `PaginationEllipsis` as a visual cue for more previous and after items.
```vue line=10,14
…
```
```
--------------------------------
### Duplicate toasts Example
Source: https://github.com/unovue/reka-ui/blob/v2/docs/content/docs/components/toast.md
Example illustrating how to render multiple instances of the same toast by using state to control the count, suitable for actions that should trigger a toast each time.
```APIDOC
### Duplicate toasts
When a toast must appear every time a user clicks a button, use state to render multiple instances of the same toast (see below). Alternatively, you can abstract the parts to create your own [imperative API](/docs/components/toast#imperative-api).
```vue line=3,8
Saved!
```
```
--------------------------------
### Start Nuxt 3 Development Server
Source: https://github.com/unovue/reka-ui/blob/v2/playground/nuxt/README.md
Commands to start the local development server for a Nuxt 3 project using npm, pnpm, or yarn. The server typically runs on http://localhost:3000.
```bash
npm run dev
```
```bash
pnpm run dev
```
```bash
yarn dev
```
--------------------------------
### Pagination Example: Control page programmatically
Source: https://github.com/unovue/reka-ui/blob/v2/docs/content/docs/components/pagination.md
Example demonstrating how to control the current page of the pagination component programmatically using a reactive value.
```APIDOC
## Control page programmatically
You can control the current page by passing it a reactive value.
```vue line=6,10,11
...
```
```
--------------------------------
### Stepper Anatomy Example
Source: https://github.com/unovue/reka-ui/blob/v2/docs/content/docs/components/stepper.md
Demonstrates how to import and assemble all parts of the Stepper component to create a basic stepper structure.
```vue
```
--------------------------------
### Custom Dropdown Menu API Example
Source: https://github.com/unovue/reka-ui/blob/v2/docs/content/docs/components/dropdown-menu.md
An example demonstrating how to abstract primitive Dropdown Menu parts into a custom API, including checkbox and radio item implementations.
```vue
DropdownMenu trigger<\/DropdownMenuTrigger>
Item<\/DropdownMenuItem>
Label<\/DropdownMenuLabel>
Group<\/DropdownMenuGroup>
CheckboxItem<\/DropdownMenuCheckboxItem>
Separator<\/DropdownMenuSeparator>
RadioItem<\/DropdownMenuRadioItem>
RadioItem<\/DropdownMenuRadioItem>
<\/DropdownMenuRadioGroup>
<\/DropdownMenuContent>
<\/DropdownMenu>
<\/template>
```
--------------------------------
### Controlled Toggle Group Example
Source: https://github.com/unovue/reka-ui/blob/v2/docs/content/docs/components/toggle-group.md
Example demonstrating how to control the Toggle Group component to ensure a value is always present.
```APIDOC
## Ensuring there is always a value
### Description
You can control the component to ensure a value.
### Code Example
```vue line=5,10-13
{
if (val) value = val
}"
>
```
```
--------------------------------
### Accordion Example: Allow collapsing all items
Source: https://github.com/unovue/reka-ui/blob/v2/docs/content/docs/components/accordion.md
Demonstrates how to use the `collapsible` prop to allow all items to be closed.
```APIDOC
### Allow collapsing all items
Use the `collapsible` prop to allow all items to close.
```vue line=4
…
…
```
```
--------------------------------
### Custom Scroll Example
Source: https://github.com/unovue/reka-ui/blob/v2/docs/content/docs/components/scroll-area.md
Example demonstrating how to use the exposed viewport to modify or set the scroll position outside of default methods.
```APIDOC
### Custom Scroll
Use the exposed `viewport` to modify / or set the scroll position outside default methods
```vue line=4,18
```
```
--------------------------------
### Basic Usage
Source: https://github.com/unovue/reka-ui/blob/v2/docs/content/docs/utilities/presence.md
Example of how to use the Presence component to conditionally render an element with fade-in/fade-out animations.
```APIDOC
## Basic Usage Example
```vue
```
```
--------------------------------
### Install Reka UI with pnpm
Source: https://github.com/unovue/reka-ui/blob/v2/README.md
Use this command to add Reka UI to your project using the pnpm package manager.
```bash
pnpm add reka-ui
```
--------------------------------
### Install Reka UI Month Picker Component
Source: https://github.com/unovue/reka-ui/blob/v2/docs/content/docs/components/month-picker.md
Install the Month Picker component from the Reka UI library. This command adds the component to your project's dependencies.
```bash
npm install reka-ui
# or
yarn add reka-ui
```
--------------------------------
### Accordion Example: Expanded by default
Source: https://github.com/unovue/reka-ui/blob/v2/docs/content/docs/components/accordion.md
Shows how to use the `defaultValue` prop to set an initially open item.
```APIDOC
## Examples
### Expanded by default
Use the `defaultValue` prop to define the open item by default.
```vue line=4
…
…
```
```
--------------------------------
### RGB Channel Sliders Example
Source: https://github.com/unovue/reka-ui/blob/v2/docs/content/docs/components/color-slider.md
Sliders for individual RGB channels, showing how to control red, green, and blue components.
```APIDOC
## RGB Channel Sliders
Sliders for individual RGB channels.
```vue
```
```
--------------------------------
### Install Reka UI with yarn
Source: https://github.com/unovue/reka-ui/blob/v2/README.md
Use this command to add Reka UI to your project using the yarn package manager.
```bash
yarn add reka-ui
```
--------------------------------
### Menubar Anatomy and Structure
Source: https://github.com/unovue/reka-ui/blob/v2/docs/content/docs/components/menubar.md
Demonstrates the basic structure and import of all Menubar components. This serves as a foundational example for building a Menubar.
```vue
```
--------------------------------
### MenubarContent Emits Example
Source: https://github.com/unovue/reka-ui/blob/v2/docs/content/meta/MenubarContent.md
Lists the emitted events for the MenubarContent component, such as 'closeAutoFocus', 'escapeKeyDown', and 'focusOutside', along with their event types and descriptions.
```javascript
{
'name': 'closeAutoFocus',
'description': '
Event handler called when auto-focusing on close.
Can be prevented.
Event handler called when an interaction happens outside the DismissableLayer.
Specifically, when a pointerdown event happens outside or focus moves outside of it.
Can be prevented.
Event handler called when a pointerdown event happens outside of the DismissableLayer.
Can be prevented.
',
'type': '[event: PointerDownOutsideEvent]'
}
```
--------------------------------
### Install Reka UI with npm
Source: https://github.com/unovue/reka-ui/blob/v2/README.md
Use this command to add Reka UI to your project using the npm package manager.
```bash
npm install reka-ui
```
--------------------------------
### Accordion Example: Multiple items open
Source: https://github.com/unovue/reka-ui/blob/v2/docs/content/docs/components/accordion.md
Illustrates how to set the `type` prop to `multiple` to enable multiple items to be open simultaneously.
```APIDOC
### Multiple items open at the same time
Set the `type` prop to `multiple` to enable opening multiple items at once.
```vue line=2
…
…
```
```
--------------------------------
### Import and Use Label Component
Source: https://github.com/unovue/reka-ui/blob/v2/docs/content/docs/components/label.md
Demonstrates how to import and use the Label component in a Vue application. Ensure the component is installed before importing.
```vue
```
--------------------------------
### Get Current Direction with useDirection
Source: https://github.com/unovue/reka-ui/blob/v2/docs/content/docs/utilities/use-direction.md
Retrieve the current direction set by ConfigProvider. Ensure ConfigProvider is set up, for example, with `dir="rtl"`.
```typescript
import { useDirection } from 'reka-ui'
// With ConfigProvider setup as follows
//
const locale = useDirection() // rtl
```
--------------------------------
### Implement Advanced Validation for TimeRangeField
Source: https://github.com/unovue/reka-ui/blob/v2/docs/content/docs/components/time-range-field.md
Implement complex validation rules, such as ensuring the end time is after the start time and within business hours. This example uses a watcher to check the time range validity.
```vue
:to:
{{ error }}
```
--------------------------------
### Time Range Field Anatomy
Source: https://github.com/unovue/reka-ui/blob/v2/docs/content/docs/components/time-range-field.md
Import and assemble the TimeRangeFieldRoot and TimeRangeFieldInput components to create a time range field. This example shows the basic structure for defining start and end hour and minute inputs.
```vue
```
--------------------------------
### Get Direction with Fallback using useDirection
Source: https://github.com/unovue/reka-ui/blob/v2/docs/content/docs/utilities/use-direction.md
Retrieve the current direction from ConfigProvider, or use the provided fallback value if no direction is set. For example, `useDirection('ltr')` will return 'ltr' if ConfigProvider does not specify a direction.
```typescript
import { useDirection } from 'reka-ui'
// With ConfigProvider setup as follows
//
const locale = useDirection('ltr') // ltr
```
--------------------------------
### Run Docs Development Server
Source: https://github.com/unovue/reka-ui/blob/v2/README.md
Starts the VitePress development server for the Reka UI documentation. Open http://localhost:5173 in your browser to view the docs.
```bash
pnpm docs:dev
```
--------------------------------
### Run Histoire (Storybook) for Package Development
Source: https://github.com/unovue/reka-ui/blob/v2/README.md
Starts the Histoire development server for Reka UI components. Open http://localhost:6006 in your browser to view the component stories.
```bash
pnpm story:dev
```
--------------------------------
### Build Reka UI locally for Docs
Source: https://github.com/unovue/reka-ui/blob/v2/README.md
Run this command to build the Reka UI package locally, which is required before running the documentation development server.
```bash
pnpm build
```
--------------------------------
### Basic Context Menu Structure
Source: https://github.com/unovue/reka-ui/blob/v2/docs/content/docs/components/context-menu.md
Set up a basic context menu using ContextMenuRoot, ContextMenuTrigger, ContextMenuPortal, and ContextMenuContent. Import necessary components from 'reka-ui'.
```vue
…
…
```
--------------------------------
### Vertical Orientation Slider
Source: https://github.com/unovue/reka-ui/blob/v2/docs/content/docs/components/color-slider.md
Example of a vertical color slider, suitable for space-constrained layouts. This example adjusts the lightness channel.
```vue
```
--------------------------------
### Importing and Using DateField Components
Source: https://github.com/unovue/reka-ui/blob/v2/docs/content/docs/components/date-field.md
Demonstrates how to import and assemble the DateFieldRoot and DateFieldInput components for basic usage.
```vue
```
--------------------------------
### Show instantly
Source: https://github.com/unovue/reka-ui/blob/v2/docs/content/docs/components/hover-card.md
Use the `openDelay` prop to control the time it takes for the hover card to open.
```APIDOC
## Show instantly
Use the `openDelay` prop to control the time it takes for the hover card to open.
```vue line=12
……
````
```
--------------------------------
### Numeric mode Example
Source: https://github.com/unovue/reka-ui/blob/v2/docs/content/docs/components/pin-input.md
Example of how to configure the Pin Input component to accept only numeric input by setting the `type` prop to `number`.
```APIDOC
### Numeric mode
You can set the pin input to only accept `number` type by setting type to `number`.
```vue{6}
…
```
```
--------------------------------
### Import and Assemble Navigation Menu Components
Source: https://github.com/unovue/reka-ui/blob/v2/docs/content/docs/components/navigation-menu.md
Import all necessary parts of the Navigation Menu component and assemble them to create a basic navigation structure. This example demonstrates how to use `NavigationMenuRoot`, `NavigationMenuList`, `NavigationMenuItem`, `NavigationMenuTrigger`, `NavigationMenuContent`, `NavigationMenuLink`, `NavigationMenuSub`, `NavigationMenuIndicator`, and `NavigationMenuViewport`.
```vue
```
--------------------------------
### Close after asynchronous form submission Example
Source: https://github.com/unovue/reka-ui/blob/v2/docs/content/docs/components/dialog.md
Example showing how to use controlled props to programmatically close the Dialog after an async operation.
```APIDOC
## Close after asynchronous form submission
Use the controlled props to programmatically close the Dialog after an async operation has completed.
```vue line=4,5,15-19,22-24
Open
```
```
--------------------------------
### Basic Navigation Menu Structure
Source: https://github.com/unovue/reka-ui/blob/v2/docs/content/docs/components/navigation-menu.md
Sets up a basic navigation menu with two items and a viewport. Imports necessary components from 'reka-ui'.
```vue
Item one
Item one content
Item two
Item two content
```
--------------------------------
### Basic Autocomplete Usage
Source: https://github.com/unovue/reka-ui/blob/v2/docs/content/docs/components/autocomplete.md
Demonstrates the fundamental setup of the Autocomplete component, including input, portal, content, and items. The `modelValue` reflects user input, and item selection populates the input.
```vue
{{ fruit }}
```
--------------------------------
### Custom duration Example
Source: https://github.com/unovue/reka-ui/blob/v2/docs/content/docs/components/toast.md
Example showing how to set a custom duration for a specific ToastRoot component, overriding the provider's default duration.
```APIDOC
### Custom duration
Customise the duration of a toast to override the provider value.
```vue line=2
Saved!
```
```
--------------------------------
### Preview Nuxt 3 Production Build Locally
Source: https://github.com/unovue/reka-ui/blob/v2/playground/nuxt/README.md
Commands to locally preview the production build of a Nuxt 3 application using npm, pnpm, or yarn.
```bash
npm run preview
```
```bash
pnpm run preview
```
```bash
yarn preview
```
--------------------------------
### Number Field Example - Decimal
Source: https://github.com/unovue/reka-ui/blob/v2/docs/content/docs/components/number-field.md
Example of using the NumberField with decimal formatting options, including sign display and minimum fraction digits.
```APIDOC
## Example - Decimal
All options supported by `Intl.NumberFormat` are supported, including configuration of minimum and maximum fraction digits, sign display, grouping separators, etc.
```vue line=3-7
…
```
```
--------------------------------
### Number Field Example - Percentage
Source: https://github.com/unovue/reka-ui/blob/v2/docs/content/docs/components/number-field.md
Example of configuring the NumberField to display values as percentages using `formatOptions.style: 'percent'`. Requires manual step adjustment.
```APIDOC
## Example - Percentage
You can set `formatOptions.style` to `percent` to treat the value as a percentage. You need to set the step to 0.01 manually to allow an appropriate step size in this mode.
```vue line=3-7
…
```
```
--------------------------------
### Command Menu Usage
Source: https://github.com/unovue/reka-ui/blob/v2/docs/content/docs/components/combobox.md
Shows how to use Combobox primitives to build a custom Command Menu component. This example assumes the existence of 'Command' and 'CommandItem' components.
```vue
Item 1
Item 2
Item 3
```
--------------------------------
### Get Current Locale with useLocale
Source: https://github.com/unovue/reka-ui/blob/v2/docs/content/docs/utilities/use-locale.md
Import and call `useLocale` to get the locale set by the nearest `ConfigProvider`. Ensure `ConfigProvider` is set up with a `locale` prop.
```typescript
import { useLocale } from 'reka-ui'
// With ConfigProvider setup as follows
//
const locale = useLocale() // fr-FR
```
--------------------------------
### Toolbar Anatomy and Import
Source: https://github.com/unovue/reka-ui/blob/v2/docs/content/docs/components/toolbar.md
Demonstrates how to import and structure the basic Toolbar component with its various parts.
```vue
```
--------------------------------
### Number Field Example - Currency
Source: https://github.com/unovue/reka-ui/blob/v2/docs/content/docs/components/number-field.md
Example of using the NumberField for currency values with `formatOptions.style: 'currency'` and specifying the currency code. Note that currency changes require a separate control.
```APIDOC
## Example - Currency
You can set `formatOptions.style` to `currency` to treat the value as a currency value. The currency option must also be passed to set the currency code (e.g., USD).
If you need to allow the user to change the currency, you should include a separate dropdown next to the number field. The number field itself will not determine the currency from the user input.
```vue line=4-9
…
```
```
--------------------------------
### Select Component Anatomy
Source: https://github.com/unovue/reka-ui/blob/v2/docs/content/docs/components/select.md
Demonstrates the basic structure and import of all Select component parts. This example shows how to assemble the various pieces of the Select component.
```vue
```
--------------------------------
### Build Nuxt 3 Application for Production
Source: https://github.com/unovue/reka-ui/blob/v2/playground/nuxt/README.md
Commands to build the Nuxt 3 application for production deployment using npm, pnpm, or yarn.
```bash
npm run build
```
```bash
pnpm run build
```
```bash
yarn build
```
--------------------------------
### Custom portal container
Source: https://github.com/unovue/reka-ui/blob/v2/docs/content/docs/components/alert-dialog.md
Example of customizing the element that the alert dialog portals into.
```APIDOC
## Custom portal container
Customise the element that your alert dialog portals into.
```vue line=4,17
...
```
```
--------------------------------
### Vertical Orientation Example
Source: https://github.com/unovue/reka-ui/blob/v2/docs/content/docs/components/color-slider.md
A vertical slider for space-constrained layouts, demonstrating the `orientation` prop.
```APIDOC
## Vertical Orientation
A vertical slider for space-constrained layouts.
```vue
```
```
--------------------------------
### Alpha Channel Slider Example
Source: https://github.com/unovue/reka-ui/blob/v2/docs/content/docs/components/color-slider.md
Slider for adjusting the alpha (opacity) channel of a color.
```APIDOC
## Alpha Channel
Slider for adjusting the alpha (opacity) channel.
```vue
```
```
--------------------------------
### Dropdown Menu Basic Structure
Source: https://github.com/unovue/reka-ui/blob/v2/docs/content/docs/components/dropdown-menu.md
Basic setup for the Dropdown Menu component, including importing necessary parts and structuring the template.
```vue
…<\/DropdownMenuTrigger>
…
<\/DropdownMenuContent>
<\/DropdownMenuPortal>
<\/DropdownMenuRoot>
<\/template>
```
--------------------------------
### Customizing Filter Sensitivity
Source: https://github.com/unovue/reka-ui/blob/v2/docs/content/docs/utilities/use-filter.md
Customize the filtering behavior by providing `Intl.CollatorOptions`. This example demonstrates case-insensitive filtering.
```typescript
const { startsWith } = useFilter({ sensitivity: 'base' })
console.log(startsWith('Résumé', 'resume')) // true (case-insensitive)
```