### Install Progress Component
Source: https://reka-ui.com/docs/components/progress
Instructions for installing the Progress component using a command-line interface.
```bash
npm install reka-ui
# or
yarn add reka-ui
```
--------------------------------
### Splitter Component Installation and Basic Usage
Source: https://reka-ui.com/docs/components/splitter
Demonstrates how to install the Splitter component and use its core elements: SplitterGroup, SplitterPanel, and SplitterResizeHandle.
```APIDOC
## Splitter Component Installation and Basic Usage
### Description
This snippet shows the basic installation and usage of the Reka UI Splitter component, including importing and structuring the main components.
### Method
N/A (Component Usage)
### Endpoint
N/A (Component Usage)
### Parameters
N/A
### Request Example
```vue
```
### Response
N/A (Component Usage)
```
--------------------------------
### Example LLM Prompts for Reka UI
Source: https://reka-ui.com/docs/overview/getting-started
This snippet provides example prompts for interacting with Large Language Models (LLMs) to get assistance with Reka UI components, referencing the LLM-optimized documentation.
```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."
```
--------------------------------
### HoverCard: Instant Open Example
Source: https://reka-ui.com/docs/components/hover-card
Shows how to make the HoverCard appear instantly upon hover by setting the `openDelay` prop to 0. This example imports the necessary components and applies the prop to the HoverCardRoot.
```vue
……
```
--------------------------------
### Basic Color Field Setup (Vue)
Source: https://reka-ui.com/docs/components/color-field
Demonstrates the fundamental setup of the Color Field component, including importing the necessary parts and structuring the template. It requires 'ColorFieldRoot' and 'ColorFieldInput' from 'reka-ui'.
```vue
```
--------------------------------
### Splitter - Pixel Sizing Example
Source: https://reka-ui.com/docs/components/splitter
Shows how to use pixel units for sizing splitter panels, useful for fixed-width elements like sidebars.
```APIDOC
## Splitter - Pixel Sizing Example
### Description
This example demonstrates using `sizeUnit="px"` to define fixed pixel dimensions for splitter panels. This is particularly useful for elements like sidebars that should maintain a consistent width regardless of parent container resizing. All sizing props (`defaultSize`, `minSize`, `maxSize`, `collapsedSize`) respect this unit.
### Method
N/A (Component Usage)
### Endpoint
N/A (Component Usage)
### Parameters
#### Path Parameters
N/A
#### Query Parameters
N/A
#### Request Body
N/A
### Request Example
```vue
Fixed-width sidebar
Flexible content
```
### Response
N/A (Component Usage)
```
--------------------------------
### HSL Saturation/Lightness Example
Source: https://reka-ui.com/docs/components/color-area
An example demonstrating the Color Area component used for selecting saturation and lightness within the HSL color space.
```APIDOC
### HSL Saturation/Lightness
A common use case for color area is selecting saturation and lightness in HSL color space.
```vue
```
```
--------------------------------
### Basic Pin Input Setup
Source: https://reka-ui.com/docs/components/pin-input
Demonstrates the basic implementation of the Pin Input component by importing the necessary Root and Input parts from Reka UI.
```vue
```
--------------------------------
### Context Menu Example with Submenus
Source: https://reka-ui.com/docs/components/context-menu
Demonstrates how to create nested submenus within the Context Menu component.
```APIDOC
## Examples
### With submenus
You can create submenus by using `ContextMenuSub` in combination with its parts.
```vue line=24-33
………Sub menu →Sub menu itemSub menu item…
```
```
--------------------------------
### Splitter - Collapsible Panels Example
Source: https://reka-ui.com/docs/components/splitter
Demonstrates how to make splitter panels collapsible using the `collapsible`, `collapsedSize`, and `minSize` props.
```APIDOC
## Splitter - Collapsible Panels Example
### Description
This example shows how to configure splitter panels to be collapsible. When a panel's size reaches `minSize`, it can collapse to `collapsedSize` if the `collapsible` prop is enabled.
### Method
N/A (Component Usage)
### Endpoint
N/A (Component Usage)
### Parameters
#### Path Parameters
N/A
#### Query Parameters
N/A
#### Request Body
N/A
### Request Example
```vue
Panel A
Panel B
```
### Response
N/A (Component Usage)
```
--------------------------------
### Channel Input Example (Vue)
Source: https://reka-ui.com/docs/components/color-field
Illustrates how to configure the Color Field component to input a specific color channel, such as 'hue' in the HSL color space. This example demonstrates the use of 'color-space' and 'channel' props.
```vue
```
--------------------------------
### Splitter - Custom Handle Example
Source: https://reka-ui.com/docs/components/splitter
Illustrates how to customize the appearance of the resize handle by passing custom content via slots.
```APIDOC
## Splitter - Custom Handle Example
### Description
This example shows how to customize the `SplitterResizeHandle` by providing custom content through its default slot. This allows for unique visual designs for the resizing interaction.
### Method
N/A (Component Usage)
### Endpoint
N/A (Component Usage)
### Parameters
#### Path Parameters
N/A
#### Query Parameters
N/A
#### Request Body
N/A
### Request Example
```vue
...
...
```
### Response
N/A (Component Usage)
```
--------------------------------
### Importing VisuallyHidden Component
Source: https://reka-ui.com/docs/utilities/visually-hidden
Demonstrates how to import and wrap content within the VisuallyHidden component in a Vue 3 setup script.
```vue
```
--------------------------------
### RGB Red/Green Selector Example
Source: https://reka-ui.com/docs/components/color-area
An example showcasing the Color Area component configured for selecting red and green channels within the RGB color space.
```APIDOC
### RGB Red/Green Selector
Using RGB color space with red and green channels.
```vue
```
```
--------------------------------
### Basic Autocomplete Usage
Source: https://reka-ui.com/docs/components/autocomplete
A practical example showing how to bind the Autocomplete component to a reactive string variable and render a list of selectable items.
```vue
{{ fruit }}
```
--------------------------------
### Vertical Slider Example (Vue & CSS)
Source: https://reka-ui.com/docs/components/slider
Shows how to configure the slider for vertical orientation using the 'orientation' prop and provides corresponding CSS for styling. This example is useful for space-constrained layouts.
```vue
// index.vue
```
```css
/* styles.css */
.SliderRoot {
position: relative;
display: flex;
align-items: center;
}
.SliderRoot[data-orientation="vertical"] {
flex-direction: column;
width: 20px;
height: 100px;
}
.SliderTrack {
position: relative;
flex-grow: 1;
background-color: grey;
}
.SliderTrack[data-orientation="vertical"] {
width: 3px;
}
.SliderRange {
position: absolute;
background-color: black;
}
.SliderRange[data-orientation="vertical"] {
width: 100%;
}
.SliderThumb {
display: block;
width: 20px;
height: 20px;
background-color: black;
}
```
--------------------------------
### Global Tooltip Configuration (Vue)
Source: https://reka-ui.com/docs/components/tooltip
Shows how to configure tooltip behavior globally using the `TooltipProvider`. This example sets `delayDuration` and `skipDelayDuration` for all tooltips within the provider, affecting their appearance and disappearance timings.
```vue
…………
```
--------------------------------
### Basic Date Range Field Setup in Vue
Source: https://reka-ui.com/docs/components/date-range-field
Demonstrates the basic structure for implementing a Date Range Field component using Vue. It shows how to import and assemble the Root and Input components from 'reka-ui'. This setup requires the [@internationalized/date](https://react-spectrum.adobe.com/internationalized/date/index.html) package for date functionalities.
```vue
```
--------------------------------
### Basic Switch Anatomy
Source: https://reka-ui.com/docs/components/switch
Demonstrates the basic structure of the Switch component by importing and assembling its root and thumb parts. This is the foundational setup for using the Switch.
```vue
```
--------------------------------
### Create Custom Select API
Source: https://reka-ui.com/docs/components/select
Provides an example of creating a custom Select API by abstracting the primitive parts of the Reka UI Select component. This usage example shows a simplified 'Select' component that internally uses 'SelectItem' and manages its own default value, demonstrating how to build custom components on top of the primitives.
```vue
```
--------------------------------
### Hex Color Input Example (Vue)
Source: https://reka-ui.com/docs/components/color-field
Shows a basic example of using the Color Field component to input a hex color value. It utilizes Vue's 'ref' for state management and binds the color value to the 'v-model' directive of 'ColorFieldRoot'.
```vue
```
--------------------------------
### Customizing Toast Behavior and Appearance
Source: https://reka-ui.com/docs/components/toast
Examples of customizing toast hotkeys, durations, handling multiple instances, and implementing swipe animations using CSS variables.
```vue
```
```vue
Saved!
```
```vue
Saved!
```
```vue
```
```css
.ToastRoot[data-swipe='move'] {
transform: translateX(var(--reka-toast-swipe-move-x));
}
.ToastRoot[data-swipe='cancel'] {
transform: translateX(0);
transition: transform 200ms ease-out;
}
.ToastRoot[data-swipe='end'] {
animation: slideRight 100ms ease-out;
}
@keyframes slideRight {
from {
transform: translateX(var(--reka-toast-swipe-end-x));
}
to {
transform: translateX(100%);
}
}
```
--------------------------------
### Import Reka UI Tree Components
Source: https://reka-ui.com/docs/components/tree
Demonstrates how to import the necessary Tree components (TreeItem, TreeRoot, TreeVirtualizer) from the 'reka-ui' library for basic tree structure setup.
```vue
```
--------------------------------
### Switch with Custom Values
Source: https://reka-ui.com/docs/components/switch
Shows how to use the `trueValue` and `falseValue` props to define custom values for the switch's on and off states, using both string and number examples.
```APIDOC
## Custom Values
Use the `trueValue` and `falseValue` props to specify custom values for the on and off states instead of the default `true`/`false`.
```vue line=4-5,9-10
Status: {{ status }}Enabled: {{ enabled }}
```
```
--------------------------------
### Implement Reka UI Separator
Source: https://reka-ui.com/docs/components/separator
This snippet demonstrates how to import and use the Separator component within a Vue 3 setup script. It requires the reka-ui package to be installed in your project.
```vue
```
--------------------------------
### Animating Collapsible Content Size with CSS
Source: https://reka-ui.com/docs/components/collapsible
Shows how to animate the size of the collapsible content using CSS variables `--reka-collapsible-content-width` and `--reka-collapsible-content-height`. This example includes Vue component setup and the necessary CSS for slide animations.
```vue
// index.vue
…
…
```
```css
/* styles.css */
.CollapsibleContent {
overflow: hidden;
}
.CollapsibleContent[data-state="open"] {
animation: slideDown 300ms ease-out;
}
.CollapsibleContent[data-state="closed"] {
animation: slideUp 300ms ease-out;
}
@keyframes slideDown {
from {
height: 0;
}
to {
height: var(--reka-collapsible-content-height);
}
}
@keyframes slideUp {
from {
height: var(--reka-collapsible-content-height);
}
to {
height: 0;
}
}
```
--------------------------------
### Disabled State Example
Source: https://reka-ui.com/docs/components/color-area
An example illustrating how to disable user interaction with the Color Area component.
```APIDOC
### Disabled State
Disable interaction with the color area.
```vue
```
```
--------------------------------
### Toast with Alternative Action
Source: https://reka-ui.com/docs/components/toast
Demonstrates how to use the `altText` prop on `ToastAction` to provide screen reader users with an alternative way to action the toast. This example shows a toast for an upgrade notification and another for a file removal confirmation with an undo option.
```APIDOC
## Toast with Alternative Action
### Description
Use the `altText` prop on the `Action` to instruct an alternative way of actioning the toast to screen reader users. You can direct the user to a permanent place in your application where they can action it or implement your own custom hotkey logic. If implementing the latter, use `foreground` type to announce immediately and increase the duration to give the user ample time.
### Request Example
```vue
Upgrade Available!We've just released Reka UI 2.0.
Upgrade
DismissFile removed successfully.
Undo Alt+UDismiss
```
```
--------------------------------
### Get Current Locale with useLocale Hook (TypeScript)
Source: https://reka-ui.com/docs/utilities/use-locale
Demonstrates how to import and use the useLocale hook from 'reka-ui' to get the currently configured locale. Assumes ConfigProvider is set up.
```typescript
import { useLocale } from 'reka-ui'
// With ConfigProvider setup as follows
//
const locale = useLocale() // fr-FR
```
--------------------------------
### Setup VueI18n for Multi-Language Support
Source: https://reka-ui.com/docs/guides/i18n
Configures VueI18n to manage multiple translation locales. This setup is essential for handling different language directions and text content within a Reka UI application.
```typescript
import { createApp } from 'vue'
import './style.css'
import App from './App.vue'
import { createI18n } from 'vue-i18n'
const messages = {
en: { hello: 'Hello' },
fa: { hello: 'درود' },
ar: { hello: 'مرحبا' },
ja: { hello: 'こんにちは' }
}
const i18n = createI18n({
legacy: false,
locale: 'en',
availableLocales: ['en', 'fa', 'ar', 'ja'],
messages,
})
createApp(App)
.use(i18n)
.mount('#app')
```
--------------------------------
### Reka UI Accordion Rotated Icon Example
Source: https://reka-ui.com/docs/components/accordion
Provides an example of how to add a decorative icon (like a chevron) to the Accordion Trigger and rotate it when the item is open, using CSS transitions and data attributes.
```vue
// index.vue
Trigger text…
```
```css
/* styles.css */
.AccordionChevron {
transition: transform 300ms;
}
.AccordionTrigger[data-state="open"] > .AccordionChevron {
transform: rotate(180deg);
}
```
--------------------------------
### Presence Component - Force Mount
Source: https://reka-ui.com/docs/utilities/presence
Illustrates how to use the `force-mount` prop to ensure content is always rendered, even when the `present` prop is false.
```APIDOC
## Presence Component - Force Mount
### Description
Enables the `force-mount` prop to ensure that the content within the Presence component is always rendered in the DOM, regardless of the `present` prop's value. This is useful for maintaining component state or when animations need to be applied even to unmounted elements.
### Method
Component Usage (Vue.js)
### Endpoint
N/A (Component)
### Parameters
#### Props
- **present** (Boolean) - Required - Controls the visibility of the child element. If true, the element is present; if false, it is unmounted after its exit animation.
- **force-mount** (Boolean) - Optional - If true, the element will always be mounted in the DOM, even when `present` is false. Defaults to false.
### Request Example
```vue
This content will always be rendered
This content is hidden
```
### Response
#### Success Response (200)
N/A (Component renders UI elements)
#### Response Example
N/A
```
--------------------------------
### Implement Basic Select Component
Source: https://reka-ui.com/docs/components/select
Demonstrates the standard implementation of the Select component by importing necessary sub-components and structuring the template with Root, Trigger, and Content parts.
```vue
```
--------------------------------
### Get Current Direction with useDirection Hook (TypeScript)
Source: https://reka-ui.com/docs/utilities/use-direction
This snippet demonstrates how to import and use the useDirection hook from 'reka-ui' to get the current layout direction. It assumes a ConfigProvider is set up with a 'dir' prop. The hook returns the direction string.
```typescript
import { useDirection } from 'reka-ui'
// With ConfigProvider setup as follows
//
const locale = useDirection() // rtl
```
```typescript
import { useDirection } from 'reka-ui'
// With ConfigProvider setup as follows
//
const locale = useDirection('ltr') // ltr
```
--------------------------------
### Native Vue Slot Example
Source: https://reka-ui.com/docs/utilities/slot
Demonstrates how native Vue slots handle attributes, converting them into scoped slots that require manual assignment in the parent template. This example shows the limitation where an 'id' attribute is not automatically inherited by a child element.
```vue
...