# OVERVIEW
---
# Introduction (REACT)
## Motivation
Most popular UI component libraries are designed to work with a specific JavaScript framework. Building UI components
that work across different JavaScript frameworks presents significant challenges for organizations working with diverse
technology stacks.
## Solution
Ark UI provides components for building complex, interactive, and accessible user interfaces across multiple JavaScript
frameworks. To achieve this, Ark UI is built on top of [Zag.js](https://zagjs.com), a UI component library powered by
Finite State Machines. Check out the architecture diagram below for a high-level overview.
# Introduction (SOLID)
## Motivation
Most popular UI component libraries are designed to work with a specific JavaScript framework. Building UI components
that work across different JavaScript frameworks presents significant challenges for organizations working with diverse
technology stacks.
## Solution
Ark UI provides components for building complex, interactive, and accessible user interfaces across multiple JavaScript
frameworks. To achieve this, Ark UI is built on top of [Zag.js](https://zagjs.com), a UI component library powered by
Finite State Machines. Check out the architecture diagram below for a high-level overview.
# Introduction (VUE)
## Motivation
Most popular UI component libraries are designed to work with a specific JavaScript framework. Building UI components
that work across different JavaScript frameworks presents significant challenges for organizations working with diverse
technology stacks.
## Solution
Ark UI provides components for building complex, interactive, and accessible user interfaces across multiple JavaScript
frameworks. To achieve this, Ark UI is built on top of [Zag.js](https://zagjs.com), a UI component library powered by
Finite State Machines. Check out the architecture diagram below for a high-level overview.
# Getting Started (REACT)
## Quickstart
Running tight on schedule? No worries! Check out our quickstart examples to get started with Ark UI in seconds.
- [Next.js Template](https://stackblitz.com/edit/github-qcm2dskf)
- [Solid Start Template](https://stackblitz.com/edit/github-1hgkbbln)
- [Nuxt Template](https://stackblitz.com/edit/github-s3sg6syq)
## Setup Guide
Before you start, ensure you have a proper project setup. If not, follow your preferred application framework setup
guide and then return to this guide.
Install the Ark UI dependency using your preferred package manager.
```bash
npm install @ark-ui/react
// or
pnpm install @ark-ui/react
// or
yarn add @ark-ui/react
// or
bun add @ark-ui/react
```
In this guide, we will be adding a Slider component. Copy the following code to your project.
```tsx
import { Slider } from '@ark-ui/react/slider'
export const Basic = () => {
return (
Label
)
}
```
Ark UI is a headless component library that doesn't include default styles.
You can leverage the `data-scope` and `data-part` attributes to style your components with custom CSS.
For example, to style a slider component, you can target its parts using these attributes:
```css
/* Targets the */
[data-scope='slider'][data-part='root'] {
display: flex;
flex-direction: column;
}
```
Check out the [Styling Components guide](/react/docs/guides/styling) to learn more about styling components in Ark UI.
Congratulations! You've successfully set up and styled your components using Ark UI. If you run into any issues or have
questions, open an issue on our [GitHub](https://github.com/chakra-ui/ark/issues/new/choose) or reach out on
[Discord](https://discord.gg/ww6HE5xaZ2).
Happy hacking! ✌️
# Getting Started (SOLID)
## Quickstart
Running tight on schedule? No worries! Check out our quickstart examples to get started with Ark UI in seconds.
- [Next.js Template](https://stackblitz.com/edit/github-qcm2dskf)
- [Solid Start Template](https://stackblitz.com/edit/github-1hgkbbln)
- [Nuxt Template](https://stackblitz.com/edit/github-s3sg6syq)
## Setup Guide
Before you start, ensure you have a proper project setup. If not, follow your preferred application framework setup
guide and then return to this guide.
Install the Ark UI dependency using your preferred package manager.
```bash
npm install @ark-ui/solid
// or
pnpm install @ark-ui/solid
// or
yarn add @ark-ui/solid
// or
bun add @ark-ui/solid
```
In this guide, we will be adding a Slider component. Copy the following code to your project.
```tsx
import { Slider } from '@ark-ui/solid/slider'
export const Basic = () => {
return (
Label
)
}
```
Ark UI is a headless component library that doesn't include default styles.
You can leverage the `data-scope` and `data-part` attributes to style your components with custom CSS.
For example, to style a slider component, you can target its parts using these attributes:
```css
/* Targets the */
[data-scope='slider'][data-part='root'] {
display: flex;
flex-direction: column;
}
```
Check out the [Styling Components guide](/react/docs/guides/styling) to learn more about styling components in Ark UI.
Congratulations! You've successfully set up and styled your components using Ark UI. If you run into any issues or have
questions, open an issue on our [GitHub](https://github.com/chakra-ui/ark/issues/new/choose) or reach out on
[Discord](https://discord.gg/ww6HE5xaZ2).
Happy hacking! ✌️
# Getting Started (VUE)
## Quickstart
Running tight on schedule? No worries! Check out our quickstart examples to get started with Ark UI in seconds.
- [Next.js Template](https://stackblitz.com/edit/github-qcm2dskf)
- [Solid Start Template](https://stackblitz.com/edit/github-1hgkbbln)
- [Nuxt Template](https://stackblitz.com/edit/github-s3sg6syq)
## Setup Guide
Before you start, ensure you have a proper project setup. If not, follow your preferred application framework setup
guide and then return to this guide.
Install the Ark UI dependency using your preferred package manager.
```bash
npm install @ark-ui/vue
// or
pnpm install @ark-ui/vue
// or
yarn add @ark-ui/vue
// or
bun add @ark-ui/vue
```
In this guide, we will be adding a Slider component. Copy the following code to your project.
```vue
Label
```
Ark UI is a headless component library that doesn't include default styles.
You can leverage the `data-scope` and `data-part` attributes to style your components with custom CSS.
For example, to style a slider component, you can target its parts using these attributes:
```css
/* Targets the */
[data-scope='slider'][data-part='root'] {
display: flex;
flex-direction: column;
}
```
Check out the [Styling Components guide](/react/docs/guides/styling) to learn more about styling components in Ark UI.
Congratulations! You've successfully set up and styled your components using Ark UI. If you run into any issues or have
questions, open an issue on our [GitHub](https://github.com/chakra-ui/ark/issues/new/choose) or reach out on
[Discord](https://discord.gg/ww6HE5xaZ2).
Happy hacking! ✌️
# Changelog (REACT)
## [Unreleased]
## [5.2.0] - 2025-03-22
### Added
- **[NEW] DownloadTrigger**: Added Component for downloading a blob or file, whether retrieved synchronously or
asynchronously.
```tsx
import { DownloadTrigger } from '@ark-ui/react/download-trigger'
export const DownloadImage = () => {
async function fetchImage() {
const response = await fetch('https://picsum.photos/200/300')
return response.blob()
}
return (
Download Image
)
}
```
### Changed
- **NumberInput**: Set the default step to `0.01` when `formatOptions.style` was set to `percent`.
- **[Breaking] Splitter**: Redesigned splitter machine to support more use cases and improve DX. Check out the
[Splitter](https://ark-ui.com/react/docs/components/splitter) documentation for more details.
### Fixed
- **Toast**: Fixed issue where setting `offsets` to `undefined` caused the machine to throw.
- **Select**: Fixed issue where select `valueAsString` lost reactivity.
## [5.1.0] - 2025-03-17
### Added
- Added support for a cleanup function in `ref`.
### Fixed
- **Field**: Exported the missing `useField` hook.
- **NumberInput**: `onValueChange` correctly received `valueAsNumber`.
- **Slider**: Thumbs initialized correctly when `min` was set to a non-zero value.
## [5.0.1] - 2025-03-11
### Fixed
- Effects now flush synchronously instead of using a microtask.
- **Checkbox**: `data-invalid` is no longer set when `invalid` is `false`.
- **Combobox**: Fixed unexpected cursor movement when editing input.
- **PinInput**: OTP SMS autofill now works as expected.
- **RatingGroup**: Fixed incorrect focus placement on the label.
- **TagsInput**: Improved caret detection to prevent unintended tag removal.
- **Timer**
- Fixed slowdown when switching tabs/windows.
- Changed default `interval` from `250` to `1000`.
## [5.0.0] - 2025-03-06
Ark UI just got a major performance boost! 🚀
### What’s new in v5?
- **Blazing-fast performance** – Every component runs smoother and renders faster.
- **Smaller bundle size** – Leaner components and adapters for a more efficient build.
We made this happen by using React’s native reactive primitives instead of external stores.
In our stress tests with **10,000 components**, Ark v5 delivered **1.5x–4x** better performance across the board.

### A quick note on tests
Most component updates are non-breaking, but due to this change, some tests may need adjustments. For example:
```jsx
// Before
it('should open by default', () => {
render()
expect(screen.getByRole('dialog')).toBeInTheDocument()
})
// After
it('should open by default', async () => {
render()
expect(await screen.findByRole('dialog')).toBeInTheDocument()
})
```
#### Added
- **Carousel**: ⚠️ Breaking change: Added required prop `slideCount` to `Carousel.Root` component.
- **Clipboard**: Added `onValueChange` and `defaultValue` props.
- **ColorPicker**: Added `defaultFormat` prop.
- **Combobox**: Added `defaultHighlightedValue` and `defaultInputValue` props.
- **DatePicker**: Added `defaultFocusedValue` prop, `getViewProps`, and `visibleRangeText`.
- **HoverCard**: Expanded interaction handlers.
- **Menu**: Added `defaultHighlightedValue` prop.
- **Pagination**: Added `defaultPageSize` prop.
- **PinInput**: Added `count` prop for better SSR aria-label.
- **Progress**: Added `locale` and `formatOptions` props.
- **QrCode**: Added `pixelSize` prop.
- **Select**: Added `defaultHighlightedValue` prop.
- **TagsInput**: Added `defaultInputValue` prop.
- **Toggle**: Reintroduced toggle machine.
#### Fixed
- **Accordion**: Fixed issue in Safari where clicking triggers didn't show content.
- **Avatar**: Fixed `api.setSrc` not working.
- **Carousel**: Fixed pagination sync and initial page issues.
- **File Upload**: Fixed drag-and-drop when `directory: true`.
- **Menu**: Fixed context menu positioning not updating on right-click.
- **Number Input**: Fixed `value` prop not being consumed.
- **Pin Input**: Fixed focus warnings and editing issues.
- **Progress**: Allowed more precise (decimal) values.
- **Radio Group, Switch**: Improved focus behavior in Safari.
- **Select**: Fixed regression where `multiple: true` didn't work.
- **Steps**: Ensured ARIA attributes use valid values and wrapped `
` elements correctly within `
` or ``.
- **Textarea**: Fixed `ResizeObserver` warning.
- **Timer**: Fixed stopping issue when switching tabs; resolved issue where `action` prop was passed to `ActionTrigger`.
- **Toast**: Fixed keyboard navigation skipping close button.
- **Toggle Group**: Fixed `data-focus` not being removed on blur.
# Changelog (SOLID)
## [Unreleased]
## [5.2.0] - 2025-03-22
### Added
- **[NEW] DownloadTrigger**: Added Component for downloading a blob or file, whether retrieved synchronously or
asynchronously.
```tsx
import { DownloadTrigger } from '@ark-ui/react/download-trigger'
export const DownloadImage = () => {
async function fetchImage() {
const response = await fetch('https://picsum.photos/200/300')
return response.blob()
}
return (
Download Image
)
}
```
### Changed
- **NumberInput**: Set the default step to `0.01` when `formatOptions.style` was set to `percent`.
- **[Breaking] Splitter**: Redesigned splitter machine to support more use cases and improve DX. Check out the
[Splitter](https://ark-ui.com/react/docs/components/splitter) documentation for more details.
### Fixed
- **Toast**: Fixed issue where setting `offsets` to `undefined` caused the machine to throw.
- **Select**: Fixed issue where select `valueAsString` lost reactivity.
## [5.1.0] - 2025-03-17
### Added
- Added support for a cleanup function in `ref`.
### Fixed
- **Field**: Exported the missing `useField` hook.
- **NumberInput**: `onValueChange` correctly received `valueAsNumber`.
- **Slider**: Thumbs initialized correctly when `min` was set to a non-zero value.
## [5.0.1] - 2025-03-11
### Fixed
- Effects now flush synchronously instead of using a microtask.
- **Checkbox**: `data-invalid` is no longer set when `invalid` is `false`.
- **Combobox**: Fixed unexpected cursor movement when editing input.
- **PinInput**: OTP SMS autofill now works as expected.
- **RatingGroup**: Fixed incorrect focus placement on the label.
- **TagsInput**: Improved caret detection to prevent unintended tag removal.
- **Timer**
- Fixed slowdown when switching tabs/windows.
- Changed default `interval` from `250` to `1000`.
## [5.0.0] - 2025-03-06
Ark UI just got a major performance boost! 🚀
### What’s new in v5?
- **Blazing-fast performance** – Every component runs smoother and renders faster.
- **Smaller bundle size** – Leaner components and adapters for a more efficient build.
We made this happen by using React’s native reactive primitives instead of external stores.
In our stress tests with **10,000 components**, Ark v5 delivered **1.5x–4x** better performance across the board.

### A quick note on tests
Most component updates are non-breaking, but due to this change, some tests may need adjustments. For example:
```jsx
// Before
it('should open by default', () => {
render()
expect(screen.getByRole('dialog')).toBeInTheDocument()
})
// After
it('should open by default', async () => {
render()
expect(await screen.findByRole('dialog')).toBeInTheDocument()
})
```
#### Added
- **Carousel**: ⚠️ Breaking change: Added required prop `slideCount` to `Carousel.Root` component.
- **Clipboard**: Added `onValueChange` and `defaultValue` props.
- **ColorPicker**: Added `defaultFormat` prop.
- **Combobox**: Added `defaultHighlightedValue` and `defaultInputValue` props.
- **DatePicker**: Added `defaultFocusedValue` prop, `getViewProps`, and `visibleRangeText`.
- **HoverCard**: Expanded interaction handlers.
- **Menu**: Added `defaultHighlightedValue` prop.
- **Pagination**: Added `defaultPageSize` prop.
- **PinInput**: Added `count` prop for better SSR aria-label.
- **Progress**: Added `locale` and `formatOptions` props.
- **QrCode**: Added `pixelSize` prop.
- **Select**: Added `defaultHighlightedValue` prop.
- **TagsInput**: Added `defaultInputValue` prop.
- **Toggle**: Reintroduced toggle machine.
#### Fixed
- **Accordion**: Fixed issue in Safari where clicking triggers didn't show content.
- **Avatar**: Fixed `api.setSrc` not working.
- **Carousel**: Fixed pagination sync and initial page issues.
- **File Upload**: Fixed drag-and-drop when `directory: true`.
- **Menu**: Fixed context menu positioning not updating on right-click.
- **Number Input**: Fixed `value` prop not being consumed.
- **Pin Input**: Fixed focus warnings and editing issues.
- **Progress**: Allowed more precise (decimal) values.
- **Radio Group, Switch**: Improved focus behavior in Safari.
- **Select**: Fixed regression where `multiple: true` didn't work.
- **Steps**: Ensured ARIA attributes use valid values and wrapped `
` elements correctly within `
` or ``.
- **Textarea**: Fixed `ResizeObserver` warning.
- **Timer**: Fixed stopping issue when switching tabs; resolved issue where `action` prop was passed to `ActionTrigger`.
- **Toast**: Fixed keyboard navigation skipping close button.
- **Toggle Group**: Fixed `data-focus` not being removed on blur.
# Changelog (VUE)
## [Unreleased]
## [5.2.0] - 2025-03-22
### Added
- **[NEW] DownloadTrigger**: Added Component for downloading a blob or file, whether retrieved synchronously or
asynchronously.
```tsx
import { DownloadTrigger } from '@ark-ui/react/download-trigger'
export const DownloadImage = () => {
async function fetchImage() {
const response = await fetch('https://picsum.photos/200/300')
return response.blob()
}
return (
Download Image
)
}
```
### Changed
- **NumberInput**: Set the default step to `0.01` when `formatOptions.style` was set to `percent`.
- **[Breaking] Splitter**: Redesigned splitter machine to support more use cases and improve DX. Check out the
[Splitter](https://ark-ui.com/react/docs/components/splitter) documentation for more details.
### Fixed
- **Toast**: Fixed issue where setting `offsets` to `undefined` caused the machine to throw.
- **Select**: Fixed issue where select `valueAsString` lost reactivity.
## [5.1.0] - 2025-03-17
### Added
- Added support for a cleanup function in `ref`.
### Fixed
- **Field**: Exported the missing `useField` hook.
- **NumberInput**: `onValueChange` correctly received `valueAsNumber`.
- **Slider**: Thumbs initialized correctly when `min` was set to a non-zero value.
## [5.0.1] - 2025-03-11
### Fixed
- Effects now flush synchronously instead of using a microtask.
- **Checkbox**: `data-invalid` is no longer set when `invalid` is `false`.
- **Combobox**: Fixed unexpected cursor movement when editing input.
- **PinInput**: OTP SMS autofill now works as expected.
- **RatingGroup**: Fixed incorrect focus placement on the label.
- **TagsInput**: Improved caret detection to prevent unintended tag removal.
- **Timer**
- Fixed slowdown when switching tabs/windows.
- Changed default `interval` from `250` to `1000`.
## [5.0.0] - 2025-03-06
Ark UI just got a major performance boost! 🚀
### What’s new in v5?
- **Blazing-fast performance** – Every component runs smoother and renders faster.
- **Smaller bundle size** – Leaner components and adapters for a more efficient build.
We made this happen by using React’s native reactive primitives instead of external stores.
In our stress tests with **10,000 components**, Ark v5 delivered **1.5x–4x** better performance across the board.

### A quick note on tests
Most component updates are non-breaking, but due to this change, some tests may need adjustments. For example:
```jsx
// Before
it('should open by default', () => {
render()
expect(screen.getByRole('dialog')).toBeInTheDocument()
})
// After
it('should open by default', async () => {
render()
expect(await screen.findByRole('dialog')).toBeInTheDocument()
})
```
#### Added
- **Carousel**: ⚠️ Breaking change: Added required prop `slideCount` to `Carousel.Root` component.
- **Clipboard**: Added `onValueChange` and `defaultValue` props.
- **ColorPicker**: Added `defaultFormat` prop.
- **Combobox**: Added `defaultHighlightedValue` and `defaultInputValue` props.
- **DatePicker**: Added `defaultFocusedValue` prop, `getViewProps`, and `visibleRangeText`.
- **HoverCard**: Expanded interaction handlers.
- **Menu**: Added `defaultHighlightedValue` prop.
- **Pagination**: Added `defaultPageSize` prop.
- **PinInput**: Added `count` prop for better SSR aria-label.
- **Progress**: Added `locale` and `formatOptions` props.
- **QrCode**: Added `pixelSize` prop.
- **Select**: Added `defaultHighlightedValue` prop.
- **TagsInput**: Added `defaultInputValue` prop.
- **Toggle**: Reintroduced toggle machine.
#### Fixed
- **Accordion**: Fixed issue in Safari where clicking triggers didn't show content.
- **Avatar**: Fixed `api.setSrc` not working.
- **Carousel**: Fixed pagination sync and initial page issues.
- **File Upload**: Fixed drag-and-drop when `directory: true`.
- **Menu**: Fixed context menu positioning not updating on right-click.
- **Number Input**: Fixed `value` prop not being consumed.
- **Pin Input**: Fixed focus warnings and editing issues.
- **Progress**: Allowed more precise (decimal) values.
- **Radio Group, Switch**: Improved focus behavior in Safari.
- **Select**: Fixed regression where `multiple: true` didn't work.
- **Steps**: Ensured ARIA attributes use valid values and wrapped `
` elements correctly within `
` or ``.
- **Textarea**: Fixed `ResizeObserver` warning.
- **Timer**: Fixed stopping issue when switching tabs; resolved issue where `action` prop was passed to `ActionTrigger`.
- **Toast**: Fixed keyboard navigation skipping close button.
- **Toggle Group**: Fixed `data-focus` not being removed on blur.
# Changelog (REACT)
## [Unreleased]
## [5.2.0] - 2025-03-22
### Added
- **[NEW] DownloadTrigger**: Added Component for downloading a blob or file, whether retrieved synchronously or
asynchronously.
```tsx
import { DownloadTrigger } from '@ark-ui/solid/download-trigger'
export const DownloadImage = () => {
async function fetchImage() {
const response = await fetch('https://picsum.photos/200/300')
return response.blob()
}
return (
Download Image
)
}
```
### Changed
- **NumberInput**: Set the default step to `0.01` when `formatOptions.style` was set to `percent`.
- **[Breaking] Splitter**: Redesigned splitter machine to support more use cases and improve DX. Check out the
[Splitter](https://ark-ui.com/solid/docs/components/splitter) documentation for more details.
### Fixed
- **Presence**: Fixed issue where `onExitComplete` was not being called.
- **Select**: Fixed issue where select `valueAsString` lost reactivity.
- **Toast**:
- Fixed issue where setting `offsets` to `undefined` caused the machine to throw.
- Fixed issue where `onExitComplete` was not being called.
## [5.1.1] - 2025-03-17
### Fixed
- **Field**: Exported the missing `useField` hook.
- **NumberInput**: `onValueChange` correctly received `valueAsNumber`.
- **Slider**: Thumbs initialized correctly when `min` was set to a non-zero value.
## [5.1.0] - 2025-03-11
### Added
- Implemented support for reactive props in `use-*.ts` functions.
```tsx
const accordionProps = createMemo(() => ({
multiple: true,
value: value(),
onValueChange: (e) => setValue(e.value),
}))
const accordion = useAccordion(accordionProps)
```
### Fixed
- **Checkbox**: `data-invalid` is no longer set when `invalid` is `false`.
- **Combobox**: Fixed unexpected cursor movement when editing input.
- **PinInput**: OTP SMS autofill now works as expected.
- **RatingGroup**: Fixed incorrect focus placement on the label.
- **TagsInput**: Improved caret detection to prevent unintended tag removal.
- **Timer**
- Fixed slowdown when switching tabs/windows.
- Changed default `interval` from `250` to `1000`.
## [5.0.0] - 2025-03-06
Ark UI just got a major performance boost! 🚀
### What’s new in v5?
- **Blazing-fast performance** – Every component runs smoother and renders faster.
- **Smaller bundle size** – Leaner components and adapters for a more efficient build.
We made this happen by using Solid's native reactive primitives instead of external stores.
In our stress tests with **10,000 components**, Ark v5 delivered **1.5x–4x** better performance across the board.
### A quick note on tests
Most component updates are non-breaking, but due to this change, some tests may need adjustments. For example:
```jsx
// Before
it('should open by default', () => {
render(() => )
expect(screen.getByRole('dialog')).toBeInTheDocument()
})
// After
it('should open by default', async () => {
render(() => )
expect(await screen.findByRole('dialog')).toBeInTheDocument()
})
```
#### Added
- **Carousel**: ⚠️ Breaking change: Added required prop `slideCount` to `Carousel.Root` component.
- **Clipboard**: Added `onValueChange` and `defaultValue` props.
- **ColorPicker**: Added `defaultFormat` prop.
- **Combobox**: Added `defaultHighlightedValue` and `defaultInputValue` props.
- **DatePicker**: Added `defaultFocusedValue` prop, `getViewProps`, and `visibleRangeText`.
- **HoverCard**: Expanded interaction handlers.
- **Menu**: Added `defaultHighlightedValue` prop.
- **Pagination**: Added `defaultPageSize` prop.
- **PinInput**: Added `count` prop for better SSR aria-label.
- **Progress**: Added `locale` and `formatOptions` props.
- **QrCode**: Added `pixelSize` prop.
- **Select**: Added `defaultHighlightedValue` prop.
- **TagsInput**: Added `defaultInputValue` prop.
- **Toggle**: Reintroduced toggle machine.
#### Fixed
- **Accordion**: Fixed issue in Safari where clicking triggers didn't show content.
- **Avatar**: Fixed `api.setSrc` not working.
- **Carousel**: Fixed pagination sync and initial page issues.
- **File Upload**: Fixed drag-and-drop when `directory: true`.
- **Menu**: Fixed context menu positioning not updating on right-click.
- **Number Input**: Fixed `value` prop not being consumed.
- **Pin Input**: Fixed focus warnings and editing issues.
- **Progress**: Allowed more precise (decimal) values.
- **Radio Group, Switch**: Improved focus behavior in Safari.
- **Select**: Fixed regression where `multiple: true` didn't work.
- **Steps**: Ensured ARIA attributes use valid values and wrapped `
` elements correctly within `
` or ``.
- **Textarea**: Fixed `ResizeObserver` warning.
- **Timer**: Fixed stopping issue when switching tabs; resolved issue where `action` prop was passed to `ActionTrigger`.
- **Toast**: Fixed keyboard navigation skipping close button.
- **Toggle Group**: Fixed `data-focus` not being removed on blur.
# Changelog (SOLID)
## [Unreleased]
## [5.2.0] - 2025-03-22
### Added
- **[NEW] DownloadTrigger**: Added Component for downloading a blob or file, whether retrieved synchronously or
asynchronously.
```tsx
import { DownloadTrigger } from '@ark-ui/solid/download-trigger'
export const DownloadImage = () => {
async function fetchImage() {
const response = await fetch('https://picsum.photos/200/300')
return response.blob()
}
return (
Download Image
)
}
```
### Changed
- **NumberInput**: Set the default step to `0.01` when `formatOptions.style` was set to `percent`.
- **[Breaking] Splitter**: Redesigned splitter machine to support more use cases and improve DX. Check out the
[Splitter](https://ark-ui.com/solid/docs/components/splitter) documentation for more details.
### Fixed
- **Presence**: Fixed issue where `onExitComplete` was not being called.
- **Select**: Fixed issue where select `valueAsString` lost reactivity.
- **Toast**:
- Fixed issue where setting `offsets` to `undefined` caused the machine to throw.
- Fixed issue where `onExitComplete` was not being called.
## [5.1.1] - 2025-03-17
### Fixed
- **Field**: Exported the missing `useField` hook.
- **NumberInput**: `onValueChange` correctly received `valueAsNumber`.
- **Slider**: Thumbs initialized correctly when `min` was set to a non-zero value.
## [5.1.0] - 2025-03-11
### Added
- Implemented support for reactive props in `use-*.ts` functions.
```tsx
const accordionProps = createMemo(() => ({
multiple: true,
value: value(),
onValueChange: (e) => setValue(e.value),
}))
const accordion = useAccordion(accordionProps)
```
### Fixed
- **Checkbox**: `data-invalid` is no longer set when `invalid` is `false`.
- **Combobox**: Fixed unexpected cursor movement when editing input.
- **PinInput**: OTP SMS autofill now works as expected.
- **RatingGroup**: Fixed incorrect focus placement on the label.
- **TagsInput**: Improved caret detection to prevent unintended tag removal.
- **Timer**
- Fixed slowdown when switching tabs/windows.
- Changed default `interval` from `250` to `1000`.
## [5.0.0] - 2025-03-06
Ark UI just got a major performance boost! 🚀
### What’s new in v5?
- **Blazing-fast performance** – Every component runs smoother and renders faster.
- **Smaller bundle size** – Leaner components and adapters for a more efficient build.
We made this happen by using Solid's native reactive primitives instead of external stores.
In our stress tests with **10,000 components**, Ark v5 delivered **1.5x–4x** better performance across the board.
### A quick note on tests
Most component updates are non-breaking, but due to this change, some tests may need adjustments. For example:
```jsx
// Before
it('should open by default', () => {
render(() => )
expect(screen.getByRole('dialog')).toBeInTheDocument()
})
// After
it('should open by default', async () => {
render(() => )
expect(await screen.findByRole('dialog')).toBeInTheDocument()
})
```
#### Added
- **Carousel**: ⚠️ Breaking change: Added required prop `slideCount` to `Carousel.Root` component.
- **Clipboard**: Added `onValueChange` and `defaultValue` props.
- **ColorPicker**: Added `defaultFormat` prop.
- **Combobox**: Added `defaultHighlightedValue` and `defaultInputValue` props.
- **DatePicker**: Added `defaultFocusedValue` prop, `getViewProps`, and `visibleRangeText`.
- **HoverCard**: Expanded interaction handlers.
- **Menu**: Added `defaultHighlightedValue` prop.
- **Pagination**: Added `defaultPageSize` prop.
- **PinInput**: Added `count` prop for better SSR aria-label.
- **Progress**: Added `locale` and `formatOptions` props.
- **QrCode**: Added `pixelSize` prop.
- **Select**: Added `defaultHighlightedValue` prop.
- **TagsInput**: Added `defaultInputValue` prop.
- **Toggle**: Reintroduced toggle machine.
#### Fixed
- **Accordion**: Fixed issue in Safari where clicking triggers didn't show content.
- **Avatar**: Fixed `api.setSrc` not working.
- **Carousel**: Fixed pagination sync and initial page issues.
- **File Upload**: Fixed drag-and-drop when `directory: true`.
- **Menu**: Fixed context menu positioning not updating on right-click.
- **Number Input**: Fixed `value` prop not being consumed.
- **Pin Input**: Fixed focus warnings and editing issues.
- **Progress**: Allowed more precise (decimal) values.
- **Radio Group, Switch**: Improved focus behavior in Safari.
- **Select**: Fixed regression where `multiple: true` didn't work.
- **Steps**: Ensured ARIA attributes use valid values and wrapped `
` elements correctly within `
` or ``.
- **Textarea**: Fixed `ResizeObserver` warning.
- **Timer**: Fixed stopping issue when switching tabs; resolved issue where `action` prop was passed to `ActionTrigger`.
- **Toast**: Fixed keyboard navigation skipping close button.
- **Toggle Group**: Fixed `data-focus` not being removed on blur.
# Changelog (VUE)
## [Unreleased]
## [5.2.0] - 2025-03-22
### Added
- **[NEW] DownloadTrigger**: Added Component for downloading a blob or file, whether retrieved synchronously or
asynchronously.
```tsx
import { DownloadTrigger } from '@ark-ui/solid/download-trigger'
export const DownloadImage = () => {
async function fetchImage() {
const response = await fetch('https://picsum.photos/200/300')
return response.blob()
}
return (
Download Image
)
}
```
### Changed
- **NumberInput**: Set the default step to `0.01` when `formatOptions.style` was set to `percent`.
- **[Breaking] Splitter**: Redesigned splitter machine to support more use cases and improve DX. Check out the
[Splitter](https://ark-ui.com/solid/docs/components/splitter) documentation for more details.
### Fixed
- **Presence**: Fixed issue where `onExitComplete` was not being called.
- **Select**: Fixed issue where select `valueAsString` lost reactivity.
- **Toast**:
- Fixed issue where setting `offsets` to `undefined` caused the machine to throw.
- Fixed issue where `onExitComplete` was not being called.
## [5.1.1] - 2025-03-17
### Fixed
- **Field**: Exported the missing `useField` hook.
- **NumberInput**: `onValueChange` correctly received `valueAsNumber`.
- **Slider**: Thumbs initialized correctly when `min` was set to a non-zero value.
## [5.1.0] - 2025-03-11
### Added
- Implemented support for reactive props in `use-*.ts` functions.
```tsx
const accordionProps = createMemo(() => ({
multiple: true,
value: value(),
onValueChange: (e) => setValue(e.value),
}))
const accordion = useAccordion(accordionProps)
```
### Fixed
- **Checkbox**: `data-invalid` is no longer set when `invalid` is `false`.
- **Combobox**: Fixed unexpected cursor movement when editing input.
- **PinInput**: OTP SMS autofill now works as expected.
- **RatingGroup**: Fixed incorrect focus placement on the label.
- **TagsInput**: Improved caret detection to prevent unintended tag removal.
- **Timer**
- Fixed slowdown when switching tabs/windows.
- Changed default `interval` from `250` to `1000`.
## [5.0.0] - 2025-03-06
Ark UI just got a major performance boost! 🚀
### What’s new in v5?
- **Blazing-fast performance** – Every component runs smoother and renders faster.
- **Smaller bundle size** – Leaner components and adapters for a more efficient build.
We made this happen by using Solid's native reactive primitives instead of external stores.
In our stress tests with **10,000 components**, Ark v5 delivered **1.5x–4x** better performance across the board.
### A quick note on tests
Most component updates are non-breaking, but due to this change, some tests may need adjustments. For example:
```jsx
// Before
it('should open by default', () => {
render(() => )
expect(screen.getByRole('dialog')).toBeInTheDocument()
})
// After
it('should open by default', async () => {
render(() => )
expect(await screen.findByRole('dialog')).toBeInTheDocument()
})
```
#### Added
- **Carousel**: ⚠️ Breaking change: Added required prop `slideCount` to `Carousel.Root` component.
- **Clipboard**: Added `onValueChange` and `defaultValue` props.
- **ColorPicker**: Added `defaultFormat` prop.
- **Combobox**: Added `defaultHighlightedValue` and `defaultInputValue` props.
- **DatePicker**: Added `defaultFocusedValue` prop, `getViewProps`, and `visibleRangeText`.
- **HoverCard**: Expanded interaction handlers.
- **Menu**: Added `defaultHighlightedValue` prop.
- **Pagination**: Added `defaultPageSize` prop.
- **PinInput**: Added `count` prop for better SSR aria-label.
- **Progress**: Added `locale` and `formatOptions` props.
- **QrCode**: Added `pixelSize` prop.
- **Select**: Added `defaultHighlightedValue` prop.
- **TagsInput**: Added `defaultInputValue` prop.
- **Toggle**: Reintroduced toggle machine.
#### Fixed
- **Accordion**: Fixed issue in Safari where clicking triggers didn't show content.
- **Avatar**: Fixed `api.setSrc` not working.
- **Carousel**: Fixed pagination sync and initial page issues.
- **File Upload**: Fixed drag-and-drop when `directory: true`.
- **Menu**: Fixed context menu positioning not updating on right-click.
- **Number Input**: Fixed `value` prop not being consumed.
- **Pin Input**: Fixed focus warnings and editing issues.
- **Progress**: Allowed more precise (decimal) values.
- **Radio Group, Switch**: Improved focus behavior in Safari.
- **Select**: Fixed regression where `multiple: true` didn't work.
- **Steps**: Ensured ARIA attributes use valid values and wrapped `
` elements correctly within `
` or ``.
- **Textarea**: Fixed `ResizeObserver` warning.
- **Timer**: Fixed stopping issue when switching tabs; resolved issue where `action` prop was passed to `ActionTrigger`.
- **Toast**: Fixed keyboard navigation skipping close button.
- **Toggle Group**: Fixed `data-focus` not being removed on blur.
# Changelog (REACT)
## [Unreleased]
### Changed
- Replaced custom ID generator with `$props.id()` rune.
## [0.3.0] - 2025-01-08
- Added `Format` component.
- Added `Progress` component.
## [0.2.0] - 2024-12-12
## Added
- Added `Ark` factory component for `asChild` prop.
- Added `Environment` component.
- Added `Collection` helpers.
- Added `Timer` component.
- Added `Highlight` component.
- Added `QrCode` component.
## [0.1.0] - 2024-11-27
### Added
- Added `Avatar` component.
## [0.0.0] - 2024-11-27
# Changelog (SOLID)
## [Unreleased]
### Changed
- Replaced custom ID generator with `$props.id()` rune.
## [0.3.0] - 2025-01-08
- Added `Format` component.
- Added `Progress` component.
## [0.2.0] - 2024-12-12
## Added
- Added `Ark` factory component for `asChild` prop.
- Added `Environment` component.
- Added `Collection` helpers.
- Added `Timer` component.
- Added `Highlight` component.
- Added `QrCode` component.
## [0.1.0] - 2024-11-27
### Added
- Added `Avatar` component.
## [0.0.0] - 2024-11-27
# Changelog (VUE)
## [Unreleased]
### Changed
- Replaced custom ID generator with `$props.id()` rune.
## [0.3.0] - 2025-01-08
- Added `Format` component.
- Added `Progress` component.
## [0.2.0] - 2024-12-12
## Added
- Added `Ark` factory component for `asChild` prop.
- Added `Environment` component.
- Added `Collection` helpers.
- Added `Timer` component.
- Added `Highlight` component.
- Added `QrCode` component.
## [0.1.0] - 2024-11-27
### Added
- Added `Avatar` component.
## [0.0.0] - 2024-11-27
# Changelog (REACT)
## [Unreleased]
## [5.2.0] - 2025-03-22
### Added
- **[NEW] DownloadTrigger**: Added Component for downloading a blob or file, whether retrieved synchronously or
asynchronously.
```tsx
import { DownloadTrigger } from '@ark-ui/react/download-trigger'
export const DownloadImage = () => {
async function fetchImage() {
const response = await fetch('https://picsum.photos/200/300')
return response.blob()
}
return (
Download Image
)
}
```
### Changed
- **NumberInput**: Set the default step to `0.01` when `formatOptions.style` was set to `percent`.
- **[Breaking] Splitter**: Redesigned splitter machine to support more use cases and improve DX. Check out the
[Splitter](https://ark-ui.com/react/docs/components/splitter) documentation for more details.
### Fixed
- **Toast**: Fixed issue where setting `offsets` to `undefined` caused the machine to throw.
- **Select**: Fixed issue where select `valueAsString` lost reactivity.
## [5.1.1] - 2025-03-17
### Fixed
- **Field**: Exported the missing `useField` hook.
- **NumberInput**: `onValueChange` correctly received `valueAsNumber`.
- **Slider**: Thumbs initialized correctly when `min` was set to a non-zero value.
## [5.1.0] - 2025-03-11
### Added
- Implemented support for reactive props in `use-*.ts` functions.
```tsx
const value = ref(['React'])
const accordionProps = computed(() => ({
multiple: true,
value: value.value,
onValueChange: (e) => (value.value = e.value),
}))
const accordion = useAccordion(accordionProps)
```
### Fixed
- **Checkbox**: `data-invalid` is no longer set when `invalid` is `false`.
- **Combobox**: Fixed unexpected cursor movement when editing input.
- **PinInput**: OTP SMS autofill now works as expected.
- **RatingGroup**: Fixed incorrect focus placement on the label.
- **TagsInput**: Improved caret detection to prevent unintended tag removal.
- **Timer**
- Fixed slowdown when switching tabs/windows.
- Changed default `interval` from `250` to `1000`.
## [5.0.2] - 2025-03-06
### Fixed
- **Steps**: Fixed issue where `Steps.X` namespace was not exported.
## [5.0.1] - 2025-03-06
Ark UI just got a major performance boost! 🚀
### What’s new in v5?
- **Blazing-fast performance** – Every component runs smoother and renders faster.
- **Smaller bundle size** – Leaner components and adapters for a more efficient build.
We made this happen by using Vue's native reactive primitives instead of external stores.
In our stress tests with **10,000 components**, Ark v5 delivered **1.5x–4x** better performance across the board.
### A quick note on tests
Most component updates are non-breaking, but due to this change, some tests may need adjustments. For example:
```jsx
// Before
it('should open by default', () => {
render(ComponentUnderTest, {
props: {
defaultOpen: true,
},
})
expect(screen.getByRole('dialog')).toBeInTheDocument()
})
// After
it('should open by default', async () => {
render(ComponentUnderTest, {
props: {
defaultOpen: true,
},
})
expect(await screen.findByRole('dialog')).toBeInTheDocument()
})
```
#### Added
- **Carousel**: ⚠️ Breaking change: Added required prop `slideCount` to `Carousel.Root` component.
- **Clipboard**: Added `onValueChange` and `defaultValue` props.
- **ColorPicker**: Added `defaultFormat` prop.
- **Combobox**: Added `defaultHighlightedValue` and `defaultInputValue` props.
- **DatePicker**: Added `defaultFocusedValue` prop, `getViewProps`, and `visibleRangeText`.
- **HoverCard**: Expanded interaction handlers.
- **Menu**: Added `defaultHighlightedValue` prop.
- **Pagination**: Added `defaultPageSize` prop.
- **PinInput**: Added `count` prop for better SSR aria-label.
- **Progress**: Added `locale` and `formatOptions` props.
- **QrCode**: Added `pixelSize` prop.
- **Select**: Added `defaultHighlightedValue` prop.
- **TagsInput**: Added `defaultInputValue` prop.
- **Toggle**: Reintroduced toggle machine.
#### Fixed
- **Accordion**: Fixed issue in Safari where clicking triggers didn't show content.
- **Avatar**: Fixed `api.setSrc` not working.
- **Carousel**: Fixed pagination sync and initial page issues.
- **File Upload**: Fixed drag-and-drop when `directory: true`.
- **Menu**: Fixed context menu positioning not updating on right-click.
- **Number Input**: Fixed `value` prop not being consumed.
- **Pin Input**: Fixed focus warnings and editing issues.
- **Progress**: Allowed more precise (decimal) values.
- **Radio Group, Switch**: Improved focus behavior in Safari.
- **Select**: Fixed regression where `multiple: true` didn't work.
- **Steps**: Ensured ARIA attributes use valid values and wrapped `
` elements correctly within `
` or ``.
- **Textarea**: Fixed `ResizeObserver` warning.
- **Timer**: Fixed stopping issue when switching tabs; resolved issue where `action` prop was passed to `ActionTrigger`.
- **Toast**: Fixed keyboard navigation skipping close button.
- **Toggle Group**: Fixed `data-focus` not being removed on blur.
# Changelog (SOLID)
## [Unreleased]
## [5.2.0] - 2025-03-22
### Added
- **[NEW] DownloadTrigger**: Added Component for downloading a blob or file, whether retrieved synchronously or
asynchronously.
```tsx
import { DownloadTrigger } from '@ark-ui/react/download-trigger'
export const DownloadImage = () => {
async function fetchImage() {
const response = await fetch('https://picsum.photos/200/300')
return response.blob()
}
return (
Download Image
)
}
```
### Changed
- **NumberInput**: Set the default step to `0.01` when `formatOptions.style` was set to `percent`.
- **[Breaking] Splitter**: Redesigned splitter machine to support more use cases and improve DX. Check out the
[Splitter](https://ark-ui.com/react/docs/components/splitter) documentation for more details.
### Fixed
- **Toast**: Fixed issue where setting `offsets` to `undefined` caused the machine to throw.
- **Select**: Fixed issue where select `valueAsString` lost reactivity.
## [5.1.1] - 2025-03-17
### Fixed
- **Field**: Exported the missing `useField` hook.
- **NumberInput**: `onValueChange` correctly received `valueAsNumber`.
- **Slider**: Thumbs initialized correctly when `min` was set to a non-zero value.
## [5.1.0] - 2025-03-11
### Added
- Implemented support for reactive props in `use-*.ts` functions.
```tsx
const value = ref(['React'])
const accordionProps = computed(() => ({
multiple: true,
value: value.value,
onValueChange: (e) => (value.value = e.value),
}))
const accordion = useAccordion(accordionProps)
```
### Fixed
- **Checkbox**: `data-invalid` is no longer set when `invalid` is `false`.
- **Combobox**: Fixed unexpected cursor movement when editing input.
- **PinInput**: OTP SMS autofill now works as expected.
- **RatingGroup**: Fixed incorrect focus placement on the label.
- **TagsInput**: Improved caret detection to prevent unintended tag removal.
- **Timer**
- Fixed slowdown when switching tabs/windows.
- Changed default `interval` from `250` to `1000`.
## [5.0.2] - 2025-03-06
### Fixed
- **Steps**: Fixed issue where `Steps.X` namespace was not exported.
## [5.0.1] - 2025-03-06
Ark UI just got a major performance boost! 🚀
### What’s new in v5?
- **Blazing-fast performance** – Every component runs smoother and renders faster.
- **Smaller bundle size** – Leaner components and adapters for a more efficient build.
We made this happen by using Vue's native reactive primitives instead of external stores.
In our stress tests with **10,000 components**, Ark v5 delivered **1.5x–4x** better performance across the board.
### A quick note on tests
Most component updates are non-breaking, but due to this change, some tests may need adjustments. For example:
```jsx
// Before
it('should open by default', () => {
render(ComponentUnderTest, {
props: {
defaultOpen: true,
},
})
expect(screen.getByRole('dialog')).toBeInTheDocument()
})
// After
it('should open by default', async () => {
render(ComponentUnderTest, {
props: {
defaultOpen: true,
},
})
expect(await screen.findByRole('dialog')).toBeInTheDocument()
})
```
#### Added
- **Carousel**: ⚠️ Breaking change: Added required prop `slideCount` to `Carousel.Root` component.
- **Clipboard**: Added `onValueChange` and `defaultValue` props.
- **ColorPicker**: Added `defaultFormat` prop.
- **Combobox**: Added `defaultHighlightedValue` and `defaultInputValue` props.
- **DatePicker**: Added `defaultFocusedValue` prop, `getViewProps`, and `visibleRangeText`.
- **HoverCard**: Expanded interaction handlers.
- **Menu**: Added `defaultHighlightedValue` prop.
- **Pagination**: Added `defaultPageSize` prop.
- **PinInput**: Added `count` prop for better SSR aria-label.
- **Progress**: Added `locale` and `formatOptions` props.
- **QrCode**: Added `pixelSize` prop.
- **Select**: Added `defaultHighlightedValue` prop.
- **TagsInput**: Added `defaultInputValue` prop.
- **Toggle**: Reintroduced toggle machine.
#### Fixed
- **Accordion**: Fixed issue in Safari where clicking triggers didn't show content.
- **Avatar**: Fixed `api.setSrc` not working.
- **Carousel**: Fixed pagination sync and initial page issues.
- **File Upload**: Fixed drag-and-drop when `directory: true`.
- **Menu**: Fixed context menu positioning not updating on right-click.
- **Number Input**: Fixed `value` prop not being consumed.
- **Pin Input**: Fixed focus warnings and editing issues.
- **Progress**: Allowed more precise (decimal) values.
- **Radio Group, Switch**: Improved focus behavior in Safari.
- **Select**: Fixed regression where `multiple: true` didn't work.
- **Steps**: Ensured ARIA attributes use valid values and wrapped `
` elements correctly within `
` or ``.
- **Textarea**: Fixed `ResizeObserver` warning.
- **Timer**: Fixed stopping issue when switching tabs; resolved issue where `action` prop was passed to `ActionTrigger`.
- **Toast**: Fixed keyboard navigation skipping close button.
- **Toggle Group**: Fixed `data-focus` not being removed on blur.
# Changelog (VUE)
## [Unreleased]
## [5.2.0] - 2025-03-22
### Added
- **[NEW] DownloadTrigger**: Added Component for downloading a blob or file, whether retrieved synchronously or
asynchronously.
```tsx
import { DownloadTrigger } from '@ark-ui/react/download-trigger'
export const DownloadImage = () => {
async function fetchImage() {
const response = await fetch('https://picsum.photos/200/300')
return response.blob()
}
return (
Download Image
)
}
```
### Changed
- **NumberInput**: Set the default step to `0.01` when `formatOptions.style` was set to `percent`.
- **[Breaking] Splitter**: Redesigned splitter machine to support more use cases and improve DX. Check out the
[Splitter](https://ark-ui.com/react/docs/components/splitter) documentation for more details.
### Fixed
- **Toast**: Fixed issue where setting `offsets` to `undefined` caused the machine to throw.
- **Select**: Fixed issue where select `valueAsString` lost reactivity.
## [5.1.1] - 2025-03-17
### Fixed
- **Field**: Exported the missing `useField` hook.
- **NumberInput**: `onValueChange` correctly received `valueAsNumber`.
- **Slider**: Thumbs initialized correctly when `min` was set to a non-zero value.
## [5.1.0] - 2025-03-11
### Added
- Implemented support for reactive props in `use-*.ts` functions.
```tsx
const value = ref(['React'])
const accordionProps = computed(() => ({
multiple: true,
value: value.value,
onValueChange: (e) => (value.value = e.value),
}))
const accordion = useAccordion(accordionProps)
```
### Fixed
- **Checkbox**: `data-invalid` is no longer set when `invalid` is `false`.
- **Combobox**: Fixed unexpected cursor movement when editing input.
- **PinInput**: OTP SMS autofill now works as expected.
- **RatingGroup**: Fixed incorrect focus placement on the label.
- **TagsInput**: Improved caret detection to prevent unintended tag removal.
- **Timer**
- Fixed slowdown when switching tabs/windows.
- Changed default `interval` from `250` to `1000`.
## [5.0.2] - 2025-03-06
### Fixed
- **Steps**: Fixed issue where `Steps.X` namespace was not exported.
## [5.0.1] - 2025-03-06
Ark UI just got a major performance boost! 🚀
### What’s new in v5?
- **Blazing-fast performance** – Every component runs smoother and renders faster.
- **Smaller bundle size** – Leaner components and adapters for a more efficient build.
We made this happen by using Vue's native reactive primitives instead of external stores.
In our stress tests with **10,000 components**, Ark v5 delivered **1.5x–4x** better performance across the board.
### A quick note on tests
Most component updates are non-breaking, but due to this change, some tests may need adjustments. For example:
```jsx
// Before
it('should open by default', () => {
render(ComponentUnderTest, {
props: {
defaultOpen: true,
},
})
expect(screen.getByRole('dialog')).toBeInTheDocument()
})
// After
it('should open by default', async () => {
render(ComponentUnderTest, {
props: {
defaultOpen: true,
},
})
expect(await screen.findByRole('dialog')).toBeInTheDocument()
})
```
#### Added
- **Carousel**: ⚠️ Breaking change: Added required prop `slideCount` to `Carousel.Root` component.
- **Clipboard**: Added `onValueChange` and `defaultValue` props.
- **ColorPicker**: Added `defaultFormat` prop.
- **Combobox**: Added `defaultHighlightedValue` and `defaultInputValue` props.
- **DatePicker**: Added `defaultFocusedValue` prop, `getViewProps`, and `visibleRangeText`.
- **HoverCard**: Expanded interaction handlers.
- **Menu**: Added `defaultHighlightedValue` prop.
- **Pagination**: Added `defaultPageSize` prop.
- **PinInput**: Added `count` prop for better SSR aria-label.
- **Progress**: Added `locale` and `formatOptions` props.
- **QrCode**: Added `pixelSize` prop.
- **Select**: Added `defaultHighlightedValue` prop.
- **TagsInput**: Added `defaultInputValue` prop.
- **Toggle**: Reintroduced toggle machine.
#### Fixed
- **Accordion**: Fixed issue in Safari where clicking triggers didn't show content.
- **Avatar**: Fixed `api.setSrc` not working.
- **Carousel**: Fixed pagination sync and initial page issues.
- **File Upload**: Fixed drag-and-drop when `directory: true`.
- **Menu**: Fixed context menu positioning not updating on right-click.
- **Number Input**: Fixed `value` prop not being consumed.
- **Pin Input**: Fixed focus warnings and editing issues.
- **Progress**: Allowed more precise (decimal) values.
- **Radio Group, Switch**: Improved focus behavior in Safari.
- **Select**: Fixed regression where `multiple: true` didn't work.
- **Steps**: Ensured ARIA attributes use valid values and wrapped `
` elements correctly within `
` or ``.
- **Textarea**: Fixed `ResizeObserver` warning.
- **Timer**: Fixed stopping issue when switching tabs; resolved issue where `action` prop was passed to `ActionTrigger`.
- **Toast**: Fixed keyboard navigation skipping close button.
- **Toggle Group**: Fixed `data-focus` not being removed on blur.
# About (REACT)
## Acknowledgments
We are committed to open source and the power of collaboration. Our work has been inspired by numerous projects and
individuals who continually drive us to innovate and improve.
- [Zag.js](https://zagjs.com/) - The foundation of this project
- [Park UI](https://park-ui.com) - For providing the styled component demos featured in this project
- [Radix Vue](https://www.radix-vue.com/) - For `useForwardPropsEmits`, which we re-export to build closed Vue
components
## License
This project is licensed under the terms of the [MIT license](https://github.com/chakra-ui/ark/blob/main/LICENSE).
# About (SOLID)
## Acknowledgments
We are committed to open source and the power of collaboration. Our work has been inspired by numerous projects and
individuals who continually drive us to innovate and improve.
- [Zag.js](https://zagjs.com/) - The foundation of this project
- [Park UI](https://park-ui.com) - For providing the styled component demos featured in this project
- [Radix Vue](https://www.radix-vue.com/) - For `useForwardPropsEmits`, which we re-export to build closed Vue
components
## License
This project is licensed under the terms of the [MIT license](https://github.com/chakra-ui/ark/blob/main/LICENSE).
# About (VUE)
## Acknowledgments
We are committed to open source and the power of collaboration. Our work has been inspired by numerous projects and
individuals who continually drive us to innovate and improve.
- [Zag.js](https://zagjs.com/) - The foundation of this project
- [Park UI](https://park-ui.com) - For providing the styled component demos featured in this project
- [Radix Vue](https://www.radix-vue.com/) - For `useForwardPropsEmits`, which we re-export to build closed Vue
components
## License
This project is licensed under the terms of the [MIT license](https://github.com/chakra-ui/ark/blob/main/LICENSE).
# LLMs.txt (REACT)
## What is LLMs.txt?
We support [LLMs.txt](https://llmstxt.org/) files for making the Ark UI documentation available to large language models
(LLMs). This feature helps AI tools better understand our component library, its APIs, and usage patterns.
## Available Routes
We provide several LLMs.txt routes to help AI tools access our documentation:
- [llms.txt](https://ark-ui.com/llms.txt) - Contains a structured overview of all components and their documentation
links
- [llms-full.txt](https://ark-ui.com/llms-full.txt) - Provides comprehensive documentation including implementation
details and examples
- [llms-react.txt](https://ark-ui.com/llms-react.txt) - React-specific documentation and implementation details
- [llms-solid.txt](https://ark-ui.com/llms-solid.txt) - SolidJS-specific documentation and implementation details
- [llms-vue.txt](https://ark-ui.com/llms-vue.txt) - Vue-specific documentation and implementation details
- [llms-svelte.txt](https://ark-ui.com/llms-svelte.txt) - Svelte-specific documentation and implementation details
## Usage with AI Tools
### Cursor
Use the `@Docs` feature in Cursor to include the LLMs.txt files in your project. This helps Cursor provide more accurate
code suggestions and documentation for Ark UI components.
[Read more about @Docs in Cursor](https://docs.cursor.com/context/@-symbols/@-docs)
### Windstatic
Reference the LLMs.txt files using `@` or in your `.windsurfrules` files to enhance Windstatic's understanding of Ark UI
components.
[Read more about Windstatic Memories](https://docs.codeium.com/windsurf/memories#memories-and-rules)
### Other AI Tools
Any AI tool that supports LLMs.txt can use these routes to better understand Ark UI. Simply point your tool to any of
the routes above based on your framework of choice.
# LLMs.txt (SOLID)
## What is LLMs.txt?
We support [LLMs.txt](https://llmstxt.org/) files for making the Ark UI documentation available to large language models
(LLMs). This feature helps AI tools better understand our component library, its APIs, and usage patterns.
## Available Routes
We provide several LLMs.txt routes to help AI tools access our documentation:
- [llms.txt](https://ark-ui.com/llms.txt) - Contains a structured overview of all components and their documentation
links
- [llms-full.txt](https://ark-ui.com/llms-full.txt) - Provides comprehensive documentation including implementation
details and examples
- [llms-react.txt](https://ark-ui.com/llms-react.txt) - React-specific documentation and implementation details
- [llms-solid.txt](https://ark-ui.com/llms-solid.txt) - SolidJS-specific documentation and implementation details
- [llms-vue.txt](https://ark-ui.com/llms-vue.txt) - Vue-specific documentation and implementation details
- [llms-svelte.txt](https://ark-ui.com/llms-svelte.txt) - Svelte-specific documentation and implementation details
## Usage with AI Tools
### Cursor
Use the `@Docs` feature in Cursor to include the LLMs.txt files in your project. This helps Cursor provide more accurate
code suggestions and documentation for Ark UI components.
[Read more about @Docs in Cursor](https://docs.cursor.com/context/@-symbols/@-docs)
### Windstatic
Reference the LLMs.txt files using `@` or in your `.windsurfrules` files to enhance Windstatic's understanding of Ark UI
components.
[Read more about Windstatic Memories](https://docs.codeium.com/windsurf/memories#memories-and-rules)
### Other AI Tools
Any AI tool that supports LLMs.txt can use these routes to better understand Ark UI. Simply point your tool to any of
the routes above based on your framework of choice.
# LLMs.txt (VUE)
## What is LLMs.txt?
We support [LLMs.txt](https://llmstxt.org/) files for making the Ark UI documentation available to large language models
(LLMs). This feature helps AI tools better understand our component library, its APIs, and usage patterns.
## Available Routes
We provide several LLMs.txt routes to help AI tools access our documentation:
- [llms.txt](https://ark-ui.com/llms.txt) - Contains a structured overview of all components and their documentation
links
- [llms-full.txt](https://ark-ui.com/llms-full.txt) - Provides comprehensive documentation including implementation
details and examples
- [llms-react.txt](https://ark-ui.com/llms-react.txt) - React-specific documentation and implementation details
- [llms-solid.txt](https://ark-ui.com/llms-solid.txt) - SolidJS-specific documentation and implementation details
- [llms-vue.txt](https://ark-ui.com/llms-vue.txt) - Vue-specific documentation and implementation details
- [llms-svelte.txt](https://ark-ui.com/llms-svelte.txt) - Svelte-specific documentation and implementation details
## Usage with AI Tools
### Cursor
Use the `@Docs` feature in Cursor to include the LLMs.txt files in your project. This helps Cursor provide more accurate
code suggestions and documentation for Ark UI components.
[Read more about @Docs in Cursor](https://docs.cursor.com/context/@-symbols/@-docs)
### Windstatic
Reference the LLMs.txt files using `@` or in your `.windsurfrules` files to enhance Windstatic's understanding of Ark UI
components.
[Read more about Windstatic Memories](https://docs.codeium.com/windsurf/memories#memories-and-rules)
### Other AI Tools
Any AI tool that supports LLMs.txt can use these routes to better understand Ark UI. Simply point your tool to any of
the routes above based on your framework of choice.
# GUIDES
---
# Animation (REACT)
Adding animation to Ark UI Components is as straightforward as with any other component, but keep in mind some
considerations when working with exit animations with JavaScript animation libraries.
## Animating with CSS
The most straightforward method to animate your elements is using CSS. You can animate both the mounting and unmounting
phases with CSS. The latter is achievable because Ark UI Components postpones the unmounting while your animation runs.
Below is a simple example of creating a fade-in and fade-out animation using CSS keyframes:
```css
@keyframes fadeIn {
from {
opacity: 0;
}
to {
opacity: 1;
}
}
@keyframes fadeOut {
from {
opacity: 1;
}
to {
opacity: 0;
}
}
```
You can use these keyframes to animate any element during its lifecycle. For instance, to apply the `fadeIn` animation
when your `Tooltip` enters the 'open' state, and `fadeOut` when it enters the 'closed' state, you could use the
following styles:
```css
[data-scope='tooltip'][data-part='content'][data-state='open'] {
animation: fadeIn 300ms ease-out;
}
[data-scope='tooltip'][data-part='content'][data-state='closed'] {
animation: fadeOut 300ms ease-in;
}
```
## Animating with JS Libraries
There's plenty of versatility when it comes to animating your Ark UI Elements with JavaScript libraries. Various
libraries such as GreenSock, anime.js, Framer Motion, and more can add a new level of interaction and feedback to your
UI components.
One significant advantage of using Ark UI Elements is the control you have over the unmounting phase of your components.
This is primarily facilitated through the `present` prop. The `present` prop allows the component to stay mounted even
after its enclosing condition has been falsified, allowing for exit animations to complete before the component is
removed from the DOM.
# Animation (SOLID)
Adding animation to Ark UI Components is as straightforward as with any other component, but keep in mind some
considerations when working with exit animations with JavaScript animation libraries.
## Animating with CSS
The most straightforward method to animate your elements is using CSS. You can animate both the mounting and unmounting
phases with CSS. The latter is achievable because Ark UI Components postpones the unmounting while your animation runs.
Below is a simple example of creating a fade-in and fade-out animation using CSS keyframes:
```css
@keyframes fadeIn {
from {
opacity: 0;
}
to {
opacity: 1;
}
}
@keyframes fadeOut {
from {
opacity: 1;
}
to {
opacity: 0;
}
}
```
You can use these keyframes to animate any element during its lifecycle. For instance, to apply the `fadeIn` animation
when your `Tooltip` enters the 'open' state, and `fadeOut` when it enters the 'closed' state, you could use the
following styles:
```css
[data-scope='tooltip'][data-part='content'][data-state='open'] {
animation: fadeIn 300ms ease-out;
}
[data-scope='tooltip'][data-part='content'][data-state='closed'] {
animation: fadeOut 300ms ease-in;
}
```
## Animating with JS Libraries
There's plenty of versatility when it comes to animating your Ark UI Elements with JavaScript libraries. Various
libraries such as GreenSock, anime.js, Framer Motion, and more can add a new level of interaction and feedback to your
UI components.
One significant advantage of using Ark UI Elements is the control you have over the unmounting phase of your components.
This is primarily facilitated through the `present` prop. The `present` prop allows the component to stay mounted even
after its enclosing condition has been falsified, allowing for exit animations to complete before the component is
removed from the DOM.
# Animation (VUE)
Adding animation to Ark UI Components is as straightforward as with any other component, but keep in mind some
considerations when working with exit animations with JavaScript animation libraries.
## Animating with CSS
The most straightforward method to animate your elements is using CSS. You can animate both the mounting and unmounting
phases with CSS. The latter is achievable because Ark UI Components postpones the unmounting while your animation runs.
Below is a simple example of creating a fade-in and fade-out animation using CSS keyframes:
```css
@keyframes fadeIn {
from {
opacity: 0;
}
to {
opacity: 1;
}
}
@keyframes fadeOut {
from {
opacity: 1;
}
to {
opacity: 0;
}
}
```
You can use these keyframes to animate any element during its lifecycle. For instance, to apply the `fadeIn` animation
when your `Tooltip` enters the 'open' state, and `fadeOut` when it enters the 'closed' state, you could use the
following styles:
```css
[data-scope='tooltip'][data-part='content'][data-state='open'] {
animation: fadeIn 300ms ease-out;
}
[data-scope='tooltip'][data-part='content'][data-state='closed'] {
animation: fadeOut 300ms ease-in;
}
```
## Animating with JS Libraries
There's plenty of versatility when it comes to animating your Ark UI Elements with JavaScript libraries. Various
libraries such as GreenSock, anime.js, Framer Motion, and more can add a new level of interaction and feedback to your
UI components.
One significant advantage of using Ark UI Elements is the control you have over the unmounting phase of your components.
This is primarily facilitated through the `present` prop. The `present` prop allows the component to stay mounted even
after its enclosing condition has been falsified, allowing for exit animations to complete before the component is
removed from the DOM.
# Closed Components (REACT)
## Motivation
Writing a few lines of code every time you need a simple `Avatar` is tedious. Creating a dedicated component
encapsulates logic, simplifies the API, ensures consistent usage, and maintains clean code. This approach enhances
reusability, making the component easier to maintain and test.
Here's an example of an `Avatar` component that can be used consistently across your application:
```tsx
import { Avatar as ArkAvatar } from '@ark-ui/react/avatar'
import { UserIcon } from 'lucide-react'
import { forwardRef } from 'react'
export interface AvatarProps extends ArkAvatar.RootProps {
name?: string
src?: string
}
export const Avatar = forwardRef((props, ref) => {
const { name, src, ...rootProps } = props
return (
{getInitials(name) || }
)
})
const getInitials = (name = '') =>
name
.split(' ')
.map((part) => part[0])
.slice(0, 2)
.join('')
.toUpperCase()
```
## Usage
To use the `Avatar` component, pass the `name` and `src` props as shown below:
```jsx
```
# Closed Components (SOLID)
## Motivation
Writing a few lines of code every time you need a simple `Avatar` is tedious. Creating a dedicated component
encapsulates logic, simplifies the API, ensures consistent usage, and maintains clean code. This approach enhances
reusability, making the component easier to maintain and test.
Here's an example of an `Avatar` component that can be used consistently across your application:
```tsx
import { Avatar as ArkAvatar } from '@ark-ui/solid/avatar'
import { UserIcon } from 'lucide-solid'
import { Show, splitProps } from 'solid-js'
export interface AvatarProps extends ArkAvatar.RootProps {
name?: string
src?: string
}
export const Avatar = (props: AvatarProps) => {
const [localProps, rootProps] = splitProps(props, ['name', 'src'])
return (
}>
{getInitials(localProps.name)}
)
}
const getInitials = (name = '') =>
name
.split(' ')
.map((part) => part[0])
.splice(0, 2)
.join('')
.toUpperCase()
```
## Usage
To use the `Avatar` component, pass the `name` and `src` props as shown below:
```jsx
```
# Closed Components (VUE)
## Motivation
Writing a few lines of code every time you need a simple `Avatar` is tedious. Creating a dedicated component
encapsulates logic, simplifies the API, ensures consistent usage, and maintains clean code. This approach enhances
reusability, making the component easier to maintain and test.
Here's an example of an `Avatar` component that can be used consistently across your application:
```vue
{{ getInitials }}
```
## Usage
To use the `Avatar` component, pass the `name` and `src` props as shown below:
```jsx
```
# Collection (REACT)
Collections are used to manage a collection of some kind, like menus, select, combobox, etc. They provide
functionalities such as sorting, searching, getting next or previous items, converting items to values or strings,
checking if an item is disabled, and more.
## List Collection
A list collection is a collection that is based on an array of items. It is created by passing an array of items to the
constructor.
```ts
import { createListCollection } from '@ark-ui/react/collection'
const collection = createListCollection({
items: [
{ label: 'Apple', value: 'apple' },
{ label: 'Banana', value: 'banana' },
],
})
console.log(collection.items) // [{ label: 'Apple', value: 'apple' }, { label: 'Banana', value: 'banana' }]
```
### Converting value to item
Use the `find` or `findMany` method to convert a value to an item.
```ts
const item = collection.find('banana')
console.log(item) // { label: "Banana", value: "banana" }
const items = collection.findMany(['apple', 'banana'])
console.log(items) // [{ label: "Apple", value: "apple" }, { label: "Banana", value: "banana" }]
```
### Value Traversal
Use the `getNextValue` or `getPreviousValue` method to get the next or previous item based on a value.
```ts
const nextValue = collection.getNextValue('apple')
console.log(nextValue) // banana
const previousItem = collection.getPreviousValue('banana')
console.log(previousItem) // apple
```
Likewise, use the `firstValue` or `lastValue` computed properties to get the first or last item.
```ts
console.log(collection.firstValue) // apple
console.log(collection.lastValue) // banana
```
### Check for value existence
Use the `has` method to check if a value exists in the collection.
```ts
const hasValue = collection.has('apple')
console.log(hasValue) // true
```
### Working with custom objects
If you are working with custom objects, you can pass a function to the `itemToString` and `itemToValue` options to
specify how to convert an item to a string and a value, respectively.
> By default, we look for the `label` and `value` properties in the item.
```ts
import { createListCollection } from '@ark-ui/react/collection'
const collection = createListCollection({
items: [
{ id: 1, name: 'apple' },
{ id: 2, name: 'banana' },
{ id: 3, name: 'cherry' },
],
itemToString: (item) => item.name,
itemToValue: (item) => item.id,
})
```
To mark an item as disabled, pass a function to the `isItemDisabled` option.
> By default, we look for the `disabled` property in the item.
```ts
import { createListCollection } from '@ark-ui/react/collection'
const collection = createListCollection({
items: [
{ id: 1, name: 'apple' },
{ id: 2, name: 'banana' },
{ id: 3, name: 'cherry' },
],
isItemDisabled: (item) => item.id === 2,
})
```
### Reorder items
Use the `reorder` method to reorder items by passing the starting index and the ending index of the item to be moved.
```ts
const fromIndex = 1 // Banana
const toIndex = 0 // Apple
collection.reorder(fromIndex, toIndex)
console.log(collection.items) // [{ label: "Banana", value: "banana" }, { label: "Apple", value: "apple" }]
```
# Collection (SOLID)
Collections are used to manage a collection of some kind, like menus, select, combobox, etc. They provide
functionalities such as sorting, searching, getting next or previous items, converting items to values or strings,
checking if an item is disabled, and more.
## List Collection
A list collection is a collection that is based on an array of items. It is created by passing an array of items to the
constructor.
```ts
import { createListCollection } from '@ark-ui/react/collection'
const collection = createListCollection({
items: [
{ label: 'Apple', value: 'apple' },
{ label: 'Banana', value: 'banana' },
],
})
console.log(collection.items) // [{ label: 'Apple', value: 'apple' }, { label: 'Banana', value: 'banana' }]
```
### Converting value to item
Use the `find` or `findMany` method to convert a value to an item.
```ts
const item = collection.find('banana')
console.log(item) // { label: "Banana", value: "banana" }
const items = collection.findMany(['apple', 'banana'])
console.log(items) // [{ label: "Apple", value: "apple" }, { label: "Banana", value: "banana" }]
```
### Value Traversal
Use the `getNextValue` or `getPreviousValue` method to get the next or previous item based on a value.
```ts
const nextValue = collection.getNextValue('apple')
console.log(nextValue) // banana
const previousItem = collection.getPreviousValue('banana')
console.log(previousItem) // apple
```
Likewise, use the `firstValue` or `lastValue` computed properties to get the first or last item.
```ts
console.log(collection.firstValue) // apple
console.log(collection.lastValue) // banana
```
### Check for value existence
Use the `has` method to check if a value exists in the collection.
```ts
const hasValue = collection.has('apple')
console.log(hasValue) // true
```
### Working with custom objects
If you are working with custom objects, you can pass a function to the `itemToString` and `itemToValue` options to
specify how to convert an item to a string and a value, respectively.
> By default, we look for the `label` and `value` properties in the item.
```ts
import { createListCollection } from '@ark-ui/react/collection'
const collection = createListCollection({
items: [
{ id: 1, name: 'apple' },
{ id: 2, name: 'banana' },
{ id: 3, name: 'cherry' },
],
itemToString: (item) => item.name,
itemToValue: (item) => item.id,
})
```
To mark an item as disabled, pass a function to the `isItemDisabled` option.
> By default, we look for the `disabled` property in the item.
```ts
import { createListCollection } from '@ark-ui/react/collection'
const collection = createListCollection({
items: [
{ id: 1, name: 'apple' },
{ id: 2, name: 'banana' },
{ id: 3, name: 'cherry' },
],
isItemDisabled: (item) => item.id === 2,
})
```
### Reorder items
Use the `reorder` method to reorder items by passing the starting index and the ending index of the item to be moved.
```ts
const fromIndex = 1 // Banana
const toIndex = 0 // Apple
collection.reorder(fromIndex, toIndex)
console.log(collection.items) // [{ label: "Banana", value: "banana" }, { label: "Apple", value: "apple" }]
```
# Collection (VUE)
Collections are used to manage a collection of some kind, like menus, select, combobox, etc. They provide
functionalities such as sorting, searching, getting next or previous items, converting items to values or strings,
checking if an item is disabled, and more.
## List Collection
A list collection is a collection that is based on an array of items. It is created by passing an array of items to the
constructor.
```ts
import { createListCollection } from '@ark-ui/react/collection'
const collection = createListCollection({
items: [
{ label: 'Apple', value: 'apple' },
{ label: 'Banana', value: 'banana' },
],
})
console.log(collection.items) // [{ label: 'Apple', value: 'apple' }, { label: 'Banana', value: 'banana' }]
```
### Converting value to item
Use the `find` or `findMany` method to convert a value to an item.
```ts
const item = collection.find('banana')
console.log(item) // { label: "Banana", value: "banana" }
const items = collection.findMany(['apple', 'banana'])
console.log(items) // [{ label: "Apple", value: "apple" }, { label: "Banana", value: "banana" }]
```
### Value Traversal
Use the `getNextValue` or `getPreviousValue` method to get the next or previous item based on a value.
```ts
const nextValue = collection.getNextValue('apple')
console.log(nextValue) // banana
const previousItem = collection.getPreviousValue('banana')
console.log(previousItem) // apple
```
Likewise, use the `firstValue` or `lastValue` computed properties to get the first or last item.
```ts
console.log(collection.firstValue) // apple
console.log(collection.lastValue) // banana
```
### Check for value existence
Use the `has` method to check if a value exists in the collection.
```ts
const hasValue = collection.has('apple')
console.log(hasValue) // true
```
### Working with custom objects
If you are working with custom objects, you can pass a function to the `itemToString` and `itemToValue` options to
specify how to convert an item to a string and a value, respectively.
> By default, we look for the `label` and `value` properties in the item.
```ts
import { createListCollection } from '@ark-ui/react/collection'
const collection = createListCollection({
items: [
{ id: 1, name: 'apple' },
{ id: 2, name: 'banana' },
{ id: 3, name: 'cherry' },
],
itemToString: (item) => item.name,
itemToValue: (item) => item.id,
})
```
To mark an item as disabled, pass a function to the `isItemDisabled` option.
> By default, we look for the `disabled` property in the item.
```ts
import { createListCollection } from '@ark-ui/react/collection'
const collection = createListCollection({
items: [
{ id: 1, name: 'apple' },
{ id: 2, name: 'banana' },
{ id: 3, name: 'cherry' },
],
isItemDisabled: (item) => item.id === 2,
})
```
### Reorder items
Use the `reorder` method to reorder items by passing the starting index and the ending index of the item to be moved.
```ts
const fromIndex = 1 // Banana
const toIndex = 0 // Apple
collection.reorder(fromIndex, toIndex)
console.log(collection.items) // [{ label: "Banana", value: "banana" }, { label: "Apple", value: "apple" }]
```
# Component State (REACT)
## Context Components
Context components expose state and functions to child components. In this example, `Avatar.Fallback` renders based on
`loaded` state.
```tsx
import { Avatar } from '@ark-ui/react/avatar'
export const Context = () => (
{(avatar) => {avatar.loaded ? 'PA' : 'Loading'}}
)
```
> **Good to know (RSC)**: Due to the usage of render prop, you might need to add the `'use client'` directive at the top
> of your file when using React Server Components.
## Provider Components
Provider components can help coordinate state and behavior between multiple components, enabling interactions that
aren't possible with `Context` components alone.
```tsx
import { Accordion, useAccordion } from '@ark-ui/react/accordion'
import { ChevronDownIcon } from 'lucide-react'
import { useState } from 'react'
export const RootProvider = () => {
const [value, setValue] = useState(['React'])
const accordion = useAccordion({
multiple: true,
value,
onValueChange: (e) => setValue(e.value),
})
return (
<>
{['React', 'Solid', 'Vue'].map((item) => (
What is {item}?
{item} is a JavaScript library for building user interfaces.
))}
>
)
}
```
See more in [Examples](/react/examples/popover-selection).
# Component State (SOLID)
## Context Components
Context components expose state and functions to child components. In this example, `Avatar.Fallback` renders based on
`loaded` state.
```tsx
import { Avatar } from '@ark-ui/solid/avatar'
export const Context = () => (
{(avatar) => {avatar().loaded ? 'PA' : 'Loading'}}
)
```
> **Good to know (RSC)**: Due to the usage of render prop, you might need to add the `'use client'` directive at the top
> of your file when using React Server Components.
## Provider Components
Provider components can help coordinate state and behavior between multiple components, enabling interactions that
aren't possible with `Context` components alone.
```tsx
import { Accordion, type UseAccordionProps, useAccordion } from '@ark-ui/solid/accordion'
import { ChevronDownIcon } from 'lucide-solid'
import { Index, createMemo, createSignal } from 'solid-js'
export const RootProvider = () => {
const [value, setValue] = createSignal(['React'])
const accordionProps = createMemo(() => ({
multiple: true,
value: value(),
onValueChange: (e) => setValue(e.value),
}))
const accordion = useAccordion(accordionProps)
return (
<>
{(item) => (
What is {item()}?
{item()} is a JavaScript library for building user interfaces.
)}
>
)
}
```
See more in [Examples](/react/examples/popover-selection).
# Component State (VUE)
## Context Components
Context components expose state and functions to child components. In this example, `Avatar.Fallback` renders based on
`loaded` state.
```vue
{{ avatar.loaded ? 'PA' : 'Loading' }}
```
> **Good to know (RSC)**: Due to the usage of render prop, you might need to add the `'use client'` directive at the top
> of your file when using React Server Components.
## Provider Components
Provider components can help coordinate state and behavior between multiple components, enabling interactions that
aren't possible with `Context` components alone.
```vue
What is {{ item }}?
{{ item }} is a JavaScript library for building user interfaces.
```
See more in [Examples](/react/examples/popover-selection).
# Composition (REACT)
## The asChild Prop
In Ark UI, the `asChild` prop lets you integrate custom components, ensuring consistent styling and behavior while
promoting flexibility and reusability. All Ark components that render a DOM element accept the `asChild` prop.
Here's an example using `asChild` to integrate a custom `Button` component within a `Popover`:
```tsx
import { Button } from '@acme/ui-lib'
import { Popover } from '@ark-ui/react/popover'
export const AsChild = () => (
)
```
In this example, the `asChild` prop allows the `Button` to be used as the trigger for the `Popover`, inheriting its
behaviors from Popover.Trigger.
## The Ark Factory
You can use the `ark` factory to create your own elements that work just like Ark UI components.
```tsx
import { ark } from '@ark-ui/react/factory'
export const ArkFactory = () => (
Ark UI
)
```
This will produce the following HTML:
```html
Ark UI
```
## Limitations
When using the `asChild` prop, ensure you pass only a single child element. Passing multiple children may cause
rendering issues.
Certain components, such as `Checkbox.Root` or `RadioGroup.Item`, have specific requirements for their child elements.
For instance, they may require a label element as a child. If you change the underlying element type, ensure it remains
accessible and functional.
# Composition (SOLID)
## The asChild Prop
In Ark UI, the `asChild` prop lets you integrate custom components, ensuring consistent styling and behavior while
promoting flexibility and reusability. All Ark components that render a DOM element accept the `asChild` prop.
Here's an example using `asChild` to integrate a custom `Button` component within a `Popover`:
```tsx
import { Button } from '@acme/ui-lib'
import { Popover } from '@ark-ui/solid/popover'
export const Basic = () => (
}>Open
)
```
In this example, the `asChild` prop allows the `Button` to be used as the trigger for the `Popover`, inheriting its
behaviors from Popover.Trigger.
## The Ark Factory
You can use the `ark` factory to create your own elements that work just like Ark UI components.
```tsx
import { ark } from '@ark-ui/solid/factory'
export const ArkFactory = () => (
}
>
Ark UI
)
```
This will produce the following HTML:
```html
Ark UI
```
## Limitations
When using the `asChild` prop, ensure you pass only a single child element. Passing multiple children may cause
rendering issues.
Certain components, such as `Checkbox.Root` or `RadioGroup.Item`, have specific requirements for their child elements.
For instance, they may require a label element as a child. If you change the underlying element type, ensure it remains
accessible and functional.
# Composition (VUE)
## The asChild Prop
In Ark UI, the `asChild` prop lets you integrate custom components, ensuring consistent styling and behavior while
promoting flexibility and reusability. All Ark components that render a DOM element accept the `asChild` prop.
Here's an example using `asChild` to integrate a custom `Button` component within a `Popover`:
```vue
```
In this example, the `asChild` prop allows the `Button` to be used as the trigger for the `Popover`, inheriting its
behaviors from Popover.Trigger.
## The Ark Factory
You can use the `ark` factory to create your own elements that work just like Ark UI components.
```vue
Ark UI
```
This will produce the following HTML:
```html
Ark UI
```
## Limitations
When using the `asChild` prop, ensure you pass only a single child element. Passing multiple children may cause
rendering issues.
Certain components, such as `Checkbox.Root` or `RadioGroup.Item`, have specific requirements for their child elements.
For instance, they may require a label element as a child. If you change the underlying element type, ensure it remains
accessible and functional.
# Styling (REACT)
## Overview
Ark UI is a headless component library that works with any styling solution. It provides functional styles for elements
like popovers for positioning, while leaving presentation styles up to you. Some components also expose CSS variables
that can be used for styling or animations.
> **Tip:** Looking for a ready-to-use solution? Checkout [Park UI](https://park-ui.com) for a collection of pre-designed
> styles based on Ark UI components.
### Data Attributes
Ark UI components use `data-scope` and `data-part` attributes to target specific elements within a component.
Interactive components often include `data-*` attributes to indicate their state. For example, here's what an open
accordion item looks like:
```html
```
For more details on each component's data attributes, refer to their respective documentation.
## Styling with CSS
When styling components with CSS, you can target the data attributes assigned to each component part for easy
customization.
### Styling a Part
To style a specific component part, target its `data-scope` and `data-part` attributes:
```css
[data-scope='accordion'][data-part='item'] {
border-bottom: 1px solid #e5e5e5;
}
```
### Styling a State
To style a component based on its state, use the `data-state` attribute:
```css
[data-scope='accordion'][data-part='item'][data-state='open'] {
background-color: #f5f5f5;
}
```
> **Tip:** If you prefer using classes instead of data attributes, utilize the `class` or `className` prop to add custom
> classes to Ark UI components.
## Styling with Panda CSS
[Panda CSS](https://panda-css.com) is a build-time CSS-in-JS framework that integrates seamlessly with Ark UI, providing
an efficient styling solution.
### Styling a part
Panda offers various ways to write styles, but in the context of Ark UI, we recommend using the `defineSlotRecipe`
function to style a component with its different parts and variants.
```ts
import { accordionAnatomy } from '@ark-ui/anatomy'
import { defineSlotRecipe } from '@pandacss/dev'
export const accordionStyles = defineSlotRecipe({
className: 'accordion',
slots: accordionAnatomy.keys(),
base: {
item: {
borderBottom: '1px solid #e5e5e5',
},
},
defaultVariants: {},
variants: {},
})
```
### Styling a state
To style a component based on its state, you can use built in
[conditions](https://panda-css.com/docs/customization/conditions) in Panda CSS.
```ts
import { accordionAnatomy } from '@ark-ui/anatomy'
import { defineSlotRecipe } from '@pandacss/dev'
export const accordionStyles = defineSlotRecipe({
className: 'accordion',
slots: accordionAnatomy.keys(),
base: {
item: {
borderBottom: '1px solid {colors.gray.300}',
_open: {
// [!code highlight]
backgroundColor: 'gray.100',
},
},
},
defaultVariants: {},
variants: {},
})
```
## Styling with Tailwind CSS
[Tailwind CSS](https://tailwindcss.com/) is a utility-first CSS framework providing a flexible way to style your
components.
### Styling a Part
To style a part, apply classes directly to the parts using either `class` or `className`, depending on the JavaScript
framework.
```jsx
{/* … */}
```
### Styling a State
Leverage Tailwind CSS's variant selector to style a component based on its data-state attribute.
```jsx
{/* … */}
```
# Styling (SOLID)
## Overview
Ark UI is a headless component library that works with any styling solution. It provides functional styles for elements
like popovers for positioning, while leaving presentation styles up to you. Some components also expose CSS variables
that can be used for styling or animations.
> **Tip:** Looking for a ready-to-use solution? Checkout [Park UI](https://park-ui.com) for a collection of pre-designed
> styles based on Ark UI components.
### Data Attributes
Ark UI components use `data-scope` and `data-part` attributes to target specific elements within a component.
Interactive components often include `data-*` attributes to indicate their state. For example, here's what an open
accordion item looks like:
```html
```
For more details on each component's data attributes, refer to their respective documentation.
## Styling with CSS
When styling components with CSS, you can target the data attributes assigned to each component part for easy
customization.
### Styling a Part
To style a specific component part, target its `data-scope` and `data-part` attributes:
```css
[data-scope='accordion'][data-part='item'] {
border-bottom: 1px solid #e5e5e5;
}
```
### Styling a State
To style a component based on its state, use the `data-state` attribute:
```css
[data-scope='accordion'][data-part='item'][data-state='open'] {
background-color: #f5f5f5;
}
```
> **Tip:** If you prefer using classes instead of data attributes, utilize the `class` or `className` prop to add custom
> classes to Ark UI components.
## Styling with Panda CSS
[Panda CSS](https://panda-css.com) is a build-time CSS-in-JS framework that integrates seamlessly with Ark UI, providing
an efficient styling solution.
### Styling a part
Panda offers various ways to write styles, but in the context of Ark UI, we recommend using the `defineSlotRecipe`
function to style a component with its different parts and variants.
```ts
import { accordionAnatomy } from '@ark-ui/anatomy'
import { defineSlotRecipe } from '@pandacss/dev'
export const accordionStyles = defineSlotRecipe({
className: 'accordion',
slots: accordionAnatomy.keys(),
base: {
item: {
borderBottom: '1px solid #e5e5e5',
},
},
defaultVariants: {},
variants: {},
})
```
### Styling a state
To style a component based on its state, you can use built in
[conditions](https://panda-css.com/docs/customization/conditions) in Panda CSS.
```ts
import { accordionAnatomy } from '@ark-ui/anatomy'
import { defineSlotRecipe } from '@pandacss/dev'
export const accordionStyles = defineSlotRecipe({
className: 'accordion',
slots: accordionAnatomy.keys(),
base: {
item: {
borderBottom: '1px solid {colors.gray.300}',
_open: {
// [!code highlight]
backgroundColor: 'gray.100',
},
},
},
defaultVariants: {},
variants: {},
})
```
## Styling with Tailwind CSS
[Tailwind CSS](https://tailwindcss.com/) is a utility-first CSS framework providing a flexible way to style your
components.
### Styling a Part
To style a part, apply classes directly to the parts using either `class` or `className`, depending on the JavaScript
framework.
```jsx
{/* … */}
```
### Styling a State
Leverage Tailwind CSS's variant selector to style a component based on its data-state attribute.
```jsx
{/* … */}
```
# Styling (VUE)
## Overview
Ark UI is a headless component library that works with any styling solution. It provides functional styles for elements
like popovers for positioning, while leaving presentation styles up to you. Some components also expose CSS variables
that can be used for styling or animations.
> **Tip:** Looking for a ready-to-use solution? Checkout [Park UI](https://park-ui.com) for a collection of pre-designed
> styles based on Ark UI components.
### Data Attributes
Ark UI components use `data-scope` and `data-part` attributes to target specific elements within a component.
Interactive components often include `data-*` attributes to indicate their state. For example, here's what an open
accordion item looks like:
```html
```
For more details on each component's data attributes, refer to their respective documentation.
## Styling with CSS
When styling components with CSS, you can target the data attributes assigned to each component part for easy
customization.
### Styling a Part
To style a specific component part, target its `data-scope` and `data-part` attributes:
```css
[data-scope='accordion'][data-part='item'] {
border-bottom: 1px solid #e5e5e5;
}
```
### Styling a State
To style a component based on its state, use the `data-state` attribute:
```css
[data-scope='accordion'][data-part='item'][data-state='open'] {
background-color: #f5f5f5;
}
```
> **Tip:** If you prefer using classes instead of data attributes, utilize the `class` or `className` prop to add custom
> classes to Ark UI components.
## Styling with Panda CSS
[Panda CSS](https://panda-css.com) is a build-time CSS-in-JS framework that integrates seamlessly with Ark UI, providing
an efficient styling solution.
### Styling a part
Panda offers various ways to write styles, but in the context of Ark UI, we recommend using the `defineSlotRecipe`
function to style a component with its different parts and variants.
```ts
import { accordionAnatomy } from '@ark-ui/anatomy'
import { defineSlotRecipe } from '@pandacss/dev'
export const accordionStyles = defineSlotRecipe({
className: 'accordion',
slots: accordionAnatomy.keys(),
base: {
item: {
borderBottom: '1px solid #e5e5e5',
},
},
defaultVariants: {},
variants: {},
})
```
### Styling a state
To style a component based on its state, you can use built in
[conditions](https://panda-css.com/docs/customization/conditions) in Panda CSS.
```ts
import { accordionAnatomy } from '@ark-ui/anatomy'
import { defineSlotRecipe } from '@pandacss/dev'
export const accordionStyles = defineSlotRecipe({
className: 'accordion',
slots: accordionAnatomy.keys(),
base: {
item: {
borderBottom: '1px solid {colors.gray.300}',
_open: {
// [!code highlight]
backgroundColor: 'gray.100',
},
},
},
defaultVariants: {},
variants: {},
})
```
## Styling with Tailwind CSS
[Tailwind CSS](https://tailwindcss.com/) is a utility-first CSS framework providing a flexible way to style your
components.
### Styling a Part
To style a part, apply classes directly to the parts using either `class` or `className`, depending on the JavaScript
framework.
```jsx
{/* … */}
```
### Styling a State
Leverage Tailwind CSS's variant selector to style a component based on its data-state attribute.
```jsx
{/* … */}
```
# COMPONENTS
---
# Accordion (REACT)
## Features
- Full keyboard navigation
- Supports horizontal and vertical orientation
- Right-to-Left (RTL) support
- Single or multiple item expansion
- Controlled and uncontrolled modes
- Collapse each accordion item
## Anatomy
To set up the accordion correctly, it's essential to understand its anatomy and the naming of its parts.
> Each part includes a `data-part` attribute to help identify them in the DOM.
## Examples
### Default Expanded State
Set the `defaultValue` prop to specify which item should be expanded by default.
```tsx
import { Accordion } from '@ark-ui/react/accordion'
import { ChevronDownIcon } from 'lucide-react'
export const Basic = () => {
return (
{['React', 'Solid', 'Vue'].map((item) => (
What is {item}?
{item} is a JavaScript library for building user interfaces.
))}
)
}
```
### Collapsible
Use the `collapsible` prop to allow the user to collapse all panels.
```tsx
import { Accordion } from '@ark-ui/react/accordion'
import { ChevronDownIcon } from 'lucide-react'
export const Collapsible = () => {
return (
{['React', 'Solid', 'Vue'].map((item) => (
{item}
{item} is a JavaScript library for building user interfaces.
))}
)
}
```
### Multiple Panels
Use the `multiple` prop to allow multiple panels to be expanded simultaneously.
```tsx
import { Accordion } from '@ark-ui/react/accordion'
import { ChevronDownIcon } from 'lucide-react'
export const Multiple = () => {
return (
{['React', 'Solid', 'Vue'].map((item) => (
{item}
{item} is a JavaScript library for building user interfaces.
))}
)
}
```
### Horizontal Orientation
By default, the Accordion is oriented vertically. Use the `orientation` prop to switch to a horizontal layout.
```tsx
import { Accordion } from '@ark-ui/react/accordion'
import { ChevronDownIcon } from 'lucide-react'
export const Horizontal = () => {
return (
{['React', 'Solid', 'Vue'].map((item) => (
What is {item}?
{item} is a JavaScript library for building user interfaces.
))}
)
}
```
### Animate Content Size
Use the `--height` and/or `--width` CSS variables to animate the size of the content when it expands or closes:
```css
@keyframes slideDown {
from {
opacity: 0.01;
height: 0;
}
to {
opacity: 1;
height: var(--height);
}
}
@keyframes slideUp {
from {
opacity: 1;
height: var(--height);
}
to {
opacity: 0.01;
height: 0;
}
}
[data-scope='accordion'][data-part='item-content'][data-state='open'] {
animation: slideDown 250ms ease-in-out;
}
[data-scope='accordion'][data-part='item-content'][data-state='closed'] {
animation: slideUp 200ms ease-in-out;
}
```
### Using the Root Provider
The `RootProvider` component provides a context for the accordion. It accepts the value of the `useAccordion` hook. You
can leverage it to access the component state and methods from outside the accordion.
```tsx
import { Accordion, useAccordion } from '@ark-ui/react/accordion'
import { ChevronDownIcon } from 'lucide-react'
import { useState } from 'react'
export const RootProvider = () => {
const [value, setValue] = useState(['React'])
const accordion = useAccordion({
multiple: true,
value,
onValueChange: (e) => setValue(e.value),
})
return (
<>
{['React', 'Solid', 'Vue'].map((item) => (
What is {item}?
{item} is a JavaScript library for building user interfaces.
))}
>
)
}
```
> If you're using the `RootProvider` component, you don't need to use the `Root` component.
### Accessing the focused item
Use the `focusedValue` property to get the value of the focused accordion item.
```tsx
import { Accordion } from '@ark-ui/react/accordion'
import { ChevronDownIcon } from 'lucide-react'
export const ContextFocusedValue = () => {
return (
{(context) => Focused item: {context.focusedValue}}
{['React', 'Solid', 'Vue'].map((item) => (
What is {item}?
{item} is a JavaScript library for building user interfaces.
))}
)
}
```
### Accessing the selected items
Use the `value` property to get the selected accordion items.
```tsx
import { Accordion } from '@ark-ui/react/accordion'
import { ChevronDownIcon } from 'lucide-react'
export const ContextValue = () => {
return (
{(context) => Selected items: {context.value.join(', ')}}
{['React', 'Solid', 'Vue'].map((item) => (
What is {item}?
{item} is a JavaScript library for building user interfaces.
))}
)
}
```
### Setting the selected items
Use the `setValue` method to set the selected accordion items.
```tsx
import { Accordion } from '@ark-ui/react/accordion'
import { ChevronDownIcon } from 'lucide-react'
export const ContextSetValue = () => {
return (
{(context) => }
{['React', 'Solid', 'Vue'].map((item) => (
What is {item}?
{item} is a JavaScript library for building user interfaces.
))}
)
}
```
### Accessing an item's state
Use the `getItemState` method to get the state of an accordion item.
```tsx
import { Accordion } from '@ark-ui/react/accordion'
import { ChevronDownIcon } from 'lucide-react'
export const ContextGetItemState = () => {
const items = [{ value: 'React' }, { value: 'Solid', disabled: true }, { value: 'Vue' }]
return (
{(context) => {
const itemState = context.getItemState(items[2])
return (
<>
Vue State: Disabled: {itemState.disabled ? 'Y' : 'N'} Expanded: {itemState.expanded ? 'Y' : 'N'} Focused: {itemState.focused ? 'Y' : 'N'}
>
)
}}
{items.map((item) => (
What is {item.value}?
{item.value} is a JavaScript library for building user interfaces.
))}
)
}
```
## API Reference
### Root
#### Props
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
**`collapsible`**
Type: `boolean`
Required: false
Default Value: `false`
Description: Whether an accordion item can be closed after it has been expanded.
**`defaultValue`**
Type: `string[]`
Required: false
Default Value: `undefined`
Description: The initial value of the expanded accordion items.
Use when you don't need to control the value of the accordion.
**`disabled`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Whether the accordion items are disabled
**`id`**
Type: `string`
Required: false
Default Value: `undefined`
Description: The unique identifier of the machine.
**`ids`**
Type: `Partial<{
root: string
item(value: string): string
itemContent(value: string): string
itemTrigger(value: string): string
}>`
Required: false
Default Value: `undefined`
Description: The ids of the elements in the accordion. Useful for composition.
**`lazyMount`**
Type: `boolean`
Required: false
Default Value: `false`
Description: Whether to enable lazy mounting
**`multiple`**
Type: `boolean`
Required: false
Default Value: `false`
Description: Whether multiple accordion items can be expanded at the same time.
**`onFocusChange`**
Type: `(details: FocusChangeDetails) => void`
Required: false
Default Value: `undefined`
Description: The callback fired when the focused accordion item changes.
**`onValueChange`**
Type: `(details: ValueChangeDetails) => void`
Required: false
Default Value: `undefined`
Description: The callback fired when the state of expanded/collapsed accordion items changes.
**`orientation`**
Type: `'horizontal' | 'vertical'`
Required: false
Default Value: `"vertical"`
Description: The orientation of the accordion items.
**`unmountOnExit`**
Type: `boolean`
Required: false
Default Value: `false`
Description: Whether to unmount on exit.
**`value`**
Type: `string[]`
Required: false
Default Value: `undefined`
Description: The controlled value of the expanded accordion items.
#### Data Attributes
**`data-scope`**: accordion
**`data-part`**: root
**`data-orientation`**: The orientation of the accordion
### ItemContent
#### Props
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
#### Data Attributes
**`data-scope`**: accordion
**`data-part`**: item-content
**`data-state`**: "open" | "closed"
**`data-disabled`**: Present when disabled
**`data-focus`**: Present when focused
**`data-orientation`**: The orientation of the item
### ItemIndicator
#### Props
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
#### Data Attributes
**`data-scope`**: accordion
**`data-part`**: item-indicator
**`data-state`**: "open" | "closed"
**`data-disabled`**: Present when disabled
**`data-focus`**: Present when focused
**`data-orientation`**: The orientation of the item
### Item
#### Props
**`value`**
Type: `string`
Required: true
Default Value: `undefined`
Description: The value of the accordion item.
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
**`disabled`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Whether the accordion item is disabled.
#### Data Attributes
**`data-scope`**: accordion
**`data-part`**: item
**`data-state`**: "open" | "closed"
**`data-focus`**: Present when focused
**`data-disabled`**: Present when disabled
**`data-orientation`**: The orientation of the item
### ItemTrigger
#### Props
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
#### Data Attributes
**`data-scope`**: accordion
**`data-part`**: item-trigger
**`data-orientation`**: The orientation of the item
**`data-state`**: "open" | "closed"
### RootProvider
#### Props
**`value`**
Type: `UseAccordionReturn`
Required: true
Default Value: `undefined`
Description: undefined
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
**`lazyMount`**
Type: `boolean`
Required: false
Default Value: `false`
Description: Whether to enable lazy mounting
**`unmountOnExit`**
Type: `boolean`
Required: false
Default Value: `false`
Description: Whether to unmount on exit.
## Accessibility
This component complies with the
[Accordion WAI-ARIA design pattern](https://www.w3.org/WAI/ARIA/apg/patterns/accordion/).
### Keyboard Support
**`Space`**
Description: When focus is on an trigger of a collapsed item, the item is expanded
**`Enter`**
Description: When focus is on an trigger of a collapsed section, expands the section.
**`Tab`**
Description: Moves focus to the next focusable element
**`Shift + Tab`**
Description: Moves focus to the previous focusable element
**`ArrowDown`**
Description: Moves focus to the next trigger
**`ArrowUp`**
Description: Moves focus to the previous trigger.
**`Home`**
Description: When focus is on an trigger, moves focus to the first trigger.
**`End`**
Description: When focus is on an trigger, moves focus to the last trigger.
# Accordion (SOLID)
## Features
- Full keyboard navigation
- Supports horizontal and vertical orientation
- Right-to-Left (RTL) support
- Single or multiple item expansion
- Controlled and uncontrolled modes
- Collapse each accordion item
## Anatomy
To set up the accordion correctly, it's essential to understand its anatomy and the naming of its parts.
> Each part includes a `data-part` attribute to help identify them in the DOM.
## Examples
### Default Expanded State
Set the `defaultValue` prop to specify which item should be expanded by default.
```tsx
import { Accordion } from '@ark-ui/solid/accordion'
import { ChevronDownIcon } from 'lucide-solid'
import { Index } from 'solid-js'
export const Basic = () => {
return (
{(item) => (
What is {item()}?
{item()} is a JavaScript library for building user interfaces.
)}
)
}
```
### Collapsible
Use the `collapsible` prop to allow the user to collapse all panels.
```tsx
import { Accordion } from '@ark-ui/solid/accordion'
import { ChevronDownIcon } from 'lucide-solid'
import { Index } from 'solid-js'
export const Collapsible = () => {
return (
{(item) => (
What is {item()}?
{item()} is a JavaScript library for building user interfaces.
)}
)
}
```
### Multiple Panels
Use the `multiple` prop to allow multiple panels to be expanded simultaneously.
```tsx
import { Accordion } from '@ark-ui/solid/accordion'
import { ChevronDownIcon } from 'lucide-solid'
import { Index } from 'solid-js'
export const Multiple = () => {
return (
{(item) => (
What is {item()}?
{item()} is a JavaScript library for building user interfaces.
)}
)
}
```
### Horizontal Orientation
By default, the Accordion is oriented vertically. Use the `orientation` prop to switch to a horizontal layout.
```tsx
import { Accordion } from '@ark-ui/solid/accordion'
import { ChevronDownIcon } from 'lucide-solid'
import { Index } from 'solid-js'
export const Horizontal = () => {
return (
{(item) => (
What is {item()}?
{item()} is a JavaScript library for building user interfaces.
)}
)
}
```
### Animate Content Size
Use the `--height` and/or `--width` CSS variables to animate the size of the content when it expands or closes:
```css
@keyframes slideDown {
from {
opacity: 0.01;
height: 0;
}
to {
opacity: 1;
height: var(--height);
}
}
@keyframes slideUp {
from {
opacity: 1;
height: var(--height);
}
to {
opacity: 0.01;
height: 0;
}
}
[data-scope='accordion'][data-part='item-content'][data-state='open'] {
animation: slideDown 250ms ease-in-out;
}
[data-scope='accordion'][data-part='item-content'][data-state='closed'] {
animation: slideUp 200ms ease-in-out;
}
```
### Using the Root Provider
The `RootProvider` component provides a context for the accordion. It accepts the value of the `useAccordion` hook. You
can leverage it to access the component state and methods from outside the accordion.
```tsx
import { Accordion, type UseAccordionProps, useAccordion } from '@ark-ui/solid/accordion'
import { ChevronDownIcon } from 'lucide-solid'
import { Index, createMemo, createSignal } from 'solid-js'
export const RootProvider = () => {
const [value, setValue] = createSignal(['React'])
const accordionProps = createMemo(() => ({
multiple: true,
value: value(),
onValueChange: (e) => setValue(e.value),
}))
const accordion = useAccordion(accordionProps)
return (
<>
{(item) => (
What is {item()}?
{item()} is a JavaScript library for building user interfaces.
)}
>
)
}
```
> If you're using the `RootProvider` component, you don't need to use the `Root` component.
### Accessing the focused item
Use the `focusedValue` property to get the value of the focused accordion item.
```tsx
import { Accordion } from '@ark-ui/solid/accordion'
import { ChevronDownIcon } from 'lucide-solid'
import { Index } from 'solid-js'
export const ContextFocusedValue = () => {
return (
{(accordion) => Focused item: {accordion().focusedValue}}
{(item) => (
What is {item()}?
{item()} is a JavaScript library for building user interfaces.
)}
)
}
```
### Accessing the selected items
Use the `value` property to get the selected accordion items.
```tsx
import { Accordion } from '@ark-ui/solid/accordion'
import { ChevronDownIcon } from 'lucide-solid'
import { Index } from 'solid-js'
export const ContextValue = () => {
return (
{(context) => Selected items: {context().value.join(', ')}}
{(item) => (
What is {item()}?
{item()} is a JavaScript library for building user interfaces.
)}
)
}
```
### Setting the selected items
Use the `setValue` method to set the selected accordion items.
```tsx
import { Accordion } from '@ark-ui/solid/accordion'
import { ChevronDownIcon } from 'lucide-solid'
import { Index } from 'solid-js'
export const ContextSetValue = () => {
return (
{(context) => }
{(item) => (
What is {item()}?
{item()} is a JavaScript library for building user interfaces.
)}
)
}
```
### Accessing an item's state
Use the `getItemState` method to get the state of an accordion item.
```tsx
import { Accordion } from '@ark-ui/solid/accordion'
import { ChevronDownIcon } from 'lucide-solid'
import { Index, createMemo } from 'solid-js'
export const ContextGetItemState = () => {
const items = [{ value: 'React' }, { value: 'Solid', disabled: true }, { value: 'Vue' }]
return (
{(accordion) => {
const itemState = createMemo(() => accordion().getItemState(items[2]))
return (
<>
Vue State: Disabled: {itemState().disabled ? 'Y' : 'N'} Expanded: {itemState().expanded ? 'Y' : 'N'} Focused: {itemState().focused ? 'Y' : 'N'}
>
)
}}
{(item) => (
What is {item().value}?
{item().value} is a JavaScript library for building user interfaces.
)}
)
}
```
## API Reference
### Root
#### Props
**`asChild`**
Type: `(props: ParentProps<'div'>) => Element`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
**`collapsible`**
Type: `boolean`
Required: false
Default Value: `false`
Description: Whether an accordion item can be closed after it has been expanded.
**`defaultValue`**
Type: `string[]`
Required: false
Default Value: `undefined`
Description: The initial value of the expanded accordion items.
Use when you don't need to control the value of the accordion.
**`disabled`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Whether the accordion items are disabled
**`ids`**
Type: `Partial<{
root: string
item(value: string): string
itemContent(value: string): string
itemTrigger(value: string): string
}>`
Required: false
Default Value: `undefined`
Description: The ids of the elements in the accordion. Useful for composition.
**`lazyMount`**
Type: `boolean`
Required: false
Default Value: `false`
Description: Whether to enable lazy mounting
**`multiple`**
Type: `boolean`
Required: false
Default Value: `false`
Description: Whether multiple accordion items can be expanded at the same time.
**`onFocusChange`**
Type: `(details: FocusChangeDetails) => void`
Required: false
Default Value: `undefined`
Description: The callback fired when the focused accordion item changes.
**`onValueChange`**
Type: `(details: ValueChangeDetails) => void`
Required: false
Default Value: `undefined`
Description: The callback fired when the state of expanded/collapsed accordion items changes.
**`orientation`**
Type: `'horizontal' | 'vertical'`
Required: false
Default Value: `"vertical"`
Description: The orientation of the accordion items.
**`unmountOnExit`**
Type: `boolean`
Required: false
Default Value: `false`
Description: Whether to unmount on exit.
**`value`**
Type: `string[]`
Required: false
Default Value: `undefined`
Description: The controlled value of the expanded accordion items.
#### Data Attributes
**`data-scope`**: accordion
**`data-part`**: root
**`data-orientation`**: The orientation of the accordion
### ItemContent
#### Props
**`asChild`**
Type: `(props: ParentProps<'div'>) => Element`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
#### Data Attributes
**`data-scope`**: accordion
**`data-part`**: item-content
**`data-state`**: "open" | "closed"
**`data-disabled`**: Present when disabled
**`data-focus`**: Present when focused
**`data-orientation`**: The orientation of the item
### ItemIndicator
#### Props
**`asChild`**
Type: `(props: ParentProps<'div'>) => Element`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
#### Data Attributes
**`data-scope`**: accordion
**`data-part`**: item-indicator
**`data-state`**: "open" | "closed"
**`data-disabled`**: Present when disabled
**`data-focus`**: Present when focused
**`data-orientation`**: The orientation of the item
### Item
#### Props
**`value`**
Type: `string`
Required: true
Default Value: `undefined`
Description: The value of the accordion item.
**`asChild`**
Type: `(props: ParentProps<'div'>) => Element`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
**`disabled`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Whether the accordion item is disabled.
#### Data Attributes
**`data-scope`**: accordion
**`data-part`**: item
**`data-state`**: "open" | "closed"
**`data-focus`**: Present when focused
**`data-disabled`**: Present when disabled
**`data-orientation`**: The orientation of the item
### ItemTrigger
#### Props
**`asChild`**
Type: `(props: ParentProps<'button'>) => Element`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
#### Data Attributes
**`data-scope`**: accordion
**`data-part`**: item-trigger
**`data-orientation`**: The orientation of the item
**`data-state`**: "open" | "closed"
### RootProvider
#### Props
**`value`**
Type: `UseAccordionReturn`
Required: true
Default Value: `undefined`
Description: undefined
**`asChild`**
Type: `(props: ParentProps<'div'>) => Element`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
**`lazyMount`**
Type: `boolean`
Required: false
Default Value: `false`
Description: Whether to enable lazy mounting
**`unmountOnExit`**
Type: `boolean`
Required: false
Default Value: `false`
Description: Whether to unmount on exit.
## Accessibility
This component complies with the
[Accordion WAI-ARIA design pattern](https://www.w3.org/WAI/ARIA/apg/patterns/accordion/).
### Keyboard Support
**`Space`**
Description: When focus is on an trigger of a collapsed item, the item is expanded
**`Enter`**
Description: When focus is on an trigger of a collapsed section, expands the section.
**`Tab`**
Description: Moves focus to the next focusable element
**`Shift + Tab`**
Description: Moves focus to the previous focusable element
**`ArrowDown`**
Description: Moves focus to the next trigger
**`ArrowUp`**
Description: Moves focus to the previous trigger.
**`Home`**
Description: When focus is on an trigger, moves focus to the first trigger.
**`End`**
Description: When focus is on an trigger, moves focus to the last trigger.
# Accordion (VUE)
## Features
- Full keyboard navigation
- Supports horizontal and vertical orientation
- Right-to-Left (RTL) support
- Single or multiple item expansion
- Controlled and uncontrolled modes
- Collapse each accordion item
## Anatomy
To set up the accordion correctly, it's essential to understand its anatomy and the naming of its parts.
> Each part includes a `data-part` attribute to help identify them in the DOM.
## Examples
### Default Expanded State
Set the `defaultValue` prop to specify which item should be expanded by default.
```vue
What is {{ item }}?
{{ item }} is a JavaScript library for building user interfaces.
```
### Collapsible
Use the `collapsible` prop to allow the user to collapse all panels.
```vue
What is {{ item }}?
{{ item }} is a JavaScript library for building user interfaces.
```
### Multiple Panels
Use the `multiple` prop to allow multiple panels to be expanded simultaneously.
```vue
What is {{ item }}?
{{ item }} is a JavaScript library for building user interfaces.
```
### Horizontal Orientation
By default, the Accordion is oriented vertically. Use the `orientation` prop to switch to a horizontal layout.
```vue
What is {{ item }}?
{{ item }} is a JavaScript library for building user interfaces.
```
### Animate Content Size
Use the `--height` and/or `--width` CSS variables to animate the size of the content when it expands or closes:
```css
@keyframes slideDown {
from {
opacity: 0.01;
height: 0;
}
to {
opacity: 1;
height: var(--height);
}
}
@keyframes slideUp {
from {
opacity: 1;
height: var(--height);
}
to {
opacity: 0.01;
height: 0;
}
}
[data-scope='accordion'][data-part='item-content'][data-state='open'] {
animation: slideDown 250ms ease-in-out;
}
[data-scope='accordion'][data-part='item-content'][data-state='closed'] {
animation: slideUp 200ms ease-in-out;
}
```
### Using the Root Provider
The `RootProvider` component provides a context for the accordion. It accepts the value of the `useAccordion` hook. You
can leverage it to access the component state and methods from outside the accordion.
```vue
What is {{ item }}?
{{ item }} is a JavaScript library for building user interfaces.
```
> If you're using the `RootProvider` component, you don't need to use the `Root` component.
### Accessing the focused item
Use the `focusedValue` property to get the value of the focused accordion item.
```vue
Focused item: {{ context.focusedValue }}
What is {{ item }}?
{{ item }} is a JavaScript library for building user interfaces.
```
### Accessing the selected items
Use the `value` property to get the selected accordion items.
```vue
Selected items: {{ context.value.join(', ') }}
What is {{ item }}?
{{ item }} is a JavaScript library for building user interfaces.
```
### Setting the selected items
Use the `setValue` method to set the selected accordion items.
```vue
What is {{ item }}?
{{ item }} is a JavaScript library for building user interfaces.
```
### Accessing an item's state
Use the `getItemState` method to get the state of an accordion item.
```vue
Vue State:Disabled: {{ context.getItemState(items[2]).disabled ? 'Y' : 'N' }}Expanded: {{ context.getItemState(items[2]).expanded ? 'Y' : 'N' }}Focused: {{ context.getItemState(items[2]).focused ? 'Y' : 'N' }}
What is {{ item }}?
{{ item }} is a JavaScript library for building user interfaces.
```
## API Reference
### Root
#### Props
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
**`collapsible`**
Type: `boolean`
Required: false
Default Value: `false`
Description: Whether an accordion item can be closed after it has been expanded.
**`defaultValue`**
Type: `string[]`
Required: false
Default Value: `undefined`
Description: The initial value of the expanded accordion items.
Use when you don't need to control the value of the accordion.
**`disabled`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Whether the accordion items are disabled
**`id`**
Type: `string`
Required: false
Default Value: `undefined`
Description: The unique identifier of the machine.
**`ids`**
Type: `Partial<{
root: string
item(value: string): string
itemContent(value: string): string
itemTrigger(value: string): string
}>`
Required: false
Default Value: `undefined`
Description: The ids of the elements in the accordion. Useful for composition.
**`lazyMount`**
Type: `boolean`
Required: false
Default Value: `false`
Description: Whether to enable lazy mounting
**`modelValue`**
Type: `string[]`
Required: false
Default Value: `undefined`
Description: The v-model value of the accordion
**`multiple`**
Type: `boolean`
Required: false
Default Value: `false`
Description: Whether multiple accordion items can be expanded at the same time.
**`orientation`**
Type: `'horizontal' | 'vertical'`
Required: false
Default Value: `"vertical"`
Description: The orientation of the accordion items.
**`unmountOnExit`**
Type: `boolean`
Required: false
Default Value: `false`
Description: Whether to unmount on exit.
#### Emits
**`focusChange`**
Type: `[details: FocusChangeDetails]`
Description: The callback fired when the focused accordion item changes.
**`update:modelValue`**
Type: `[value: string[]]`
Description: The callback fired when the model value changes.
**`valueChange`**
Type: `[details: ValueChangeDetails]`
Description: The callback fired when the state of expanded/collapsed accordion items changes.
#### Data Attributes
**`data-scope`**: accordion
**`data-part`**: root
**`data-orientation`**: The orientation of the accordion
### ItemContent
#### Props
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
#### Data Attributes
**`data-scope`**: accordion
**`data-part`**: item-content
**`data-state`**: "open" | "closed"
**`data-disabled`**: Present when disabled
**`data-focus`**: Present when focused
**`data-orientation`**: The orientation of the item
### ItemIndicator
#### Props
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
#### Data Attributes
**`data-scope`**: accordion
**`data-part`**: item-indicator
**`data-state`**: "open" | "closed"
**`data-disabled`**: Present when disabled
**`data-focus`**: Present when focused
**`data-orientation`**: The orientation of the item
### Item
#### Props
**`value`**
Type: `string`
Required: true
Default Value: `undefined`
Description: The value of the accordion item.
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
**`disabled`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Whether the accordion item is disabled.
#### Data Attributes
**`data-scope`**: accordion
**`data-part`**: item
**`data-state`**: "open" | "closed"
**`data-focus`**: Present when focused
**`data-disabled`**: Present when disabled
**`data-orientation`**: The orientation of the item
### ItemTrigger
#### Props
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
#### Data Attributes
**`data-scope`**: accordion
**`data-part`**: item-trigger
**`data-orientation`**: The orientation of the item
**`data-state`**: "open" | "closed"
### RootProvider
#### Props
**`value`**
Type: `AccordionApi`
Required: true
Default Value: `undefined`
Description: undefined
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
**`lazyMount`**
Type: `boolean`
Required: false
Default Value: `false`
Description: Whether to enable lazy mounting
**`unmountOnExit`**
Type: `boolean`
Required: false
Default Value: `false`
Description: Whether to unmount on exit.
## Accessibility
This component complies with the
[Accordion WAI-ARIA design pattern](https://www.w3.org/WAI/ARIA/apg/patterns/accordion/).
### Keyboard Support
**`Space`**
Description: When focus is on an trigger of a collapsed item, the item is expanded
**`Enter`**
Description: When focus is on an trigger of a collapsed section, expands the section.
**`Tab`**
Description: Moves focus to the next focusable element
**`Shift + Tab`**
Description: Moves focus to the previous focusable element
**`ArrowDown`**
Description: Moves focus to the next trigger
**`ArrowUp`**
Description: Moves focus to the previous trigger.
**`Home`**
Description: When focus is on an trigger, moves focus to the first trigger.
**`End`**
Description: When focus is on an trigger, moves focus to the last trigger.
# Avatar (REACT)
## Anatomy
To set up the avatar correctly, you'll need to understand its anatomy and how we name its parts.
> Each part includes a `data-part` attribute to help identify them in the DOM.
## Examples
Learn how to use the `Avatar` component in your project. Let's take a look at the most basic example:
```tsx
import { Avatar } from '@ark-ui/react/avatar'
export const Basic = () => (
PA
)
```
### Handling Events
`Avatar` allows you to listen for loading state changes.
```tsx
import { Avatar } from '@ark-ui/react/avatar'
export const Events = () => {
const handleStatusChange = (details: Avatar.StatusChangeDetails) => {
console.log(details.status)
}
return (
PA
)
}
```
### Using the Root Provider
The `RootProvider` component provides a context for the avatar. It accepts the value of the `useAvatar` hook. You can
leverage it to access the component state and methods from outside the avatar.
```tsx
import { Avatar, useAvatar } from '@ark-ui/react/avatar'
export const RootProvider = () => {
const avatar = useAvatar()
return (
<>
PA
>
)
}
```
> If you're using the `RootProvider` component, you don't need to use the `Root` component.
### Next.js Image
Here's an example of how to use the `Image` component from `next/image`.
```tsx
import { Avatar, useAvatarContext } from '@ark-ui/react/avatar'
import Image, { ImageProps } from 'next/image'
const AvatarNextImage = (props: ImageProps) => {
const avatar = useAvatarContext()
const { hidden, ...imageProps } = avatar.getImageProps() as ImageProps
return (
)
}
const Demo = () => {
return (
JD
)
}
```
> Refer to this [Github Discussion](https://github.com/chakra-ui/ark/discussions/3147) for more information.
## API Reference
### Root
#### Props
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
**`ids`**
Type: `Partial<{ root: string; image: string; fallback: string }>`
Required: false
Default Value: `undefined`
Description: The ids of the elements in the avatar. Useful for composition.
**`onStatusChange`**
Type: `(details: StatusChangeDetails) => void`
Required: false
Default Value: `undefined`
Description: Functional called when the image loading status changes.
### Fallback
#### Props
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
#### Data Attributes
**`data-scope`**: avatar
**`data-part`**: fallback
**`data-state`**: "hidden" | "visible"
### Image
#### Props
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
#### Data Attributes
**`data-scope`**: avatar
**`data-part`**: image
**`data-state`**: "visible" | "hidden"
### RootProvider
#### Props
**`value`**
Type: `UseAvatarReturn`
Required: true
Default Value: `undefined`
Description: undefined
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
# Avatar (SOLID)
## Anatomy
To set up the avatar correctly, you'll need to understand its anatomy and how we name its parts.
> Each part includes a `data-part` attribute to help identify them in the DOM.
## Examples
Learn how to use the `Avatar` component in your project. Let's take a look at the most basic example:
```tsx
import { Avatar } from '@ark-ui/solid/avatar'
export const Basic = () => (
PA
)
```
### Handling Events
`Avatar` allows you to listen for loading state changes.
```tsx
import { Avatar } from '@ark-ui/solid/avatar'
export const Events = () => {
const handleStatusChange = (details: Avatar.StatusChangeDetails) => {
console.log(details.status)
}
return (
PA
)
}
```
### Using the Root Provider
The `RootProvider` component provides a context for the avatar. It accepts the value of the `useAvatar` hook. You can
leverage it to access the component state and methods from outside the avatar.
```tsx
import { Avatar, useAvatar } from '@ark-ui/solid/avatar'
export const RootProvider = () => {
const avatar = useAvatar()
return (
<>
PA
>
)
}
```
> If you're using the `RootProvider` component, you don't need to use the `Root` component.
### Next.js Image
Here's an example of how to use the `Image` component from `next/image`.
```tsx
import { Avatar, useAvatarContext } from '@ark-ui/react/avatar'
import Image, { ImageProps } from 'next/image'
const AvatarNextImage = (props: ImageProps) => {
const avatar = useAvatarContext()
const { hidden, ...imageProps } = avatar.getImageProps() as ImageProps
return (
)
}
const Demo = () => {
return (
JD
)
}
```
> Refer to this [Github Discussion](https://github.com/chakra-ui/ark/discussions/3147) for more information.
## API Reference
### Root
#### Props
**`asChild`**
Type: `(props: ParentProps<'div'>) => Element`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
**`ids`**
Type: `Partial<{ root: string; image: string; fallback: string }>`
Required: false
Default Value: `undefined`
Description: The ids of the elements in the avatar. Useful for composition.
**`onStatusChange`**
Type: `(details: StatusChangeDetails) => void`
Required: false
Default Value: `undefined`
Description: Functional called when the image loading status changes.
### Fallback
#### Props
**`asChild`**
Type: `(props: ParentProps<'span'>) => Element`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
#### Data Attributes
**`data-scope`**: avatar
**`data-part`**: fallback
**`data-state`**: "hidden" | "visible"
### Image
#### Props
**`asChild`**
Type: `(props: ParentProps<'img'>) => Element`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
#### Data Attributes
**`data-scope`**: avatar
**`data-part`**: image
**`data-state`**: "visible" | "hidden"
### RootProvider
#### Props
**`value`**
Type: `UseAvatarReturn`
Required: true
Default Value: `undefined`
Description: undefined
**`asChild`**
Type: `(props: ParentProps<'div'>) => Element`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
# Avatar (VUE)
## Anatomy
To set up the avatar correctly, you'll need to understand its anatomy and how we name its parts.
> Each part includes a `data-part` attribute to help identify them in the DOM.
## Examples
Learn how to use the `Avatar` component in your project. Let's take a look at the most basic example:
```vue
PA
```
### Handling Events
`Avatar` allows you to listen for loading state changes.
```vue
console.log(e.status)">
PA
```
### Using the Root Provider
The `RootProvider` component provides a context for the avatar. It accepts the value of the `useAvatar` hook. You can
leverage it to access the component state and methods from outside the avatar.
```vue
PA
```
> If you're using the `RootProvider` component, you don't need to use the `Root` component.
### Next.js Image
Here's an example of how to use the `Image` component from `next/image`.
```tsx
import { Avatar, useAvatarContext } from '@ark-ui/react/avatar'
import Image, { ImageProps } from 'next/image'
const AvatarNextImage = (props: ImageProps) => {
const avatar = useAvatarContext()
const { hidden, ...imageProps } = avatar.getImageProps() as ImageProps
return (
)
}
const Demo = () => {
return (
JD
)
}
```
> Refer to this [Github Discussion](https://github.com/chakra-ui/ark/discussions/3147) for more information.
## API Reference
### Root
#### Props
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
**`id`**
Type: `string`
Required: false
Default Value: `undefined`
Description: The unique identifier of the machine.
**`ids`**
Type: `Partial<{ root: string; image: string; fallback: string }>`
Required: false
Default Value: `undefined`
Description: The ids of the elements in the avatar. Useful for composition.
#### Emits
**`statusChange`**
Type: `[details: StatusChangeDetails]`
Description: Functional called when the image loading status changes.
### Fallback
#### Props
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
#### Data Attributes
**`data-scope`**: avatar
**`data-part`**: fallback
**`data-state`**: "hidden" | "visible"
### Image
#### Props
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
#### Data Attributes
**`data-scope`**: avatar
**`data-part`**: image
**`data-state`**: "visible" | "hidden"
### RootProvider
#### Props
**`value`**
Type: `AvatarApi`
Required: true
Default Value: `undefined`
Description: undefined
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
# Carousel (REACT)
## Features
- Native CSS Scroll Snap integration for smooth, performant animations
- Flexible orientation support (horizontal and vertical layouts)
- Customizable slide alignment (start, center, or end positions)
- Multi-slide display capabilities for complex layouts
- Automatic playback with configurable looping behavior
- Adjustable slide spacing and gap controls
## Anatomy
To set up the carousel correctly, you'll need to understand its anatomy and how we name its parts.
> Each part includes a `data-part` attribute to help identify them in the DOM.
## Examples
Learn how to use the `Carousel` component in your project. Let's take a look at the most basic example:
```tsx
import { Carousel } from '@ark-ui/react/carousel'
export const Basic = () => {
const images = Array.from({ length: 5 }, (_, i) => `https://picsum.photos/seed/${i + 1}/500/300`)
return (
PreviousNext
{images.map((_, index) => (
))}
{images.map((image, index) => (
))}
)
}
```
### Controlled Carousel
To create a controlled Carousel component, you can manage the state of the carousel using the `index` prop and update it
when the `onIndexChange` event handler is called:
```tsx
import { Carousel } from '@ark-ui/react/carousel'
import { useState } from 'react'
const images = Array.from({ length: 5 }, (_, i) => `https://picsum.photos/seed/${i + 1}/500/300`)
export const Controlled = () => {
const [page, setPage] = useState(0)
return (
setPage(e.page)}>
PreviousNext
{images.map((_, index) => (
))}
{images.map((image, index) => (
))}
)
}
```
### Autoplay
The Carousel can play automatically. Just add the `autoplay` prop. You'll probably want to add `loop` too, so it keeps
going after the last slide.
```tsx
import { Carousel } from '@ark-ui/react/carousel'
const images = Array.from({ length: 5 }, (_, i) => `https://picsum.photos/seed/${i + 1}/500/300`)
export const Autoplay = () => {
return (
{({ isPlaying }) => (isPlaying ? 'Pause' : 'Play')}
{images.map((_, index) => (
))}
{images.map((image, index) => (
))}
)
}
```
### Using the Root Provider
The `RootProvider` sets up carousel context using the `useCarousel` hook, enabling external access to its state and
methods.
```tsx
import { Carousel, useCarousel } from '@ark-ui/react/carousel'
const images = Array.from({ length: 5 }, (_, i) => `https://picsum.photos/seed/${i + 1}/500/300`)
export const RootProvider = () => {
const carousel = useCarousel({ slideCount: images.length })
return (
<>
PreviousNext
{images.map((_, index) => (
))}
{images.map((image, index) => (
))}
>
)
}
```
> If you're using the `RootProvider` component, you don't need to use the `Root` component.
## API Reference
### Root
#### Props
**`slideCount`**
Type: `number`
Required: true
Default Value: `undefined`
Description: The total number of slides.
Useful for SSR to render the initial ating the snap points.
**`allowMouseDrag`**
Type: `boolean`
Required: false
Default Value: `false`
Description: Whether to allow scrolling via dragging with mouse
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
**`autoplay`**
Type: `boolean | { delay: number }`
Required: false
Default Value: `false`
Description: Whether to scroll automatically. The default delay is 4000ms.
**`defaultPage`**
Type: `number`
Required: false
Default Value: `0`
Description: The initial page to scroll to when rendered.
Use when you don't need to control the page of the carousel.
**`ids`**
Type: `Partial<{
root: string
item(index: number): string
itemGroup: string
nextTrigger: string
prevTrigger: string
indicatorGroup: string
indicator(index: number): string
}>`
Required: false
Default Value: `undefined`
Description: The ids of the elements in the carousel. Useful for composition.
**`inViewThreshold`**
Type: `number | number[]`
Required: false
Default Value: `0.6`
Description: The threshold for determining if an item is in view.
**`loop`**
Type: `boolean`
Required: false
Default Value: `false`
Description: Whether the carousel should loop around.
**`onAutoplayStatusChange`**
Type: `(details: AutoplayStatusDetails) => void`
Required: false
Default Value: `undefined`
Description: Function called when the autoplay status changes.
**`onDragStatusChange`**
Type: `(details: DragStatusDetails) => void`
Required: false
Default Value: `undefined`
Description: Function called when the drag status changes.
**`onPageChange`**
Type: `(details: PageChangeDetails) => void`
Required: false
Default Value: `undefined`
Description: Function called when the page changes.
**`orientation`**
Type: `'horizontal' | 'vertical'`
Required: false
Default Value: `"horizontal"`
Description: The orientation of the element.
**`padding`**
Type: `string`
Required: false
Default Value: `undefined`
Description: Defines the extra space added around the scrollable area,
enabling nearby items to remain partially in view.
**`page`**
Type: `number`
Required: false
Default Value: `undefined`
Description: The controlled page of the carousel.
**`slidesPerMove`**
Type: `number | 'auto'`
Required: false
Default Value: `"auto"`
Description: The number of slides to scroll at a time.
When set to `auto`, the number of slides to scroll is determined by the
`slidesPerPage` property.
**`slidesPerPage`**
Type: `number`
Required: false
Default Value: `1`
Description: The number of slides to show at a time.
**`snapType`**
Type: `'proximity' | 'mandatory'`
Required: false
Default Value: `"mandatory"`
Description: The snap type of the item.
**`spacing`**
Type: `string`
Required: false
Default Value: `"0px"`
Description: The amount of space between items.
**`translations`**
Type: `IntlTranslations`
Required: false
Default Value: `undefined`
Description: The localized messages to use.
#### Data Attributes
**`data-scope`**: carousel
**`data-part`**: root
**`data-orientation`**: The orientation of the carousel
### AutoplayTrigger
#### Props
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
#### Data Attributes
**`data-scope`**: carousel
**`data-part`**: autoplay-trigger
**`data-orientation`**: The orientation of the autoplaytrigger
**`data-pressed`**: Present when pressed
### Control
#### Props
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
#### Data Attributes
**`data-scope`**: carousel
**`data-part`**: control
**`data-orientation`**: The orientation of the control
### IndicatorGroup
#### Props
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
#### Data Attributes
**`data-scope`**: carousel
**`data-part`**: indicator-group
**`data-orientation`**: The orientation of the indicatorgroup
### Indicator
#### Props
**`index`**
Type: `number`
Required: true
Default Value: `undefined`
Description: The index of the indicator.
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
**`readOnly`**
Type: `boolean`
Required: false
Default Value: `false`
Description: Whether the indicator is read only.
#### Data Attributes
**`data-scope`**: carousel
**`data-part`**: indicator
**`data-orientation`**: The orientation of the indicator
**`data-index`**: The index of the item
**`data-readonly`**: Present when read-only
**`data-current`**: Present when current
### ItemGroup
#### Props
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
#### Data Attributes
**`data-scope`**: carousel
**`data-part`**: item-group
**`data-orientation`**: The orientation of the item
**`data-dragging`**: Present when in the dragging state
### Item
#### Props
**`index`**
Type: `number`
Required: true
Default Value: `undefined`
Description: The index of the item.
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
**`snapAlign`**
Type: `'center' | 'end' | 'start'`
Required: false
Default Value: `"start"`
Description: The snap alignment of the item.
#### Data Attributes
**`data-scope`**: carousel
**`data-part`**: item
**`data-index`**: The index of the item
**`data-inview`**: Present when in viewport
**`data-orientation`**: The orientation of the item
### NextTrigger
#### Props
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
#### Data Attributes
**`data-scope`**: carousel
**`data-part`**: next-trigger
**`data-orientation`**: The orientation of the nexttrigger
### PrevTrigger
#### Props
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
#### Data Attributes
**`data-scope`**: carousel
**`data-part`**: prev-trigger
**`data-orientation`**: The orientation of the prevtrigger
### RootProvider
#### Props
**`value`**
Type: `UseCarouselReturn`
Required: true
Default Value: `undefined`
Description: undefined
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
## Accessibility
Complies with the [Carousel WAI-ARIA design pattern](https://www.w3.org/WAI/ARIA/apg/patterns/carousel/).
# Carousel (SOLID)
## Features
- Native CSS Scroll Snap integration for smooth, performant animations
- Flexible orientation support (horizontal and vertical layouts)
- Customizable slide alignment (start, center, or end positions)
- Multi-slide display capabilities for complex layouts
- Automatic playback with configurable looping behavior
- Adjustable slide spacing and gap controls
## Anatomy
To set up the carousel correctly, you'll need to understand its anatomy and how we name its parts.
> Each part includes a `data-part` attribute to help identify them in the DOM.
## Examples
Learn how to use the `Carousel` component in your project. Let's take a look at the most basic example:
```tsx
import { Carousel } from '@ark-ui/solid/carousel'
import { Index } from 'solid-js'
const images = Array.from({ length: 5 }, (_, i) => `https://picsum.photos/seed/${i + 1}/500/300`)
export const Basic = () => {
return (
PreviousNext{(_, index) => }
{(image, index) => (
)}
)
}
```
### Controlled Carousel
To create a controlled Carousel component, you can manage the state of the carousel using the `index` prop and update it
when the `onIndexChange` event handler is called:
```tsx
import { Carousel } from '@ark-ui/solid/carousel'
import { Index, createSignal } from 'solid-js'
const images = Array.from({ length: 5 }, (_, i) => `https://picsum.photos/seed/${i + 1}/500/300`)
export const Controlled = () => {
const [page, setPage] = createSignal(0)
return (
<>
setPage(details.page)}>
PreviousNext{(_, index) => }
{(image, index) => (
)}
>
)
}
```
### Autoplay
The Carousel can play automatically. Just add the `autoplay` prop. You'll probably want to add `loop` too, so it keeps
going after the last slide.
```tsx
import { Carousel } from '@ark-ui/solid/carousel'
import { Index } from 'solid-js'
const images = Array.from({ length: 5 }, (_, i) => `https://picsum.photos/seed/${i + 1}/500/300`)
export const Autoplay = () => {
return (
{(carousel) => (carousel().isPlaying ? 'Pause' : 'Play')}{(_, index) => }
{(image, index) => (
)}
)
}
```
### Using the Root Provider
The `RootProvider` sets up carousel context using the `useCarousel` hook, enabling external access to its state and
methods.
```tsx
import { Carousel, useCarousel } from '@ark-ui/solid/carousel'
import { Index } from 'solid-js'
const images = Array.from({ length: 5 }, (_, i) => `https://picsum.photos/seed/${i + 1}/500/300`)
export const RootProvider = () => {
const carousel = useCarousel({ slideCount: images.length })
return (
<>
PreviousNext{(_, index) => }
{(image, index) => (
)}
>
)
}
```
> If you're using the `RootProvider` component, you don't need to use the `Root` component.
## API Reference
### Root
#### Props
**`slideCount`**
Type: `number`
Required: true
Default Value: `undefined`
Description: The total number of slides.
Useful for SSR to render the initial ating the snap points.
**`allowMouseDrag`**
Type: `boolean`
Required: false
Default Value: `false`
Description: Whether to allow scrolling via dragging with mouse
**`asChild`**
Type: `(props: ParentProps<'div'>) => Element`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
**`autoplay`**
Type: `boolean | { delay: number }`
Required: false
Default Value: `false`
Description: Whether to scroll automatically. The default delay is 4000ms.
**`defaultPage`**
Type: `number`
Required: false
Default Value: `0`
Description: The initial page to scroll to when rendered.
Use when you don't need to control the page of the carousel.
**`ids`**
Type: `Partial<{
root: string
item(index: number): string
itemGroup: string
nextTrigger: string
prevTrigger: string
indicatorGroup: string
indicator(index: number): string
}>`
Required: false
Default Value: `undefined`
Description: The ids of the elements in the carousel. Useful for composition.
**`inViewThreshold`**
Type: `number | number[]`
Required: false
Default Value: `0.6`
Description: The threshold for determining if an item is in view.
**`loop`**
Type: `boolean`
Required: false
Default Value: `false`
Description: Whether the carousel should loop around.
**`onAutoplayStatusChange`**
Type: `(details: AutoplayStatusDetails) => void`
Required: false
Default Value: `undefined`
Description: Function called when the autoplay status changes.
**`onDragStatusChange`**
Type: `(details: DragStatusDetails) => void`
Required: false
Default Value: `undefined`
Description: Function called when the drag status changes.
**`onPageChange`**
Type: `(details: PageChangeDetails) => void`
Required: false
Default Value: `undefined`
Description: Function called when the page changes.
**`orientation`**
Type: `'horizontal' | 'vertical'`
Required: false
Default Value: `"horizontal"`
Description: The orientation of the element.
**`padding`**
Type: `string`
Required: false
Default Value: `undefined`
Description: Defines the extra space added around the scrollable area,
enabling nearby items to remain partially in view.
**`page`**
Type: `number`
Required: false
Default Value: `undefined`
Description: The controlled page of the carousel.
**`slidesPerMove`**
Type: `number | 'auto'`
Required: false
Default Value: `"auto"`
Description: The number of slides to scroll at a time.
When set to `auto`, the number of slides to scroll is determined by the
`slidesPerPage` property.
**`slidesPerPage`**
Type: `number`
Required: false
Default Value: `1`
Description: The number of slides to show at a time.
**`snapType`**
Type: `'proximity' | 'mandatory'`
Required: false
Default Value: `"mandatory"`
Description: The snap type of the item.
**`spacing`**
Type: `string`
Required: false
Default Value: `"0px"`
Description: The amount of space between items.
**`translations`**
Type: `IntlTranslations`
Required: false
Default Value: `undefined`
Description: The localized messages to use.
#### Data Attributes
**`data-scope`**: carousel
**`data-part`**: root
**`data-orientation`**: The orientation of the carousel
### AutoplayTrigger
#### Props
**`asChild`**
Type: `(props: ParentProps<'button'>) => Element`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
#### Data Attributes
**`data-scope`**: carousel
**`data-part`**: autoplay-trigger
**`data-orientation`**: The orientation of the autoplaytrigger
**`data-pressed`**: Present when pressed
### Control
#### Props
**`asChild`**
Type: `(props: ParentProps<'div'>) => Element`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
#### Data Attributes
**`data-scope`**: carousel
**`data-part`**: control
**`data-orientation`**: The orientation of the control
### IndicatorGroup
#### Props
**`asChild`**
Type: `(props: ParentProps<'div'>) => Element`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
#### Data Attributes
**`data-scope`**: carousel
**`data-part`**: indicator-group
**`data-orientation`**: The orientation of the indicatorgroup
### Indicator
#### Props
**`index`**
Type: `number`
Required: true
Default Value: `undefined`
Description: The index of the indicator.
**`asChild`**
Type: `(props: ParentProps<'button'>) => Element`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
**`readOnly`**
Type: `boolean`
Required: false
Default Value: `false`
Description: Whether the indicator is read only.
#### Data Attributes
**`data-scope`**: carousel
**`data-part`**: indicator
**`data-orientation`**: The orientation of the indicator
**`data-index`**: The index of the item
**`data-readonly`**: Present when read-only
**`data-current`**: Present when current
### ItemGroup
#### Props
**`asChild`**
Type: `(props: ParentProps<'div'>) => Element`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
#### Data Attributes
**`data-scope`**: carousel
**`data-part`**: item-group
**`data-orientation`**: The orientation of the item
**`data-dragging`**: Present when in the dragging state
### Item
#### Props
**`index`**
Type: `number`
Required: true
Default Value: `undefined`
Description: The index of the item.
**`asChild`**
Type: `(props: ParentProps<'div'>) => Element`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
**`snapAlign`**
Type: `'start' | 'end' | 'center'`
Required: false
Default Value: `"start"`
Description: The snap alignment of the item.
#### Data Attributes
**`data-scope`**: carousel
**`data-part`**: item
**`data-index`**: The index of the item
**`data-inview`**: Present when in viewport
**`data-orientation`**: The orientation of the item
### NextTrigger
#### Props
**`asChild`**
Type: `(props: ParentProps<'button'>) => Element`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
#### Data Attributes
**`data-scope`**: carousel
**`data-part`**: next-trigger
**`data-orientation`**: The orientation of the nexttrigger
### PrevTrigger
#### Props
**`asChild`**
Type: `(props: ParentProps<'button'>) => Element`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
#### Data Attributes
**`data-scope`**: carousel
**`data-part`**: prev-trigger
**`data-orientation`**: The orientation of the prevtrigger
### RootProvider
#### Props
**`value`**
Type: `UseCarouselReturn`
Required: true
Default Value: `undefined`
Description: undefined
**`asChild`**
Type: `(props: ParentProps<'div'>) => Element`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
## Accessibility
Complies with the [Carousel WAI-ARIA design pattern](https://www.w3.org/WAI/ARIA/apg/patterns/carousel/).
# Carousel (VUE)
## Features
- Native CSS Scroll Snap integration for smooth, performant animations
- Flexible orientation support (horizontal and vertical layouts)
- Customizable slide alignment (start, center, or end positions)
- Multi-slide display capabilities for complex layouts
- Automatic playback with configurable looping behavior
- Adjustable slide spacing and gap controls
## Anatomy
To set up the carousel correctly, you'll need to understand its anatomy and how we name its parts.
> Each part includes a `data-part` attribute to help identify them in the DOM.
## Examples
Learn how to use the `Carousel` component in your project. Let's take a look at the most basic example:
```vue
PreviousNext
```
### Controlled Carousel
To create a controlled Carousel component, you can manage the state of the carousel using the `index` prop and update it
when the `onIndexChange` event handler is called:
```vue
PreviousNext
Current page: {{ page }}
```
### Autoplay
The Carousel can play automatically. Just add the `autoplay` prop. You'll probably want to add `loop` too, so it keeps
going after the last slide.
```vue
{{ context.isPlaying ? 'Pause' : 'Play' }}
```
### Using the Root Provider
The `RootProvider` sets up carousel context using the `useCarousel` hook, enabling external access to its state and
methods.
```vue
PreviousNext
```
> If you're using the `RootProvider` component, you don't need to use the `Root` component.
## API Reference
### Root
#### Props
**`slideCount`**
Type: `number`
Required: true
Default Value: `undefined`
Description: The total number of slides.
Useful for SSR to render the initial ating the snap points.
**`allowMouseDrag`**
Type: `boolean`
Required: false
Default Value: `false`
Description: Whether to allow scrolling via dragging with mouse
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
**`autoplay`**
Type: `boolean | { delay: number }`
Required: false
Default Value: `false`
Description: Whether to scroll automatically. The default delay is 4000ms.
**`defaultPage`**
Type: `number`
Required: false
Default Value: `0`
Description: The initial page to scroll to when rendered.
Use when you don't need to control the page of the carousel.
**`id`**
Type: `string`
Required: false
Default Value: `undefined`
Description: The unique identifier of the machine.
**`ids`**
Type: `Partial<{
root: string
item(index: number): string
itemGroup: string
nextTrigger: string
prevTrigger: string
indicatorGroup: string
indicator(index: number): string
}>`
Required: false
Default Value: `undefined`
Description: The ids of the elements in the carousel. Useful for composition.
**`inViewThreshold`**
Type: `number | number[]`
Required: false
Default Value: `0.6`
Description: The threshold for determining if an item is in view.
**`loop`**
Type: `boolean`
Required: false
Default Value: `false`
Description: Whether the carousel should loop around.
**`orientation`**
Type: `'horizontal' | 'vertical'`
Required: false
Default Value: `"horizontal"`
Description: The orientation of the element.
**`padding`**
Type: `string`
Required: false
Default Value: `undefined`
Description: Defines the extra space added around the scrollable area,
enabling nearby items to remain partially in view.
**`page`**
Type: `number`
Required: false
Default Value: `undefined`
Description: The controlled page of the carousel.
**`slidesPerMove`**
Type: `number | 'auto'`
Required: false
Default Value: `"auto"`
Description: The number of slides to scroll at a time.
When set to `auto`, the number of slides to scroll is determined by the
`slidesPerPage` property.
**`slidesPerPage`**
Type: `number`
Required: false
Default Value: `1`
Description: The number of slides to show at a time.
**`snapType`**
Type: `'proximity' | 'mandatory'`
Required: false
Default Value: `"mandatory"`
Description: The snap type of the item.
**`spacing`**
Type: `string`
Required: false
Default Value: `"0px"`
Description: The amount of space between items.
**`translations`**
Type: `IntlTranslations`
Required: false
Default Value: `undefined`
Description: The localized messages to use.
#### Emits
**`autoplayStatusChange`**
Type: `[details: AutoplayStatusDetails]`
Description: Function called when the autoplay status changes.
**`dragStatusChange`**
Type: `[details: DragStatusDetails]`
Description: Function called when the drag status changes.
**`pageChange`**
Type: `[details: PageChangeDetails]`
Description: Function called when the page changes.
**`update:page`**
Type: `[page: number]`
Description: The callback fired when the carousel page changes.
#### Data Attributes
**`data-scope`**: carousel
**`data-part`**: root
**`data-orientation`**: The orientation of the carousel
### AutoplayTrigger
#### Props
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
#### Data Attributes
**`data-scope`**: carousel
**`data-part`**: autoplay-trigger
**`data-orientation`**: The orientation of the autoplaytrigger
**`data-pressed`**: Present when pressed
### Control
#### Props
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
#### Data Attributes
**`data-scope`**: carousel
**`data-part`**: control
**`data-orientation`**: The orientation of the control
### IndicatorGroup
#### Props
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
#### Data Attributes
**`data-scope`**: carousel
**`data-part`**: indicator-group
**`data-orientation`**: The orientation of the indicatorgroup
### Indicator
#### Props
**`index`**
Type: `number`
Required: true
Default Value: `undefined`
Description: The index of the indicator.
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
**`readOnly`**
Type: `boolean`
Required: false
Default Value: `false`
Description: Whether the indicator is read only.
#### Data Attributes
**`data-scope`**: carousel
**`data-part`**: indicator
**`data-orientation`**: The orientation of the indicator
**`data-index`**: The index of the item
**`data-readonly`**: Present when read-only
**`data-current`**: Present when current
### ItemGroup
#### Props
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
#### Data Attributes
**`data-scope`**: carousel
**`data-part`**: item-group
**`data-orientation`**: The orientation of the item
**`data-dragging`**: Present when in the dragging state
### Item
#### Props
**`index`**
Type: `number`
Required: true
Default Value: `undefined`
Description: The index of the item.
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
**`snapAlign`**
Type: `'start' | 'end' | 'center'`
Required: false
Default Value: `"start"`
Description: The snap alignment of the item.
#### Data Attributes
**`data-scope`**: carousel
**`data-part`**: item
**`data-index`**: The index of the item
**`data-inview`**: Present when in viewport
**`data-orientation`**: The orientation of the item
### NextTrigger
#### Props
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
#### Data Attributes
**`data-scope`**: carousel
**`data-part`**: next-trigger
**`data-orientation`**: The orientation of the nexttrigger
### PrevTrigger
#### Props
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
#### Data Attributes
**`data-scope`**: carousel
**`data-part`**: prev-trigger
**`data-orientation`**: The orientation of the prevtrigger
### RootProvider
#### Props
**`value`**
Type: `CarouselApi`
Required: true
Default Value: `undefined`
Description: undefined
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
## Accessibility
Complies with the [Carousel WAI-ARIA design pattern](https://www.w3.org/WAI/ARIA/apg/patterns/carousel/).
# Checkbox (REACT)
## Anatomy
To set up the checkbox correctly, you'll need to understand its anatomy and how we name its parts.
> Each part includes a `data-part` attribute to help identify them in the DOM.
### Design impact on the asChild property
The `Checkbox.Root` element of the checkbox is a `label` element. This is because the checkbox is a form control and
should be associated with a label to provide context and meaning to the user. Otherwise, the HTML and accessibility
structure will be invalid.
> If you need to use the `asChild` property, make sure that the `label` element is the direct child of the
> `Checkbox.Root` component.
## Examples
Learn how to use the `Checkbox` component in your project. Let's take a look at the most basic example:
```tsx
import { Checkbox } from '@ark-ui/react/checkbox'
import { CheckIcon } from 'lucide-react'
export const Basic = () => (
Checkbox
)
```
### Controlled Checkbox
To create a controlled Checkbox component, manage the state of the checked status using the `checked` prop and update it
when the `onCheckedChange` event handler is called:
```tsx
import { Checkbox } from '@ark-ui/react/checkbox'
import { CheckIcon } from 'lucide-react'
import { useState } from 'react'
export const Controlled = () => {
const [checked, setChecked] = useState(true)
return (
setChecked(e.checked)}>
Checkbox
)
}
```
### Indeterminate Checkbox
In some cases, you may need a checkbox to represent a state that is neither checked nor unchecked, known as the
indeterminate state. This can be achieved by setting the `checked` prop to `indeterminate`:
```tsx
import { Checkbox } from '@ark-ui/react/checkbox'
import { CheckIcon, MinusIcon } from 'lucide-react'
export const Indeterminate = () => (
Checkbox
)
```
### Checkbox Group
Ark provides a `Checkbox.Group` component to manage a group of checkboxes. The `Checkbox.Group` component manages the
state of the checkboxes and provides a way to access the checked values:
```tsx
import { Checkbox } from '@ark-ui/react/checkbox'
import { CheckIcon } from 'lucide-react'
const items = [
{ label: 'React', value: 'react' },
{ label: 'Solid', value: 'solid' },
{ label: 'Vue', value: 'vue' },
]
export const Group = () => (
{items.map((item) => (
{item.label}
))}
)
```
### Render Prop Usage
For cases where you need more flexibility in rendering, the Checkbox component offers the use of a render prop. The
render prop function gives you access to the checkbox's API, allowing you to customize the checkbox control's rendering:
```tsx
import { Checkbox } from '@ark-ui/react/checkbox'
import { CheckIcon } from 'lucide-react'
export const RenderProp = () => (
{(checkbox) => Checkbox {checkbox.checked.toString()}}
)
```
### Using the Field Component
The `Field` component helps manage form-related state and accessibility attributes of a checkbox. It includes handling
ARIA labels, helper text, and error text to ensure proper accessibility.
```tsx
import { Checkbox } from '@ark-ui/react/checkbox'
import { Field } from '@ark-ui/react/field'
import { CheckIcon, MinusIcon } from 'lucide-react'
export const WithField = (props: Field.RootProps) => (
LabelAdditional InfoError Info
)
```
### Using the Root Provider
The `RootProvider` component provides a context for the checkbox. It accepts the value of the `useCheckbox` hook. You
can leverage it to access the component state and methods from outside the checkbox.
```tsx
import { Checkbox, useCheckbox } from '@ark-ui/react/checkbox'
import { CheckIcon } from 'lucide-react'
export const RootProvider = () => {
const checkbox = useCheckbox()
return (
<>
{checkbox.checked ? 'Checked' : 'UnChecked'}Checkbox
>
)
}
```
> If you're using the `RootProvider` component, you don't need to use the `Root` component.
## API Reference
### Root
#### Props
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
**`checked`**
Type: `CheckedState`
Required: false
Default Value: `undefined`
Description: The controlled checked state of the checkbox
**`defaultChecked`**
Type: `CheckedState`
Required: false
Default Value: `undefined`
Description: The initial checked state of the checkbox when rendered.
Use when you don't need to control the checked state of the checkbox.
**`disabled`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Whether the checkbox is disabled
**`form`**
Type: `string`
Required: false
Default Value: `undefined`
Description: The id of the form that the checkbox belongs to.
**`id`**
Type: `string`
Required: false
Default Value: `undefined`
Description: The unique identifier of the machine.
**`ids`**
Type: `Partial<{ root: string; hiddenInput: string; control: string; label: string }>`
Required: false
Default Value: `undefined`
Description: The ids of the elements in the checkbox. Useful for composition.
**`invalid`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Whether the checkbox is invalid
**`name`**
Type: `string`
Required: false
Default Value: `undefined`
Description: The name of the input field in a checkbox.
Useful for form submission.
**`onCheckedChange`**
Type: `(details: CheckedChangeDetails) => void`
Required: false
Default Value: `undefined`
Description: The callback invoked when the checked state changes.
**`readOnly`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Whether the checkbox is read-only
**`required`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Whether the checkbox is required
**`value`**
Type: `string`
Required: false
Default Value: `"on"`
Description: The value of checkbox input. Useful for form submission.
#### Data Attributes
**`data-active`**: Present when active or pressed
**`data-focus`**: Present when focused
**`data-focus-visible`**: Present when focused with keyboard
**`data-readonly`**: Present when read-only
**`data-hover`**: Present when hovered
**`data-disabled`**: Present when disabled
**`data-state`**: "indeterminate" | "checked" | "unchecked"
**`data-invalid`**: Present when invalid
### Control
#### Props
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
#### Data Attributes
**`data-active`**: Present when active or pressed
**`data-focus`**: Present when focused
**`data-focus-visible`**: Present when focused with keyboard
**`data-readonly`**: Present when read-only
**`data-hover`**: Present when hovered
**`data-disabled`**: Present when disabled
**`data-state`**: "indeterminate" | "checked" | "unchecked"
**`data-invalid`**: Present when invalid
### Group
#### Props
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
**`defaultValue`**
Type: `string[]`
Required: false
Default Value: `undefined`
Description: The initial value of `value` when uncontrolled
**`disabled`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: If `true`, the checkbox group is disabled
**`invalid`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: If `true`, the checkbox group is invalid
**`name`**
Type: `string`
Required: false
Default Value: `undefined`
Description: The name of the input fields in the checkbox group
(Useful for form submission).
**`onValueChange`**
Type: `(value: string[]) => void`
Required: false
Default Value: `undefined`
Description: The callback to call when the value changes
**`readOnly`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: If `true`, the checkbox group is read-only
**`value`**
Type: `string[]`
Required: false
Default Value: `undefined`
Description: The controlled value of the checkbox group
### HiddenInput
#### Props
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
### Indicator
#### Props
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
**`indeterminate`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: undefined
#### Data Attributes
**`data-active`**: Present when active or pressed
**`data-focus`**: Present when focused
**`data-focus-visible`**: Present when focused with keyboard
**`data-readonly`**: Present when read-only
**`data-hover`**: Present when hovered
**`data-disabled`**: Present when disabled
**`data-state`**: "indeterminate" | "checked" | "unchecked"
**`data-invalid`**: Present when invalid
### Label
#### Props
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
#### Data Attributes
**`data-active`**: Present when active or pressed
**`data-focus`**: Present when focused
**`data-focus-visible`**: Present when focused with keyboard
**`data-readonly`**: Present when read-only
**`data-hover`**: Present when hovered
**`data-disabled`**: Present when disabled
**`data-state`**: "indeterminate" | "checked" | "unchecked"
**`data-invalid`**: Present when invalid
### RootProvider
#### Props
**`value`**
Type: `UseCheckboxReturn`
Required: true
Default Value: `undefined`
Description: undefined
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
## Accessibility
Complies with the [Checkbox WAI-ARIA design pattern](https://www.w3.org/WAI/ARIA/apg/patterns/checkbox/).
### Keyboard Support
**`Space`**
Description: Toggle the checkbox
# Checkbox (SOLID)
## Anatomy
To set up the checkbox correctly, you'll need to understand its anatomy and how we name its parts.
> Each part includes a `data-part` attribute to help identify them in the DOM.
### Design impact on the asChild property
The `Checkbox.Root` element of the checkbox is a `label` element. This is because the checkbox is a form control and
should be associated with a label to provide context and meaning to the user. Otherwise, the HTML and accessibility
structure will be invalid.
> If you need to use the `asChild` property, make sure that the `label` element is the direct child of the
> `Checkbox.Root` component.
## Examples
Learn how to use the `Checkbox` component in your project. Let's take a look at the most basic example:
```tsx
import { Checkbox } from '@ark-ui/solid/checkbox'
import { CheckIcon } from 'lucide-solid'
export const Basic = () => (
Checkbox
)
```
### Controlled Checkbox
To create a controlled Checkbox component, manage the state of the checked status using the `checked` prop and update it
when the `onCheckedChange` event handler is called:
```tsx
import { Checkbox } from '@ark-ui/solid/checkbox'
import { CheckIcon } from 'lucide-solid'
import { createSignal } from 'solid-js'
export const Controlled = () => {
const [checked, setChecked] = createSignal(true)
return (
setChecked(e.checked)}>
Checkbox
)
}
```
### Indeterminate Checkbox
In some cases, you may need a checkbox to represent a state that is neither checked nor unchecked, known as the
indeterminate state. This can be achieved by setting the `checked` prop to `indeterminate`:
```tsx
import { Checkbox } from '@ark-ui/solid/checkbox'
import { CheckIcon, MinusIcon } from 'lucide-solid'
export const Indeterminate = () => (
Checkbox
)
```
### Checkbox Group
Ark provides a `Checkbox.Group` component to manage a group of checkboxes. The `Checkbox.Group` component manages the
state of the checkboxes and provides a way to access the checked values:
```tsx
import { Checkbox } from '@ark-ui/solid/checkbox'
import { CheckIcon } from 'lucide-solid'
import { For } from 'solid-js'
const items = [
{ label: 'React', value: 'react' },
{ label: 'Solid', value: 'solid' },
{ label: 'Vue', value: 'vue' },
]
export const Group = () => (
{(item) => (
{item.label}
)}
)
```
### Render Prop Usage
For cases where you need more flexibility in rendering, the Checkbox component offers the use of a render prop. The
render prop function gives you access to the checkbox's API, allowing you to customize the checkbox control's rendering:
```tsx
import { Checkbox } from '@ark-ui/solid/checkbox'
import { CheckIcon } from 'lucide-solid'
export const RenderProp = () => (
{(checkbox) => Checkbox {checkbox().checked.toString()}}
)
```
### Using the Field Component
The `Field` component helps manage form-related state and accessibility attributes of a checkbox. It includes handling
ARIA labels, helper text, and error text to ensure proper accessibility.
```tsx
import { Checkbox } from '@ark-ui/solid/checkbox'
import { Field } from '@ark-ui/solid/field'
import { CheckIcon, MinusIcon } from 'lucide-solid'
export const WithField = (props: Field.RootProps) => (
LabelAdditional InfoError Info
)
```
### Using the Root Provider
The `RootProvider` component provides a context for the checkbox. It accepts the value of the `useCheckbox` hook. You
can leverage it to access the component state and methods from outside the checkbox.
```tsx
import { Checkbox, useCheckbox } from '@ark-ui/solid/checkbox'
import { CheckIcon } from 'lucide-solid'
export const RootProvider = () => {
const checkbox = useCheckbox()
return (
<>
{checkbox().checked ? 'Checked' : 'UnChecked'}Checkbox
>
)
}
```
> If you're using the `RootProvider` component, you don't need to use the `Root` component.
## API Reference
### Root
#### Props
**`asChild`**
Type: `(props: ParentProps<'label'>) => Element`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
**`checked`**
Type: `CheckedState`
Required: false
Default Value: `undefined`
Description: The controlled checked state of the checkbox
**`defaultChecked`**
Type: `CheckedState`
Required: false
Default Value: `undefined`
Description: The initial checked state of the checkbox when rendered.
Use when you don't need to control the checked state of the checkbox.
**`disabled`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Whether the checkbox is disabled
**`ids`**
Type: `Partial<{ root: string; hiddenInput: string; control: string; label: string }>`
Required: false
Default Value: `undefined`
Description: The ids of the elements in the checkbox. Useful for composition.
**`invalid`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Whether the checkbox is invalid
**`name`**
Type: `string`
Required: false
Default Value: `undefined`
Description: The name of the input field in a checkbox.
Useful for form submission.
**`onCheckedChange`**
Type: `(details: CheckedChangeDetails) => void`
Required: false
Default Value: `undefined`
Description: The callback invoked when the checked state changes.
**`readOnly`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Whether the checkbox is read-only
**`required`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Whether the checkbox is required
**`value`**
Type: `string`
Required: false
Default Value: `"on"`
Description: The value of checkbox input. Useful for form submission.
#### Data Attributes
**`data-active`**: Present when active or pressed
**`data-focus`**: Present when focused
**`data-focus-visible`**: Present when focused with keyboard
**`data-readonly`**: Present when read-only
**`data-hover`**: Present when hovered
**`data-disabled`**: Present when disabled
**`data-state`**: "indeterminate" | "checked" | "unchecked"
**`data-invalid`**: Present when invalid
### Control
#### Props
**`asChild`**
Type: `(props: ParentProps<'div'>) => Element`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
#### Data Attributes
**`data-active`**: Present when active or pressed
**`data-focus`**: Present when focused
**`data-focus-visible`**: Present when focused with keyboard
**`data-readonly`**: Present when read-only
**`data-hover`**: Present when hovered
**`data-disabled`**: Present when disabled
**`data-state`**: "indeterminate" | "checked" | "unchecked"
**`data-invalid`**: Present when invalid
### Group
#### Props
**`asChild`**
Type: `(props: ParentProps<'div'>) => Element`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
**`defaultValue`**
Type: `string[] | Accessor`
Required: false
Default Value: `undefined`
Description: The initial value of `value` when uncontrolled
**`disabled`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: If `true`, the checkbox group is disabled
**`invalid`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: If `true`, the checkbox group is invalid
**`name`**
Type: `string`
Required: false
Default Value: `undefined`
Description: The name of the input fields in the checkbox group
(Useful for form submission).
**`onValueChange`**
Type: `(value: string[]) => void`
Required: false
Default Value: `undefined`
Description: The callback to call when the value changes
**`readOnly`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: If `true`, the checkbox group is read-only
**`value`**
Type: `Accessor`
Required: false
Default Value: `undefined`
Description: The controlled value of the checkbox group
### HiddenInput
#### Props
**`asChild`**
Type: `(props: ParentProps<'input'>) => Element`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
### Indicator
#### Props
**`asChild`**
Type: `(props: ParentProps<'div'>) => Element`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
**`indeterminate`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: undefined
#### Data Attributes
**`data-active`**: Present when active or pressed
**`data-focus`**: Present when focused
**`data-focus-visible`**: Present when focused with keyboard
**`data-readonly`**: Present when read-only
**`data-hover`**: Present when hovered
**`data-disabled`**: Present when disabled
**`data-state`**: "indeterminate" | "checked" | "unchecked"
**`data-invalid`**: Present when invalid
### Label
#### Props
**`asChild`**
Type: `(props: ParentProps<'span'>) => Element`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
#### Data Attributes
**`data-active`**: Present when active or pressed
**`data-focus`**: Present when focused
**`data-focus-visible`**: Present when focused with keyboard
**`data-readonly`**: Present when read-only
**`data-hover`**: Present when hovered
**`data-disabled`**: Present when disabled
**`data-state`**: "indeterminate" | "checked" | "unchecked"
**`data-invalid`**: Present when invalid
### RootProvider
#### Props
**`value`**
Type: `UseCheckboxReturn`
Required: true
Default Value: `undefined`
Description: undefined
**`asChild`**
Type: `(props: ParentProps<'label'>) => Element`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
## Accessibility
Complies with the [Checkbox WAI-ARIA design pattern](https://www.w3.org/WAI/ARIA/apg/patterns/checkbox/).
### Keyboard Support
**`Space`**
Description: Toggle the checkbox
# Checkbox (VUE)
## Anatomy
To set up the checkbox correctly, you'll need to understand its anatomy and how we name its parts.
> Each part includes a `data-part` attribute to help identify them in the DOM.
### Design impact on the asChild property
The `Checkbox.Root` element of the checkbox is a `label` element. This is because the checkbox is a form control and
should be associated with a label to provide context and meaning to the user. Otherwise, the HTML and accessibility
structure will be invalid.
> If you need to use the `asChild` property, make sure that the `label` element is the direct child of the
> `Checkbox.Root` component.
## Examples
Learn how to use the `Checkbox` component in your project. Let's take a look at the most basic example:
```vue
Checkbox
```
### Controlled Checkbox
To create a controlled Checkbox component, manage the state of the checked status using the `checked` prop and update it
when the `onCheckedChange` event handler is called:
```vue
Checkbox
```
### Indeterminate Checkbox
In some cases, you may need a checkbox to represent a state that is neither checked nor unchecked, known as the
indeterminate state. This can be achieved by setting the `checked` prop to `indeterminate`:
```vue
Checkbox
```
### Checkbox Group
Ark provides a `Checkbox.Group` component to manage a group of checkboxes. The `Checkbox.Group` component manages the
state of the checkboxes and provides a way to access the checked values:
```vue
{{ item.label }}
```
### Render Prop Usage
For cases where you need more flexibility in rendering, the Checkbox component offers the use of a render prop. The
render prop function gives you access to the checkbox's API, allowing you to customize the checkbox control's rendering:
```vue
Checkbox {{ checkbox.checked.toString() }}
```
### Using the Field Component
The `Field` component helps manage form-related state and accessibility attributes of a checkbox. It includes handling
ARIA labels, helper text, and error text to ensure proper accessibility.
```vue
LabelAdditional InfoError Info
```
### Using the Root Provider
The `RootProvider` component provides a context for the checkbox. It accepts the value of the `useCheckbox` hook. You
can leverage it to access the component state and methods from outside the checkbox.
```vue
{{ checkbox.checked ? 'Checked' : 'UnChecked' }}Checkbox
```
> If you're using the `RootProvider` component, you don't need to use the `Root` component.
## API Reference
### Root
#### Props
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
**`checked`**
Type: `CheckedState`
Required: false
Default Value: `undefined`
Description: The controlled checked state of the checkbox
**`defaultChecked`**
Type: `CheckedState`
Required: false
Default Value: `undefined`
Description: The initial checked state of the checkbox when rendered.
Use when you don't need to control the checked state of the checkbox.
**`disabled`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Whether the checkbox is disabled
**`form`**
Type: `string`
Required: false
Default Value: `undefined`
Description: The id of the form that the checkbox belongs to.
**`id`**
Type: `string`
Required: false
Default Value: `undefined`
Description: The unique identifier of the machine.
**`ids`**
Type: `Partial<{ root: string; hiddenInput: string; control: string; label: string }>`
Required: false
Default Value: `undefined`
Description: The ids of the elements in the checkbox. Useful for composition.
**`invalid`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Whether the checkbox is invalid
**`name`**
Type: `string`
Required: false
Default Value: `undefined`
Description: The name of the input field in a checkbox.
Useful for form submission.
**`readOnly`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Whether the checkbox is read-only
**`required`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Whether the checkbox is required
**`value`**
Type: `string`
Required: false
Default Value: `"on"`
Description: The value of checkbox input. Useful for form submission.
#### Emits
**`checkedChange`**
Type: `[details: CheckedChangeDetails]`
Description: The callback invoked when the checked state changes.
**`update:checked`**
Type: `[checked: CheckedState]`
Description: The callback invoked when the checked state changes.
#### Data Attributes
**`data-active`**: Present when active or pressed
**`data-focus`**: Present when focused
**`data-focus-visible`**: Present when focused with keyboard
**`data-readonly`**: Present when read-only
**`data-hover`**: Present when hovered
**`data-disabled`**: Present when disabled
**`data-state`**: "indeterminate" | "checked" | "unchecked"
**`data-invalid`**: Present when invalid
### Control
#### Props
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
#### Data Attributes
**`data-active`**: Present when active or pressed
**`data-focus`**: Present when focused
**`data-focus-visible`**: Present when focused with keyboard
**`data-readonly`**: Present when read-only
**`data-hover`**: Present when hovered
**`data-disabled`**: Present when disabled
**`data-state`**: "indeterminate" | "checked" | "unchecked"
**`data-invalid`**: Present when invalid
### Group
#### Props
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
**`defaultValue`**
Type: `string[]`
Required: false
Default Value: `undefined`
Description: The initial value of `value` when uncontrolled
**`disabled`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: If `true`, the checkbox group is disabled
**`invalid`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: If `true`, the checkbox group is invalid
**`modelValue`**
Type: `string[]`
Required: false
Default Value: `undefined`
Description: The controlled value of the checkbox group
**`name`**
Type: `string`
Required: false
Default Value: `undefined`
Description: The name of the input fields in the checkbox group
(Useful for form submission).
**`readOnly`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: If `true`, the checkbox group is read-only
### HiddenInput
#### Props
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
### Indicator
#### Props
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
**`indeterminate`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: undefined
#### Data Attributes
**`data-active`**: Present when active or pressed
**`data-focus`**: Present when focused
**`data-focus-visible`**: Present when focused with keyboard
**`data-readonly`**: Present when read-only
**`data-hover`**: Present when hovered
**`data-disabled`**: Present when disabled
**`data-state`**: "indeterminate" | "checked" | "unchecked"
**`data-invalid`**: Present when invalid
### Label
#### Props
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
#### Data Attributes
**`data-active`**: Present when active or pressed
**`data-focus`**: Present when focused
**`data-focus-visible`**: Present when focused with keyboard
**`data-readonly`**: Present when read-only
**`data-hover`**: Present when hovered
**`data-disabled`**: Present when disabled
**`data-state`**: "indeterminate" | "checked" | "unchecked"
**`data-invalid`**: Present when invalid
### RootProvider
#### Props
**`value`**
Type: `CheckboxApi`
Required: true
Default Value: `undefined`
Description: undefined
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
## Accessibility
Complies with the [Checkbox WAI-ARIA design pattern](https://www.w3.org/WAI/ARIA/apg/patterns/checkbox/).
### Keyboard Support
**`Space`**
Description: Toggle the checkbox
# Clipboard (REACT)
## Anatomy
To set up the Clipboard correctly, you'll need to understand its anatomy and how we name its parts.
> Each part includes a `data-part` attribute to help identify them in the DOM.
## Examples
Learn how to use the `Clipboard` component in your project. Let's take a look at the most basic example:
```tsx
import { Clipboard } from '@ark-ui/react/clipboard'
import { CheckIcon, ClipboardCopyIcon } from 'lucide-react'
export const Basic = () => {
return (
Copy this link}>
)
}
```
### Using the Root Provider
The `RootProvider` component provides a context for the clipboard. It accepts the value of the `useClipboard` hook. You
can leverage it to access the component state and methods from outside the clipboard.
```tsx
import { Clipboard, useClipboard } from '@ark-ui/react/clipboard'
import { CheckIcon, ClipboardCopyIcon } from 'lucide-react'
export const RootProvider = () => {
const clipboard = useClipboard({ value: 'https://ark-ui.com' })
return (
<>
Copy this link}>
>
)
}
```
> If you're using the `RootProvider` component, you don't need to use the `Root` component.
## API Reference
### Root
#### Props
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
**`defaultValue`**
Type: `string`
Required: false
Default Value: `undefined`
Description: The initial value to be copied to the clipboard when rendered.
Use when you don't need to control the value of the clipboard.
**`id`**
Type: `string`
Required: false
Default Value: `undefined`
Description: The unique identifier of the machine.
**`ids`**
Type: `Partial<{ root: string; input: string; label: string }>`
Required: false
Default Value: `undefined`
Description: The ids of the elements in the clipboard. Useful for composition.
**`onStatusChange`**
Type: `(details: CopyStatusDetails) => void`
Required: false
Default Value: `undefined`
Description: The function to be called when the value is copied to the clipboard
**`onValueChange`**
Type: `(details: ValueChangeDetails) => void`
Required: false
Default Value: `undefined`
Description: The function to be called when the value changes
**`timeout`**
Type: `number`
Required: false
Default Value: `3000`
Description: The timeout for the copy operation
**`value`**
Type: `string`
Required: false
Default Value: `undefined`
Description: The controlled value of the clipboard
#### Data Attributes
**`data-scope`**: clipboard
**`data-part`**: root
**`data-copied`**: Present when copied state is true
### Control
#### Props
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
#### Data Attributes
**`data-scope`**: clipboard
**`data-part`**: control
**`data-copied`**: Present when copied state is true
### Indicator
#### Props
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
**`copied`**
Type: `string | number | bigint | boolean | ReactElement> | Iterable | ReactPortal | Promise<...>`
Required: false
Default Value: `undefined`
Description: undefined
### Input
#### Props
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
#### Data Attributes
**`data-scope`**: clipboard
**`data-part`**: input
**`data-copied`**: Present when copied state is true
**`data-readonly`**: Present when read-only
### Label
#### Props
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
#### Data Attributes
**`data-scope`**: clipboard
**`data-part`**: label
**`data-copied`**: Present when copied state is true
### RootProvider
#### Props
**`value`**
Type: `UseClipboardReturn`
Required: true
Default Value: `undefined`
Description: undefined
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
### Trigger
#### Props
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
#### Data Attributes
**`data-scope`**: clipboard
**`data-part`**: trigger
**`data-copied`**: Present when copied state is true
### ValueText
#### Props
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
# Clipboard (SOLID)
## Anatomy
To set up the Clipboard correctly, you'll need to understand its anatomy and how we name its parts.
> Each part includes a `data-part` attribute to help identify them in the DOM.
## Examples
Learn how to use the `Clipboard` component in your project. Let's take a look at the most basic example:
```tsx
import { Clipboard } from '@ark-ui/solid/clipboard'
import { CheckIcon, ClipboardCopyIcon } from 'lucide-solid'
export const Basic = () => {
return (
Copy this link}>
)
}
```
### Using the Root Provider
The `RootProvider` component provides a context for the clipboard. It accepts the value of the `useClipboard` hook. You
can leverage it to access the component state and methods from outside the clipboard.
```tsx
import { Clipboard, useClipboard } from '@ark-ui/solid/clipboard'
import { CheckIcon, ClipboardCopyIcon } from 'lucide-solid'
export const RootProvider = () => {
const clipboard = useClipboard({ value: 'https://ark-ui.com' })
return (
<>
Copy this link}>
>
)
}
```
> If you're using the `RootProvider` component, you don't need to use the `Root` component.
## API Reference
### Root
#### Props
**`asChild`**
Type: `(props: ParentProps<'div'>) => Element`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
**`defaultValue`**
Type: `string`
Required: false
Default Value: `undefined`
Description: The initial value to be copied to the clipboard when rendered.
Use when you don't need to control the value of the clipboard.
**`ids`**
Type: `Partial<{ root: string; input: string; label: string }>`
Required: false
Default Value: `undefined`
Description: The ids of the elements in the clipboard. Useful for composition.
**`onStatusChange`**
Type: `(details: CopyStatusDetails) => void`
Required: false
Default Value: `undefined`
Description: The function to be called when the value is copied to the clipboard
**`onValueChange`**
Type: `(details: ValueChangeDetails) => void`
Required: false
Default Value: `undefined`
Description: The function to be called when the value changes
**`timeout`**
Type: `number`
Required: false
Default Value: `3000`
Description: The timeout for the copy operation
**`value`**
Type: `string`
Required: false
Default Value: `undefined`
Description: The controlled value of the clipboard
#### Data Attributes
**`data-scope`**: clipboard
**`data-part`**: root
**`data-copied`**: Present when copied state is true
### Control
#### Props
**`asChild`**
Type: `(props: ParentProps<'div'>) => Element`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
#### Data Attributes
**`data-scope`**: clipboard
**`data-part`**: control
**`data-copied`**: Present when copied state is true
### Indicator
#### Props
**`asChild`**
Type: `(props: ParentProps<'div'>) => Element`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
**`copied`**
Type: `number | boolean | Node | ArrayElement | (string & {})`
Required: false
Default Value: `undefined`
Description: undefined
### Input
#### Props
**`asChild`**
Type: `(props: ParentProps<'input'>) => Element`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
#### Data Attributes
**`data-scope`**: clipboard
**`data-part`**: input
**`data-copied`**: Present when copied state is true
**`data-readonly`**: Present when read-only
### Label
#### Props
**`asChild`**
Type: `(props: ParentProps<'label'>) => Element`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
#### Data Attributes
**`data-scope`**: clipboard
**`data-part`**: label
**`data-copied`**: Present when copied state is true
### RootProvider
#### Props
**`value`**
Type: `UseClipboardReturn`
Required: true
Default Value: `undefined`
Description: undefined
**`asChild`**
Type: `(props: ParentProps<'div'>) => Element`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
### Trigger
#### Props
**`asChild`**
Type: `(props: ParentProps<'button'>) => Element`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
#### Data Attributes
**`data-scope`**: clipboard
**`data-part`**: trigger
**`data-copied`**: Present when copied state is true
### ValueText
#### Props
**`asChild`**
Type: `(props: ParentProps<'span'>) => Element`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
# Clipboard (VUE)
## Anatomy
To set up the Clipboard correctly, you'll need to understand its anatomy and how we name its parts.
> Each part includes a `data-part` attribute to help identify them in the DOM.
## Examples
Learn how to use the `Clipboard` component in your project. Let's take a look at the most basic example:
```vue
Copy this link
```
### Using the Root Provider
The `RootProvider` component provides a context for the clipboard. It accepts the value of the `useClipboard` hook. You
can leverage it to access the component state and methods from outside the clipboard.
```vue
Copy this link
```
> If you're using the `RootProvider` component, you don't need to use the `Root` component.
## API Reference
### Root
#### Props
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
**`defaultValue`**
Type: `string`
Required: false
Default Value: `undefined`
Description: The initial value to be copied to the clipboard when rendered.
Use when you don't need to control the value of the clipboard.
**`id`**
Type: `string`
Required: false
Default Value: `undefined`
Description: The unique identifier of the machine.
**`ids`**
Type: `Partial<{ root: string; input: string; label: string }>`
Required: false
Default Value: `undefined`
Description: The ids of the elements in the clipboard. Useful for composition.
**`modelValue`**
Type: `string`
Required: false
Default Value: `undefined`
Description: The v-model value of the clipboard
**`timeout`**
Type: `number`
Required: false
Default Value: `3000`
Description: The timeout for the copy operation
#### Emits
**`statusChange`**
Type: `[details: CopyStatusDetails]`
Description: The function to be called when the value is copied to the clipboard
**`update:modelValue`**
Type: `[value: string]`
Description: The callback fired when the model value changes.
**`valueChange`**
Type: `[details: ValueChangeDetails]`
Description: The function to be called when the value changes
#### Data Attributes
**`data-scope`**: clipboard
**`data-part`**: root
**`data-copied`**: Present when copied state is true
### Control
#### Props
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
#### Data Attributes
**`data-scope`**: clipboard
**`data-part`**: control
**`data-copied`**: Present when copied state is true
### Indicator
#### Props
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
### Input
#### Props
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
#### Data Attributes
**`data-scope`**: clipboard
**`data-part`**: input
**`data-copied`**: Present when copied state is true
**`data-readonly`**: Present when read-only
### Label
#### Props
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
#### Data Attributes
**`data-scope`**: clipboard
**`data-part`**: label
**`data-copied`**: Present when copied state is true
### RootProvider
#### Props
**`value`**
Type: `ClipboardApi`
Required: true
Default Value: `undefined`
Description: undefined
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
### Trigger
#### Props
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
#### Data Attributes
**`data-scope`**: clipboard
**`data-part`**: trigger
**`data-copied`**: Present when copied state is true
### ValueText
#### Props
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
# Collapsible (REACT)
## Animation
You can use CSS animations to create smooth transitions for opening and closing the Collapsible content. Utilize the
`data-state` attribute in combination with the `--height` CSS variable to animate the open and closed states.
```css
@keyframes slideDown {
from {
height: 0;
}
to {
height: var(--height);
}
}
@keyframes slideUp {
from {
height: var(--height);
}
to {
height: 0;
}
}
[data-scope='collapsible'][data-part='content'][data-state='open'] {
animation: slideDown 250ms;
}
[data-scope='collapsible'][data-part='content'][data-state='closed'] {
animation: slideUp 200ms;
}
```
## Examples
Learn how to use the `Collapsible` component in your project. Let's examine the most basic example:
```tsx
import { Collapsible } from '@ark-ui/react/collapsible'
export const Basic = () => (
ToggleContent
)
```
### Events
You can listen for the `onExitComplete` event to know when the `Collapsible.Content` is no longer visible:
```tsx
import { Collapsible } from '@ark-ui/react/collapsible'
export const OnExitComplete = () => (
alert('on exit')}>
ToggleContent
)
```
### Lazy Mount
To delay the mounting of the `Collapsible.Content`, use the `lazyMount` prop:
```tsx
import { Collapsible } from '@ark-ui/react/collapsible'
export const LazyMount = () => (
ToggleContent
)
```
### Unmount on Exit
To remove the `Collapsible.Content` from the DOM when it is not visible, use the `unmountOnExit` prop:
```tsx
import { Collapsible } from '@ark-ui/react/collapsible'
export const UnmountOnExit = () => (
ToggleContent
)
```
### Combining Lazy Mount and Unmount on Exit
Both `lazyMount` and `unmountOnExit` can be combined to ensure that the component is mounted only when the `Collapsible`
is expanded and unmounted when it is collapsed:
```tsx
import { Collapsible } from '@ark-ui/react/collapsible'
export const LazyMountAndUnmountOnExit = () => (
ToggleContent
)
```
### Using the Root Provider
The `RootProvider` component provides a context for the collapsible. It accepts the value of the `useCollapsible` hook.
You can leverage it to access the component state and methods from outside the collapsible.
```tsx
import { Collapsible, useCollapsible } from '@ark-ui/react/collapsible'
export const RootProvider = () => {
const collapsible = useCollapsible()
return (
<>
{collapsible.visible ? 'Visible' : 'Hidden'}ToggleContent
>
)
}
```
> If you're using the `RootProvider` component, you don't need to use the `Root` component.
## API Reference
### Root
#### Props
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
**`defaultOpen`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: The initial open state of the collapsible when rendered.
Use when you don't need to control the open state of the collapsible.
**`disabled`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Whether the collapsible is disabled.
**`ids`**
Type: `Partial<{ root: string; content: string; trigger: string }>`
Required: false
Default Value: `undefined`
Description: The ids of the elements in the collapsible. Useful for composition.
**`lazyMount`**
Type: `boolean`
Required: false
Default Value: `false`
Description: Whether to enable lazy mounting
**`onExitComplete`**
Type: `VoidFunction`
Required: false
Default Value: `undefined`
Description: The callback invoked when the exit animation completes.
**`onOpenChange`**
Type: `(details: OpenChangeDetails) => void`
Required: false
Default Value: `undefined`
Description: The callback invoked when the open state changes.
**`open`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: The controlled open state of the collapsible.
**`unmountOnExit`**
Type: `boolean`
Required: false
Default Value: `false`
Description: Whether to unmount on exit.
#### Data Attributes
**`data-scope`**: collapsible
**`data-part`**: root
**`data-state`**: "open" | "closed"
### Content
#### Props
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
#### Data Attributes
**`data-scope`**: collapsible
**`data-part`**: content
**`data-collapsible`**:
**`data-state`**: "open" | "closed"
**`data-disabled`**: Present when disabled
### RootProvider
#### Props
**`value`**
Type: `UseCollapsibleReturn`
Required: true
Default Value: `undefined`
Description: undefined
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
### Trigger
#### Props
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
#### Data Attributes
**`data-scope`**: collapsible
**`data-part`**: trigger
**`data-state`**: "open" | "closed"
**`data-disabled`**: Present when disabled
## Accessibility
### Keyboard Support
**`Space`**
Description: Opens/closes the collapsible.
**`Enter`**
Description: Opens/closes the collapsible.
# Collapsible (SOLID)
## Animation
You can use CSS animations to create smooth transitions for opening and closing the Collapsible content. Utilize the
`data-state` attribute in combination with the `--height` CSS variable to animate the open and closed states.
```css
@keyframes slideDown {
from {
height: 0;
}
to {
height: var(--height);
}
}
@keyframes slideUp {
from {
height: var(--height);
}
to {
height: 0;
}
}
[data-scope='collapsible'][data-part='content'][data-state='open'] {
animation: slideDown 250ms;
}
[data-scope='collapsible'][data-part='content'][data-state='closed'] {
animation: slideUp 200ms;
}
```
## Examples
Learn how to use the `Collapsible` component in your project. Let's examine the most basic example:
```tsx
import { Collapsible } from '@ark-ui/solid/collapsible'
export const Basic = () => (
ToggleContent
)
```
### Events
You can listen for the `onExitComplete` event to know when the `Collapsible.Content` is no longer visible:
```tsx
import { Collapsible } from '@ark-ui/solid/collapsible'
export const OnExitComplete = () => (
alert('on exit')}>
ToggleContent
)
```
### Lazy Mount
To delay the mounting of the `Collapsible.Content`, use the `lazyMount` prop:
```tsx
import { Collapsible } from '@ark-ui/solid/collapsible'
export const LazyMount = () => (
ToggleContent
)
```
### Unmount on Exit
To remove the `Collapsible.Content` from the DOM when it is not visible, use the `unmountOnExit` prop:
```tsx
import { Collapsible } from '@ark-ui/solid/collapsible'
export const UnmountOnExit = () => (
ToggleContent
)
```
### Combining Lazy Mount and Unmount on Exit
Both `lazyMount` and `unmountOnExit` can be combined to ensure that the component is mounted only when the `Collapsible`
is expanded and unmounted when it is collapsed:
```tsx
import { Collapsible } from '@ark-ui/solid/collapsible'
export const LazyMountAndUnmountOnExit = () => (
ToggleContent
)
```
### Using the Root Provider
The `RootProvider` component provides a context for the collapsible. It accepts the value of the `useCollapsible` hook.
You can leverage it to access the component state and methods from outside the collapsible.
```tsx
import { Collapsible, useCollapsible } from '@ark-ui/solid/collapsible'
export const RootProvider = () => {
const collapsible = useCollapsible()
return (
<>
{collapsible().visible ? 'Visible' : 'Hidden'}ToggleContent
>
)
}
```
> If you're using the `RootProvider` component, you don't need to use the `Root` component.
## API Reference
### Root
#### Props
**`asChild`**
Type: `(props: ParentProps<'div'>) => Element`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
**`defaultOpen`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: The initial open state of the collapsible when rendered.
Use when you don't need to control the open state of the collapsible.
**`disabled`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Whether the collapsible is disabled.
**`ids`**
Type: `Partial<{ root: string; content: string; trigger: string }>`
Required: false
Default Value: `undefined`
Description: The ids of the elements in the collapsible. Useful for composition.
**`lazyMount`**
Type: `boolean`
Required: false
Default Value: `false`
Description: Whether to enable lazy mounting
**`onExitComplete`**
Type: `VoidFunction`
Required: false
Default Value: `undefined`
Description: The callback invoked when the exit animation completes.
**`onOpenChange`**
Type: `(details: OpenChangeDetails) => void`
Required: false
Default Value: `undefined`
Description: The callback invoked when the open state changes.
**`open`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: The controlled open state of the collapsible.
**`unmountOnExit`**
Type: `boolean`
Required: false
Default Value: `false`
Description: Whether to unmount on exit.
#### Data Attributes
**`data-scope`**: collapsible
**`data-part`**: root
**`data-state`**: "open" | "closed"
### Content
#### Props
**`asChild`**
Type: `(props: ParentProps<'div'>) => Element`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
#### Data Attributes
**`data-scope`**: collapsible
**`data-part`**: content
**`data-collapsible`**:
**`data-state`**: "open" | "closed"
**`data-disabled`**: Present when disabled
### RootProvider
#### Props
**`value`**
Type: `UseCollapsibleReturn`
Required: true
Default Value: `undefined`
Description: undefined
**`asChild`**
Type: `(props: ParentProps<'div'>) => Element`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
### Trigger
#### Props
**`asChild`**
Type: `(props: ParentProps<'button'>) => Element`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
#### Data Attributes
**`data-scope`**: collapsible
**`data-part`**: trigger
**`data-state`**: "open" | "closed"
**`data-disabled`**: Present when disabled
## Accessibility
### Keyboard Support
**`Space`**
Description: Opens/closes the collapsible.
**`Enter`**
Description: Opens/closes the collapsible.
# Collapsible (VUE)
## Animation
You can use CSS animations to create smooth transitions for opening and closing the Collapsible content. Utilize the
`data-state` attribute in combination with the `--height` CSS variable to animate the open and closed states.
```css
@keyframes slideDown {
from {
height: 0;
}
to {
height: var(--height);
}
}
@keyframes slideUp {
from {
height: var(--height);
}
to {
height: 0;
}
}
[data-scope='collapsible'][data-part='content'][data-state='open'] {
animation: slideDown 250ms;
}
[data-scope='collapsible'][data-part='content'][data-state='closed'] {
animation: slideUp 200ms;
}
```
## Examples
Learn how to use the `Collapsible` component in your project. Let's examine the most basic example:
```vue
ToggleContent
```
### Events
You can listen for the `onExitComplete` event to know when the `Collapsible.Content` is no longer visible:
```vue
console.log('on exit')">
ToggleContent
```
### Lazy Mount
To delay the mounting of the `Collapsible.Content`, use the `lazyMount` prop:
```vue
ToggleContent
```
### Unmount on Exit
To remove the `Collapsible.Content` from the DOM when it is not visible, use the `unmountOnExit` prop:
```vue
ToggleContent
```
### Combining Lazy Mount and Unmount on Exit
Both `lazyMount` and `unmountOnExit` can be combined to ensure that the component is mounted only when the `Collapsible`
is expanded and unmounted when it is collapsed:
```vue
ToggleContent
```
### Using the Root Provider
The `RootProvider` component provides a context for the collapsible. It accepts the value of the `useCollapsible` hook.
You can leverage it to access the component state and methods from outside the collapsible.
```vue
{{ collapsible.visible ? 'Visible' : 'Hidden' }}ToggleContent
```
> If you're using the `RootProvider` component, you don't need to use the `Root` component.
## API Reference
### Root
#### Props
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
**`defaultOpen`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: The initial open state of the collapsible when rendered.
Use when you don't need to control the open state of the collapsible.
**`disabled`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Whether the collapsible is disabled.
**`id`**
Type: `string`
Required: false
Default Value: `undefined`
Description: The unique identifier of the machine.
**`ids`**
Type: `Partial<{ root: string; content: string; trigger: string }>`
Required: false
Default Value: `undefined`
Description: The ids of the elements in the collapsible. Useful for composition.
**`lazyMount`**
Type: `boolean`
Required: false
Default Value: `false`
Description: Whether to enable lazy mounting
**`open`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: The controlled open state of the collapsible.
**`unmountOnExit`**
Type: `boolean`
Required: false
Default Value: `false`
Description: Whether to unmount on exit.
#### Emits
**`exitComplete`**
Type: `[]`
Description: The callback invoked when the exit animation completes.
**`openChange`**
Type: `[details: OpenChangeDetails]`
Description: The callback invoked when the open state changes.
**`update:open`**
Type: `[open: boolean]`
Description: Event handler called when the open state of the collapsible changes.
#### Data Attributes
**`data-scope`**: collapsible
**`data-part`**: root
**`data-state`**: "open" | "closed"
### Content
#### Props
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
#### Data Attributes
**`data-scope`**: collapsible
**`data-part`**: content
**`data-collapsible`**:
**`data-state`**: "open" | "closed"
**`data-disabled`**: Present when disabled
### RootProvider
#### Props
**`value`**
Type: `Collapsible`
Required: true
Default Value: `undefined`
Description: undefined
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
### Trigger
#### Props
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
#### Data Attributes
**`data-scope`**: collapsible
**`data-part`**: trigger
**`data-state`**: "open" | "closed"
**`data-disabled`**: Present when disabled
## Accessibility
### Keyboard Support
**`Space`**
Description: Opens/closes the collapsible.
**`Enter`**
Description: Opens/closes the collapsible.
# Color Picker (REACT)
## Anatomy
To set up the color picker correctly, you'll need to understand its anatomy and how we name its parts.
> Each part includes a `data-part` attribute to help identify them in the DOM.
## Examples
Learn how to use the `ColorPicker` component in your project. Let's take a look at the most basic example
```tsx
import { ColorPicker, parseColor } from '@ark-ui/react/color-picker'
export const Basic = () => {
return (
ColorToggle ColorFormat✓✓✓Pick color
)
}
```
### Controlled Color Picker
To create a controlled Color Picker component, manage the state of the current color using the `value` prop and update
it when the `onValueChange` or `onValueChangeEnd` event handler is called:
```tsx
import { ColorPicker, parseColor } from '@ark-ui/react/color-picker'
import { useState } from 'react'
export const Controlled = () => {
const [color, setColor] = useState(() => parseColor('hsl(20, 100%, 50%)'))
return (
setColor(e.value)}>
Color✓✓✓Pick color
)
}
```
### Using the Field Component
The `Field` component helps manage form-related state and accessibility attributes of a color picker. It includes
handling ARIA labels, helper text, and error text to ensure proper accessibility.
```tsx
import { ColorPicker, parseColor } from '@ark-ui/react/color-picker'
import { Field } from '@ark-ui/react/field'
export const WithField = (props: Field.RootProps) => (
LabelAdditional InfoError Info
)
```
### Using the Root Provider
The `RootProvider` component provides a context for the color-picker. It accepts the value of the `useColor-picker`
hook. You can leverage it to access the component state and methods from outside the color-picker.
```tsx
import { ColorPicker, parseColor, useColorPicker } from '@ark-ui/react/color-picker'
export const RootProvider = () => {
const colorPicker = useColorPicker({ defaultValue: parseColor('#eb5e41') })
return (
<>
Color: {colorPicker.valueAsString}ColorToggle ColorFormat✓✓✓Pick color
>
)
}
```
> If you're using the `RootProvider` component, you don't need to use the `Root` component.
## API Reference
### Root
#### Props
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
**`closeOnSelect`**
Type: `boolean`
Required: false
Default Value: `false`
Description: Whether to close the color picker when a swatch is selected
**`defaultFormat`**
Type: `ColorFormat`
Required: false
Default Value: `"rgba"`
Description: The initial color format when rendered.
Use when you don't need to control the color format of the color picker.
**`defaultOpen`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: The initial open state of the color picker when rendered.
Use when you don't need to control the open state of the color picker.
**`defaultValue`**
Type: `Color`
Required: false
Default Value: `#000000`
Description: The initial color value when rendered.
Use when you don't need to control the color value of the color picker.
**`disabled`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Whether the color picker is disabled
**`format`**
Type: `ColorFormat`
Required: false
Default Value: `undefined`
Description: The controlled color format to use
**`id`**
Type: `string`
Required: false
Default Value: `undefined`
Description: The unique identifier of the machine.
**`ids`**
Type: `Partial<{ root: string; control: string; trigger: string; label: string; input: string; hiddenInput: string; content: string; area: string; areaGradient: string; positioner: string; formatSelect: string; areaThumb: string; channelInput(id: string): string; channelSliderTrack(id: ColorChannel): string; channelSliderT...`
Required: false
Default Value: `undefined`
Description: The ids of the elements in the color picker. Useful for composition.
**`immediate`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Whether to synchronize the present change immediately or defer it to the next frame
**`initialFocusEl`**
Type: `() => HTMLElement | null`
Required: false
Default Value: `undefined`
Description: The initial focus element when the color picker is opened.
**`invalid`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Whether the color picker is invalid
**`lazyMount`**
Type: `boolean`
Required: false
Default Value: `false`
Description: Whether to enable lazy mounting
**`name`**
Type: `string`
Required: false
Default Value: `undefined`
Description: The name for the form input
**`onExitComplete`**
Type: `VoidFunction`
Required: false
Default Value: `undefined`
Description: Function called when the animation ends in the closed state
**`onFocusOutside`**
Type: `(event: FocusOutsideEvent) => void`
Required: false
Default Value: `undefined`
Description: Function called when the focus is moved outside the component
**`onFormatChange`**
Type: `(details: FormatChangeDetails) => void`
Required: false
Default Value: `undefined`
Description: Function called when the color format changes
**`onInteractOutside`**
Type: `(event: InteractOutsideEvent) => void`
Required: false
Default Value: `undefined`
Description: Function called when an interaction happens outside the component
**`onOpenChange`**
Type: `(details: OpenChangeDetails) => void`
Required: false
Default Value: `undefined`
Description: Handler that is called when the user opens or closes the color picker.
**`onPointerDownOutside`**
Type: `(event: PointerDownOutsideEvent) => void`
Required: false
Default Value: `undefined`
Description: Function called when the pointer is pressed down outside the component
**`onValueChange`**
Type: `(details: ValueChangeDetails) => void`
Required: false
Default Value: `undefined`
Description: Handler that is called when the value changes, as the user drags.
**`onValueChangeEnd`**
Type: `(details: ValueChangeDetails) => void`
Required: false
Default Value: `undefined`
Description: Handler that is called when the user stops dragging.
**`open`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: The controlled open state of the color picker
**`openAutoFocus`**
Type: `boolean`
Required: false
Default Value: `true`
Description: Whether to auto focus the color picker when it is opened
**`positioning`**
Type: `PositioningOptions`
Required: false
Default Value: `undefined`
Description: The positioning options for the color picker
**`present`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Whether the node is present (controlled by the user)
**`readOnly`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Whether the color picker is read-only
**`required`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Whether the color picker is required
**`unmountOnExit`**
Type: `boolean`
Required: false
Default Value: `false`
Description: Whether to unmount on exit.
**`value`**
Type: `Color`
Required: false
Default Value: `undefined`
Description: The controlled color value of the color picker
#### Data Attributes
**`data-scope`**: color-picker
**`data-part`**: root
**`data-disabled`**: Present when disabled
**`data-readonly`**: Present when read-only
**`data-invalid`**: Present when invalid
### AreaBackground
#### Props
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
#### Data Attributes
**`data-scope`**: color-picker
**`data-part`**: area-background
**`data-invalid`**: Present when invalid
**`data-disabled`**: Present when disabled
**`data-readonly`**: Present when read-only
### Area
#### Props
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
**`xChannel`**
Type: `ColorChannel`
Required: false
Default Value: `undefined`
Description: undefined
**`yChannel`**
Type: `ColorChannel`
Required: false
Default Value: `undefined`
Description: undefined
#### Data Attributes
**`data-scope`**: color-picker
**`data-part`**: area
**`data-invalid`**: Present when invalid
**`data-disabled`**: Present when disabled
**`data-readonly`**: Present when read-only
### AreaThumb
#### Props
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
#### Data Attributes
**`data-scope`**: color-picker
**`data-part`**: area-thumb
**`data-disabled`**: Present when disabled
**`data-invalid`**: Present when invalid
**`data-readonly`**: Present when read-only
### ChannelInput
#### Props
**`channel`**
Type: `ExtendedColorChannel`
Required: true
Default Value: `undefined`
Description: undefined
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
**`orientation`**
Type: `Orientation`
Required: false
Default Value: `undefined`
Description: undefined
#### Data Attributes
**`data-scope`**: color-picker
**`data-part`**: channel-input
**`data-channel`**: The color channel of the channelinput
**`data-disabled`**: Present when disabled
**`data-invalid`**: Present when invalid
**`data-readonly`**: Present when read-only
### ChannelSliderLabel
#### Props
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
#### Data Attributes
**`data-scope`**: color-picker
**`data-part`**: channel-slider-label
**`data-channel`**: The color channel of the channelsliderlabel
### ChannelSlider
#### Props
**`channel`**
Type: `ColorChannel`
Required: true
Default Value: `undefined`
Description: undefined
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
**`orientation`**
Type: `Orientation`
Required: false
Default Value: `undefined`
Description: undefined
#### Data Attributes
**`data-scope`**: color-picker
**`data-part`**: channel-slider
**`data-channel`**: The color channel of the channelslider
**`data-orientation`**: The orientation of the channelslider
### ChannelSliderThumb
#### Props
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
#### Data Attributes
**`data-scope`**: color-picker
**`data-part`**: channel-slider-thumb
**`data-channel`**: The color channel of the channelsliderthumb
**`data-disabled`**: Present when disabled
**`data-orientation`**: The orientation of the channelsliderthumb
### ChannelSliderTrack
#### Props
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
#### Data Attributes
**`data-scope`**: color-picker
**`data-part`**: channel-slider-track
**`data-channel`**: The color channel of the channelslidertrack
**`data-orientation`**: The orientation of the channelslidertrack
### ChannelSliderValueText
#### Props
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
#### Data Attributes
**`data-scope`**: color-picker
**`data-part`**: channel-slider-value-text
**`data-channel`**: The color channel of the channelslidervaluetext
### Content
#### Props
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
#### Data Attributes
**`data-scope`**: color-picker
**`data-part`**: content
**`data-placement`**: The placement of the content
**`data-state`**: "open" | "closed"
### Control
#### Props
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
#### Data Attributes
**`data-scope`**: color-picker
**`data-part`**: control
**`data-disabled`**: Present when disabled
**`data-readonly`**: Present when read-only
**`data-invalid`**: Present when invalid
**`data-state`**: "open" | "closed"
**`data-focus`**: Present when focused
### EyeDropperTrigger
#### Props
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
#### Data Attributes
**`data-scope`**: color-picker
**`data-part`**: eye-dropper-trigger
**`data-disabled`**: Present when disabled
**`data-invalid`**: Present when invalid
**`data-readonly`**: Present when read-only
### FormatSelect
#### Props
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
### FormatTrigger
#### Props
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
### HiddenInput
#### Props
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
### Label
#### Props
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
#### Data Attributes
**`data-scope`**: color-picker
**`data-part`**: label
**`data-disabled`**: Present when disabled
**`data-readonly`**: Present when read-only
**`data-invalid`**: Present when invalid
**`data-focus`**: Present when focused
### Positioner
#### Props
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
### RootProvider
#### Props
**`value`**
Type: `UseColorPickerReturn`
Required: true
Default Value: `undefined`
Description: undefined
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
**`immediate`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Whether to synchronize the present change immediately or defer it to the next frame
**`lazyMount`**
Type: `boolean`
Required: false
Default Value: `false`
Description: Whether to enable lazy mounting
**`onExitComplete`**
Type: `VoidFunction`
Required: false
Default Value: `undefined`
Description: Function called when the animation ends in the closed state
**`present`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Whether the node is present (controlled by the user)
**`unmountOnExit`**
Type: `boolean`
Required: false
Default Value: `false`
Description: Whether to unmount on exit.
### SwatchGroup
#### Props
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
### SwatchIndicator
#### Props
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
### Swatch
#### Props
**`value`**
Type: `string | Color`
Required: true
Default Value: `undefined`
Description: The color value
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
**`respectAlpha`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Whether to include the alpha channel in the color
#### Data Attributes
**`data-scope`**: color-picker
**`data-part`**: swatch
**`data-state`**: "checked" | "unchecked"
**`data-value`**: The value of the item
### SwatchTrigger
#### Props
**`value`**
Type: `string | Color`
Required: true
Default Value: `undefined`
Description: The color value
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
**`disabled`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Whether the swatch trigger is disabled
#### Data Attributes
**`data-scope`**: color-picker
**`data-part`**: swatch-trigger
**`data-state`**: "checked" | "unchecked"
**`data-value`**: The value of the item
**`data-disabled`**: Present when disabled
### TransparencyGrid
#### Props
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
**`size`**
Type: `string`
Required: false
Default Value: `undefined`
Description: undefined
### Trigger
#### Props
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
#### Data Attributes
**`data-scope`**: color-picker
**`data-part`**: trigger
**`data-disabled`**: Present when disabled
**`data-readonly`**: Present when read-only
**`data-invalid`**: Present when invalid
**`data-placement`**: The placement of the trigger
**`data-state`**: "open" | "closed"
**`data-focus`**: Present when focused
### ValueSwatch
#### Props
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
**`respectAlpha`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Whether to include the alpha channel in the color
### ValueText
#### Props
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
#### Data Attributes
**`data-scope`**: color-picker
**`data-part`**: value-text
**`data-disabled`**: Present when disabled
**`data-focus`**: Present when focused
### View
#### Props
**`format`**
Type: `ColorFormat`
Required: true
Default Value: `undefined`
Description: undefined
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
## Accessibility
### Keyboard Support
**`Enter`**
Description: When focus is on the trigger, opens the color picker When focus is on a trigger of a swatch, selects the color (and closes the color picker) When focus is on the input or channel inputs, selects the color
**`ArrowLeft`**
Description: When focus is on the color area, decreases the hue value of the color When focus is on the channel sliders, decreases the value of the channel
**`ArrowRight`**
Description: When focus is on the color area, increases the hue value of the color When focus is on the channel sliders, increases the value of the channel
**`ArrowUp`**
Description: When focus is on the color area, increases the saturation value of the color When focus is on the channel sliders, increases the value of the channel
**`ArrowDown`**
Description: When focus is on the color area, decreases the saturation value of the color When focus is on the channel sliders, decreases the value of the channel
**`Esc`**
Description: Closes the color picker and moves focus to the trigger
# Color Picker (SOLID)
## Anatomy
To set up the color picker correctly, you'll need to understand its anatomy and how we name its parts.
> Each part includes a `data-part` attribute to help identify them in the DOM.
## Examples
Learn how to use the `ColorPicker` component in your project. Let's take a look at the most basic example
```tsx
import { ColorPicker, parseColor } from '@ark-ui/solid/color-picker'
export const Basic = () => {
return (
ColorToggle ColorFormat✓✓✓Pick color
)
}
```
### Controlled Color Picker
To create a controlled Color Picker component, manage the state of the current color using the `value` prop and update
it when the `onValueChange` or `onValueChangeEnd` event handler is called:
```tsx
import { ColorPicker, parseColor } from '@ark-ui/solid/color-picker'
import { createSignal } from 'solid-js'
export const Controlled = () => {
const [color, setColor] = createSignal(parseColor('hsl(0, 100%, 50%)'))
return (
setColor(e.value)}
onValueChangeEnd={(e) => console.log(e.valueAsString)}
>
Color✓✓✓Pick color
)
}
```
### Using the Field Component
The `Field` component helps manage form-related state and accessibility attributes of a color picker. It includes
handling ARIA labels, helper text, and error text to ensure proper accessibility.
```tsx
import { ColorPicker, parseColor } from '@ark-ui/solid/color-picker'
import { Field } from '@ark-ui/solid/field'
export const WithField = (props: Field.RootProps) => (
LabelAdditional InfoError Info
)
```
### Using the Root Provider
The `RootProvider` component provides a context for the color-picker. It accepts the value of the `useColor-picker`
hook. You can leverage it to access the component state and methods from outside the color-picker.
```tsx
import { ColorPicker, parseColor, useColorPicker } from '@ark-ui/solid/color-picker'
export const RootProvider = () => {
const colorPicker = useColorPicker({ defaultValue: parseColor('#eb5e41') })
return (
<>
Color: {colorPicker().valueAsString}ColorToggle ColorFormat✓✓✓Pick color
>
)
}
```
> If you're using the `RootProvider` component, you don't need to use the `Root` component.
## API Reference
### Root
#### Props
**`asChild`**
Type: `(props: ParentProps<'div'>) => Element`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
**`closeOnSelect`**
Type: `boolean`
Required: false
Default Value: `false`
Description: Whether to close the color picker when a swatch is selected
**`defaultFormat`**
Type: `ColorFormat`
Required: false
Default Value: `"rgba"`
Description: The initial color format when rendered.
Use when you don't need to control the color format of the color picker.
**`defaultOpen`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: The initial open state of the color picker when rendered.
Use when you don't need to control the open state of the color picker.
**`defaultValue`**
Type: `Color`
Required: false
Default Value: `#000000`
Description: The initial color value when rendered.
Use when you don't need to control the color value of the color picker.
**`disabled`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Whether the color picker is disabled
**`format`**
Type: `ColorFormat`
Required: false
Default Value: `undefined`
Description: The controlled color format to use
**`ids`**
Type: `Partial<{ root: string; control: string; trigger: string; label: string; input: string; hiddenInput: string; content: string; area: string; areaGradient: string; positioner: string; formatSelect: string; areaThumb: string; channelInput(id: string): string; channelSliderTrack(id: ColorChannel): string; channelSliderT...`
Required: false
Default Value: `undefined`
Description: The ids of the elements in the color picker. Useful for composition.
**`immediate`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Whether to synchronize the present change immediately or defer it to the next frame
**`initialFocusEl`**
Type: `() => HTMLElement | null`
Required: false
Default Value: `undefined`
Description: The initial focus element when the color picker is opened.
**`invalid`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Whether the color picker is invalid
**`lazyMount`**
Type: `boolean`
Required: false
Default Value: `false`
Description: Whether to enable lazy mounting
**`name`**
Type: `string`
Required: false
Default Value: `undefined`
Description: The name for the form input
**`onExitComplete`**
Type: `VoidFunction`
Required: false
Default Value: `undefined`
Description: Function called when the animation ends in the closed state
**`onFocusOutside`**
Type: `(event: FocusOutsideEvent) => void`
Required: false
Default Value: `undefined`
Description: Function called when the focus is moved outside the component
**`onFormatChange`**
Type: `(details: FormatChangeDetails) => void`
Required: false
Default Value: `undefined`
Description: Function called when the color format changes
**`onInteractOutside`**
Type: `(event: InteractOutsideEvent) => void`
Required: false
Default Value: `undefined`
Description: Function called when an interaction happens outside the component
**`onOpenChange`**
Type: `(details: OpenChangeDetails) => void`
Required: false
Default Value: `undefined`
Description: Handler that is called when the user opens or closes the color picker.
**`onPointerDownOutside`**
Type: `(event: PointerDownOutsideEvent) => void`
Required: false
Default Value: `undefined`
Description: Function called when the pointer is pressed down outside the component
**`onValueChange`**
Type: `(details: ValueChangeDetails) => void`
Required: false
Default Value: `undefined`
Description: Handler that is called when the value changes, as the user drags.
**`onValueChangeEnd`**
Type: `(details: ValueChangeDetails) => void`
Required: false
Default Value: `undefined`
Description: Handler that is called when the user stops dragging.
**`open`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: The controlled open state of the color picker
**`openAutoFocus`**
Type: `boolean`
Required: false
Default Value: `true`
Description: Whether to auto focus the color picker when it is opened
**`positioning`**
Type: `PositioningOptions`
Required: false
Default Value: `undefined`
Description: The positioning options for the color picker
**`present`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Whether the node is present (controlled by the user)
**`readOnly`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Whether the color picker is read-only
**`required`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Whether the color picker is required
**`unmountOnExit`**
Type: `boolean`
Required: false
Default Value: `false`
Description: Whether to unmount on exit.
**`value`**
Type: `Color`
Required: false
Default Value: `undefined`
Description: The controlled color value of the color picker
#### Data Attributes
**`data-scope`**: color-picker
**`data-part`**: root
**`data-disabled`**: Present when disabled
**`data-readonly`**: Present when read-only
**`data-invalid`**: Present when invalid
### AreaBackground
#### Props
**`asChild`**
Type: `(props: ParentProps<'div'>) => Element`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
#### Data Attributes
**`data-scope`**: color-picker
**`data-part`**: area-background
**`data-invalid`**: Present when invalid
**`data-disabled`**: Present when disabled
**`data-readonly`**: Present when read-only
### Area
#### Props
**`asChild`**
Type: `(props: ParentProps<'div'>) => Element`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
**`xChannel`**
Type: `ColorChannel`
Required: false
Default Value: `undefined`
Description: undefined
**`yChannel`**
Type: `ColorChannel`
Required: false
Default Value: `undefined`
Description: undefined
#### Data Attributes
**`data-scope`**: color-picker
**`data-part`**: area
**`data-invalid`**: Present when invalid
**`data-disabled`**: Present when disabled
**`data-readonly`**: Present when read-only
### AreaThumb
#### Props
**`asChild`**
Type: `(props: ParentProps<'div'>) => Element`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
#### Data Attributes
**`data-scope`**: color-picker
**`data-part`**: area-thumb
**`data-disabled`**: Present when disabled
**`data-invalid`**: Present when invalid
**`data-readonly`**: Present when read-only
### ChannelInput
#### Props
**`channel`**
Type: `ExtendedColorChannel`
Required: true
Default Value: `undefined`
Description: undefined
**`asChild`**
Type: `(props: ParentProps<'input'>) => Element`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
**`orientation`**
Type: `Orientation`
Required: false
Default Value: `undefined`
Description: undefined
#### Data Attributes
**`data-scope`**: color-picker
**`data-part`**: channel-input
**`data-channel`**: The color channel of the channelinput
**`data-disabled`**: Present when disabled
**`data-invalid`**: Present when invalid
**`data-readonly`**: Present when read-only
### ChannelSliderLabel
#### Props
**`asChild`**
Type: `(props: ParentProps<'label'>) => Element`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
#### Data Attributes
**`data-scope`**: color-picker
**`data-part`**: channel-slider-label
**`data-channel`**: The color channel of the channelsliderlabel
### ChannelSlider
#### Props
**`channel`**
Type: `ColorChannel`
Required: true
Default Value: `undefined`
Description: undefined
**`asChild`**
Type: `(props: ParentProps<'div'>) => Element`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
**`orientation`**
Type: `Orientation`
Required: false
Default Value: `undefined`
Description: undefined
#### Data Attributes
**`data-scope`**: color-picker
**`data-part`**: channel-slider
**`data-channel`**: The color channel of the channelslider
**`data-orientation`**: The orientation of the channelslider
### ChannelSliderThumb
#### Props
**`asChild`**
Type: `(props: ParentProps<'div'>) => Element`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
#### Data Attributes
**`data-scope`**: color-picker
**`data-part`**: channel-slider-thumb
**`data-channel`**: The color channel of the channelsliderthumb
**`data-disabled`**: Present when disabled
**`data-orientation`**: The orientation of the channelsliderthumb
### ChannelSliderTrack
#### Props
**`asChild`**
Type: `(props: ParentProps<'div'>) => Element`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
#### Data Attributes
**`data-scope`**: color-picker
**`data-part`**: channel-slider-track
**`data-channel`**: The color channel of the channelslidertrack
**`data-orientation`**: The orientation of the channelslidertrack
### ChannelSliderValueText
#### Props
**`asChild`**
Type: `(props: ParentProps<'span'>) => Element`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
#### Data Attributes
**`data-scope`**: color-picker
**`data-part`**: channel-slider-value-text
**`data-channel`**: The color channel of the channelslidervaluetext
### Content
#### Props
**`asChild`**
Type: `(props: ParentProps<'div'>) => Element`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
#### Data Attributes
**`data-scope`**: color-picker
**`data-part`**: content
**`data-placement`**: The placement of the content
**`data-state`**: "open" | "closed"
### Control
#### Props
**`asChild`**
Type: `(props: ParentProps<'div'>) => Element`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
#### Data Attributes
**`data-scope`**: color-picker
**`data-part`**: control
**`data-disabled`**: Present when disabled
**`data-readonly`**: Present when read-only
**`data-invalid`**: Present when invalid
**`data-state`**: "open" | "closed"
**`data-focus`**: Present when focused
### EyeDropperTrigger
#### Props
**`asChild`**
Type: `(props: ParentProps<'button'>) => Element`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
#### Data Attributes
**`data-scope`**: color-picker
**`data-part`**: eye-dropper-trigger
**`data-disabled`**: Present when disabled
**`data-invalid`**: Present when invalid
**`data-readonly`**: Present when read-only
### FormatSelect
#### Props
**`asChild`**
Type: `(props: ParentProps<'select'>) => Element`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
### FormatTrigger
#### Props
**`asChild`**
Type: `(props: ParentProps<'button'>) => Element`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
### HiddenInput
#### Props
**`asChild`**
Type: `(props: ParentProps<'input'>) => Element`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
### Label
#### Props
**`asChild`**
Type: `(props: ParentProps<'label'>) => Element`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
#### Data Attributes
**`data-scope`**: color-picker
**`data-part`**: label
**`data-disabled`**: Present when disabled
**`data-readonly`**: Present when read-only
**`data-invalid`**: Present when invalid
**`data-focus`**: Present when focused
### Positioner
#### Props
**`asChild`**
Type: `(props: ParentProps<'div'>) => Element`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
### RootProvider
#### Props
**`value`**
Type: `UseColorPickerReturn`
Required: true
Default Value: `undefined`
Description: undefined
**`asChild`**
Type: `(props: ParentProps<'div'>) => Element`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
**`immediate`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Whether to synchronize the present change immediately or defer it to the next frame
**`lazyMount`**
Type: `boolean`
Required: false
Default Value: `false`
Description: Whether to enable lazy mounting
**`onExitComplete`**
Type: `VoidFunction`
Required: false
Default Value: `undefined`
Description: Function called when the animation ends in the closed state
**`present`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Whether the node is present (controlled by the user)
**`unmountOnExit`**
Type: `boolean`
Required: false
Default Value: `false`
Description: Whether to unmount on exit.
### SwatchGroup
#### Props
**`asChild`**
Type: `(props: ParentProps<'div'>) => Element`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
### SwatchIndicator
#### Props
**`asChild`**
Type: `(props: ParentProps<'div'>) => Element`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
### Swatch
#### Props
**`value`**
Type: `string | Color`
Required: true
Default Value: `undefined`
Description: The color value
**`asChild`**
Type: `(props: ParentProps<'div'>) => Element`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
**`respectAlpha`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Whether to include the alpha channel in the color
#### Data Attributes
**`data-scope`**: color-picker
**`data-part`**: swatch
**`data-state`**: "checked" | "unchecked"
**`data-value`**: The value of the item
### SwatchTrigger
#### Props
**`value`**
Type: `string | Color`
Required: true
Default Value: `undefined`
Description: The color value
**`asChild`**
Type: `(props: ParentProps<'button'>) => Element`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
**`disabled`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Whether the swatch trigger is disabled
#### Data Attributes
**`data-scope`**: color-picker
**`data-part`**: swatch-trigger
**`data-state`**: "checked" | "unchecked"
**`data-value`**: The value of the item
**`data-disabled`**: Present when disabled
### TransparencyGrid
#### Props
**`asChild`**
Type: `(props: ParentProps<'div'>) => Element`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
**`size`**
Type: `string`
Required: false
Default Value: `undefined`
Description: undefined
### Trigger
#### Props
**`asChild`**
Type: `(props: ParentProps<'button'>) => Element`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
#### Data Attributes
**`data-scope`**: color-picker
**`data-part`**: trigger
**`data-disabled`**: Present when disabled
**`data-readonly`**: Present when read-only
**`data-invalid`**: Present when invalid
**`data-placement`**: The placement of the trigger
**`data-state`**: "open" | "closed"
**`data-focus`**: Present when focused
### ValueSwatch
#### Props
**`asChild`**
Type: `(props: ParentProps<'div'>) => Element`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
**`respectAlpha`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Whether to include the alpha channel in the color
### ValueText
#### Props
**`asChild`**
Type: `(props: ParentProps<'span'>) => Element`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
#### Data Attributes
**`data-scope`**: color-picker
**`data-part`**: value-text
**`data-disabled`**: Present when disabled
**`data-focus`**: Present when focused
### View
#### Props
**`format`**
Type: `ColorFormat`
Required: true
Default Value: `undefined`
Description: undefined
**`asChild`**
Type: `(props: ParentProps<'div'>) => Element`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
## Accessibility
### Keyboard Support
**`Enter`**
Description: When focus is on the trigger, opens the color picker When focus is on a trigger of a swatch, selects the color (and closes the color picker) When focus is on the input or channel inputs, selects the color
**`ArrowLeft`**
Description: When focus is on the color area, decreases the hue value of the color When focus is on the channel sliders, decreases the value of the channel
**`ArrowRight`**
Description: When focus is on the color area, increases the hue value of the color When focus is on the channel sliders, increases the value of the channel
**`ArrowUp`**
Description: When focus is on the color area, increases the saturation value of the color When focus is on the channel sliders, increases the value of the channel
**`ArrowDown`**
Description: When focus is on the color area, decreases the saturation value of the color When focus is on the channel sliders, decreases the value of the channel
**`Esc`**
Description: Closes the color picker and moves focus to the trigger
# Color Picker (VUE)
## Anatomy
To set up the color picker correctly, you'll need to understand its anatomy and how we name its parts.
> Each part includes a `data-part` attribute to help identify them in the DOM.
## Examples
Learn how to use the `ColorPicker` component in your project. Let's take a look at the most basic example
```vue
ColorToggle ColorFormat✓✓✓Pick color
```
### Controlled Color Picker
To create a controlled Color Picker component, manage the state of the current color using the `value` prop and update
it when the `onValueChange` or `onValueChangeEnd` event handler is called:
```vue
Color✓✓✓Pick color
```
### Using the Field Component
The `Field` component helps manage form-related state and accessibility attributes of a color picker. It includes
handling ARIA labels, helper text, and error text to ensure proper accessibility.
```vue
LabelAdditional InfoError Info
```
### Using the Root Provider
The `RootProvider` component provides a context for the color-picker. It accepts the value of the `useColor-picker`
hook. You can leverage it to access the component state and methods from outside the color-picker.
```vue
Color: {{ colorPicker.valueAsString }}ColorToggle ColorFormat✓✓✓Pick color
```
> If you're using the `RootProvider` component, you don't need to use the `Root` component.
## API Reference
### Root
#### Props
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
**`closeOnSelect`**
Type: `boolean`
Required: false
Default Value: `false`
Description: Whether to close the color picker when a swatch is selected
**`defaultFormat`**
Type: `ColorFormat`
Required: false
Default Value: `"rgba"`
Description: The initial color format when rendered.
Use when you don't need to control the color format of the color picker.
**`defaultOpen`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: The initial open state of the color picker when rendered.
Use when you don't need to control the open state of the color picker.
**`defaultValue`**
Type: `Color`
Required: false
Default Value: `#000000`
Description: The initial color value when rendered.
Use when you don't need to control the color value of the color picker.
**`disabled`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Whether the color picker is disabled
**`format`**
Type: `ColorFormat`
Required: false
Default Value: `undefined`
Description: The controlled color format to use
**`id`**
Type: `string`
Required: false
Default Value: `undefined`
Description: The unique identifier of the machine.
**`ids`**
Type: `Partial<{ root: string; control: string; trigger: string; label: string; input: string; hiddenInput: string; content: string; area: string; areaGradient: string; positioner: string; formatSelect: string; areaThumb: string; channelInput(id: string): string; channelSliderTrack(id: ColorChannel): string; channelSliderT...`
Required: false
Default Value: `undefined`
Description: The ids of the elements in the color picker. Useful for composition.
**`initialFocusEl`**
Type: `() => HTMLElement | null`
Required: false
Default Value: `undefined`
Description: The initial focus element when the color picker is opened.
**`invalid`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Whether the color picker is invalid
**`lazyMount`**
Type: `boolean`
Required: false
Default Value: `false`
Description: Whether to enable lazy mounting
**`modelValue`**
Type: `Color`
Required: false
Default Value: `undefined`
Description: The v-model value of the color picker
**`name`**
Type: `string`
Required: false
Default Value: `undefined`
Description: The name for the form input
**`open`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: The controlled open state of the color picker
**`openAutoFocus`**
Type: `boolean`
Required: false
Default Value: `true`
Description: Whether to auto focus the color picker when it is opened
**`positioning`**
Type: `PositioningOptions`
Required: false
Default Value: `undefined`
Description: The positioning options for the color picker
**`readOnly`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Whether the color picker is read-only
**`required`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Whether the color picker is required
**`unmountOnExit`**
Type: `boolean`
Required: false
Default Value: `false`
Description: Whether to unmount on exit.
#### Emits
**`focusOutside`**
Type: `[event: FocusOutsideEvent]`
Description: Function called when the focus is moved outside the component
**`formatChange`**
Type: `[details: FormatChangeDetails]`
Description: Function called when the color format changes
**`interactOutside`**
Type: `[event: InteractOutsideEvent]`
Description: Function called when an interaction happens outside the component
**`openChange`**
Type: `[details: OpenChangeDetails]`
Description: Handler that is called when the user opens or closes the color picker.
**`pointerDownOutside`**
Type: `[event: PointerDownOutsideEvent]`
Description: Function called when the pointer is pressed down outside the component
**`update:format`**
Type: `[format: ColorFormat]`
Description: The callback fired when the format changes.
**`update:modelValue`**
Type: `[value: Color]`
Description: The callback fired when the model value changes.
**`update:open`**
Type: `[open: boolean]`
Description: The callback fired when the open state changes.
**`valueChange`**
Type: `[details: ValueChangeDetails]`
Description: Handler that is called when the value changes, as the user drags.
**`valueChangeEnd`**
Type: `[details: ValueChangeDetails]`
Description: Handler that is called when the user stops dragging.
#### Data Attributes
**`data-scope`**: color-picker
**`data-part`**: root
**`data-disabled`**: Present when disabled
**`data-readonly`**: Present when read-only
**`data-invalid`**: Present when invalid
### AreaBackground
#### Props
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
#### Data Attributes
**`data-scope`**: color-picker
**`data-part`**: area-background
**`data-invalid`**: Present when invalid
**`data-disabled`**: Present when disabled
**`data-readonly`**: Present when read-only
### Area
#### Props
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
**`xChannel`**
Type: `ColorChannel`
Required: false
Default Value: `undefined`
Description: undefined
**`yChannel`**
Type: `ColorChannel`
Required: false
Default Value: `undefined`
Description: undefined
#### Data Attributes
**`data-scope`**: color-picker
**`data-part`**: area
**`data-invalid`**: Present when invalid
**`data-disabled`**: Present when disabled
**`data-readonly`**: Present when read-only
### AreaThumb
#### Props
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
#### Data Attributes
**`data-scope`**: color-picker
**`data-part`**: area-thumb
**`data-disabled`**: Present when disabled
**`data-invalid`**: Present when invalid
**`data-readonly`**: Present when read-only
### ChannelInput
#### Props
**`channel`**
Type: `ExtendedColorChannel`
Required: true
Default Value: `undefined`
Description: undefined
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
**`orientation`**
Type: `Orientation`
Required: false
Default Value: `undefined`
Description: undefined
#### Data Attributes
**`data-scope`**: color-picker
**`data-part`**: channel-input
**`data-channel`**: The color channel of the channelinput
**`data-disabled`**: Present when disabled
**`data-invalid`**: Present when invalid
**`data-readonly`**: Present when read-only
### ChannelSliderLabel
#### Props
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
#### Data Attributes
**`data-scope`**: color-picker
**`data-part`**: channel-slider-label
**`data-channel`**: The color channel of the channelsliderlabel
### ChannelSlider
#### Props
**`channel`**
Type: `ColorChannel`
Required: true
Default Value: `undefined`
Description: undefined
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
**`orientation`**
Type: `Orientation`
Required: false
Default Value: `undefined`
Description: undefined
#### Data Attributes
**`data-scope`**: color-picker
**`data-part`**: channel-slider
**`data-channel`**: The color channel of the channelslider
**`data-orientation`**: The orientation of the channelslider
### ChannelSliderThumb
#### Props
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
#### Data Attributes
**`data-scope`**: color-picker
**`data-part`**: channel-slider-thumb
**`data-channel`**: The color channel of the channelsliderthumb
**`data-disabled`**: Present when disabled
**`data-orientation`**: The orientation of the channelsliderthumb
### ChannelSliderTrack
#### Props
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
#### Data Attributes
**`data-scope`**: color-picker
**`data-part`**: channel-slider-track
**`data-channel`**: The color channel of the channelslidertrack
**`data-orientation`**: The orientation of the channelslidertrack
### ChannelSliderValueText
#### Props
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
#### Data Attributes
**`data-scope`**: color-picker
**`data-part`**: channel-slider-value-text
**`data-channel`**: The color channel of the channelslidervaluetext
### Content
#### Props
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
**`immediate`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Whether to synchronize the present change immediately or defer it to the next frame
**`lazyMount`**
Type: `boolean`
Required: false
Default Value: `false`
Description: Whether to enable lazy mounting
**`present`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Whether the node is present (controlled by the user)
**`unmountOnExit`**
Type: `boolean`
Required: false
Default Value: `false`
Description: Whether to unmount on exit.
#### Data Attributes
**`data-scope`**: color-picker
**`data-part`**: content
**`data-placement`**: The placement of the content
**`data-state`**: "open" | "closed"
### Control
#### Props
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
#### Data Attributes
**`data-scope`**: color-picker
**`data-part`**: control
**`data-disabled`**: Present when disabled
**`data-readonly`**: Present when read-only
**`data-invalid`**: Present when invalid
**`data-state`**: "open" | "closed"
**`data-focus`**: Present when focused
### EyeDropperTrigger
#### Props
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
#### Data Attributes
**`data-scope`**: color-picker
**`data-part`**: eye-dropper-trigger
**`data-disabled`**: Present when disabled
**`data-invalid`**: Present when invalid
**`data-readonly`**: Present when read-only
### FormatSelect
#### Props
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
### FormatTrigger
#### Props
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
### HiddenInput
#### Props
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
### Label
#### Props
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
#### Data Attributes
**`data-scope`**: color-picker
**`data-part`**: label
**`data-disabled`**: Present when disabled
**`data-readonly`**: Present when read-only
**`data-invalid`**: Present when invalid
**`data-focus`**: Present when focused
### Positioner
#### Props
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
### RootProvider
#### Props
**`value`**
Type: `ColorPickerApi`
Required: true
Default Value: `undefined`
Description: undefined
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
**`lazyMount`**
Type: `boolean`
Required: false
Default Value: `false`
Description: Whether to enable lazy mounting
**`unmountOnExit`**
Type: `boolean`
Required: false
Default Value: `false`
Description: Whether to unmount on exit.
### SwatchGroup
#### Props
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
### SwatchIndicator
#### Props
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
### Swatch
#### Props
**`value`**
Type: `string | Color`
Required: true
Default Value: `undefined`
Description: The color value
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
**`respectAlpha`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Whether to include the alpha channel in the color
#### Data Attributes
**`data-scope`**: color-picker
**`data-part`**: swatch
**`data-state`**: "checked" | "unchecked"
**`data-value`**: The value of the item
### SwatchTrigger
#### Props
**`value`**
Type: `string | Color`
Required: true
Default Value: `undefined`
Description: The color value
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
**`disabled`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Whether the swatch trigger is disabled
#### Data Attributes
**`data-scope`**: color-picker
**`data-part`**: swatch-trigger
**`data-state`**: "checked" | "unchecked"
**`data-value`**: The value of the item
**`data-disabled`**: Present when disabled
### TransparencyGrid
#### Props
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
**`size`**
Type: `string`
Required: false
Default Value: `undefined`
Description: undefined
### Trigger
#### Props
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
#### Data Attributes
**`data-scope`**: color-picker
**`data-part`**: trigger
**`data-disabled`**: Present when disabled
**`data-readonly`**: Present when read-only
**`data-invalid`**: Present when invalid
**`data-placement`**: The placement of the trigger
**`data-state`**: "open" | "closed"
**`data-focus`**: Present when focused
### ValueSwatch
#### Props
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
**`respectAlpha`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Whether to include the alpha channel in the color
### ValueText
#### Props
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
#### Data Attributes
**`data-scope`**: color-picker
**`data-part`**: value-text
**`data-disabled`**: Present when disabled
**`data-focus`**: Present when focused
### View
#### Props
**`format`**
Type: `ColorFormat`
Required: true
Default Value: `undefined`
Description: undefined
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
## Accessibility
### Keyboard Support
**`Enter`**
Description: When focus is on the trigger, opens the color picker When focus is on a trigger of a swatch, selects the color (and closes the color picker) When focus is on the input or channel inputs, selects the color
**`ArrowLeft`**
Description: When focus is on the color area, decreases the hue value of the color When focus is on the channel sliders, decreases the value of the channel
**`ArrowRight`**
Description: When focus is on the color area, increases the hue value of the color When focus is on the channel sliders, increases the value of the channel
**`ArrowUp`**
Description: When focus is on the color area, increases the saturation value of the color When focus is on the channel sliders, increases the value of the channel
**`ArrowDown`**
Description: When focus is on the color area, decreases the saturation value of the color When focus is on the channel sliders, decreases the value of the channel
**`Esc`**
Description: Closes the color picker and moves focus to the trigger
# Combobox (REACT)
## Anatomy
To set up the combobox correctly, you'll need to understand its anatomy and how we name its parts.
> Each part includes a `data-part` attribute to help identify them in the DOM.
## Examples
Learn how to use the `Combobox` component in your project. Let's take a look at the most basic example
```tsx
import { Combobox, createListCollection } from '@ark-ui/react/combobox'
import { Portal } from '@ark-ui/react/portal'
import { useMemo, useState } from 'react'
const initialItems = ['React', 'Solid', 'Vue']
export const Basic = () => {
const [items, setItems] = useState(initialItems)
const collection = useMemo(() => createListCollection({ items }), [items])
const handleInputChange = (details: Combobox.InputValueChangeDetails) => {
setItems(initialItems.filter((item) => item.toLowerCase().includes(details.inputValue.toLowerCase())))
}
return (
FrameworkOpenClearFrameworks
{collection.items.map((item) => (
{item}✓
))}
)
}
```
### Advanced Customization
Extended example that shows usage with complex item objects, including disabled state for certain options.
```tsx
import { Combobox, createListCollection } from '@ark-ui/react/combobox'
import { Portal } from '@ark-ui/react/portal'
export const Advanced = () => {
const collection = createListCollection({
items: [
{ label: 'React', value: 'react' },
{ label: 'Solid', value: 'solid' },
{ label: 'Vue', value: 'vue' },
{ label: 'Svelte', value: 'svelte', disabled: true },
],
})
return (
FrameworkOpenClearFrameworks
{collection.items.map((item) => (
{item.label}✓
))}
)
}
```
### Using the Field Component
The `Field` component helps manage form-related state and accessibility attributes of a combobox. It includes handling
ARIA labels, helper text, and error text to ensure proper accessibility.
```tsx
import { Combobox, createListCollection } from '@ark-ui/react/combobox'
import { Field } from '@ark-ui/react/field'
export const WithField = (props: Field.RootProps) => {
const collection = createListCollection({ items: ['React', 'Solid', 'Vue'] })
return (
LabelOpenClear
{collection.items.map((item) => (
{item}✓
))}
Additional InfoError Info
)
}
```
### Using the Root Provider
The `RootProvider` component provides a context for the combobox. It accepts the value of the `useCombobox` hook. You
can leverage it to access the component state and methods from outside the combobox.
```tsx
import { Combobox, createListCollection, useCombobox } from '@ark-ui/react/combobox'
import { Portal } from '@ark-ui/react/portal'
import { useMemo, useState } from 'react'
const initialItems = ['React', 'Solid', 'Vue']
export const RootProvider = () => {
const [items, setItems] = useState(initialItems)
const collection = useMemo(() => createListCollection({ items }), [items])
const handleInputChange = (details: Combobox.InputValueChangeDetails) => {
setItems(initialItems.filter((item) => item.toLowerCase().includes(details.inputValue.toLowerCase())))
}
const combobox = useCombobox({ collection: collection, onInputValueChange: handleInputChange })
return (
<>
FrameworkOpenClearFrameworks
{collection.items.map((item) => (
{item}✓
))}
>
)
}
```
> If you're using the `RootProvider` component, you don't need to use the `Root` component.
## API Reference
### Root
#### Props
**`collection`**
Type: `ListCollection`
Required: true
Default Value: `undefined`
Description: The collection of items
**`allowCustomValue`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Whether to allow typing custom values in the input
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
**`autoFocus`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Whether to autofocus the input on mount
**`closeOnSelect`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Whether to close the combobox when an item is selected.
**`composite`**
Type: `boolean`
Required: false
Default Value: `true`
Description: Whether the combobox is a composed with other composite widgets like tabs
**`defaultHighlightedValue`**
Type: `string`
Required: false
Default Value: `undefined`
Description: The initial highlighted value of the combobox when rendered.
Use when you don't need to control the highlighted value of the combobox.
**`defaultInputValue`**
Type: `string`
Required: false
Default Value: `""`
Description: The initial value of the combobox's input when rendered.
Use when you don't need to control the value of the combobox's input.
**`defaultOpen`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: The initial open state of the combobox when rendered.
Use when you don't need to control the open state of the combobox.
**`defaultValue`**
Type: `string[]`
Required: false
Default Value: `[]`
Description: The initial value of the combobox's selected items when rendered.
Use when you don't need to control the value of the combobox's selected items.
**`disabled`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Whether the combobox is disabled
**`disableLayer`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Whether to disable registering this a dismissable layer
**`form`**
Type: `string`
Required: false
Default Value: `undefined`
Description: The associate form of the combobox.
**`highlightedValue`**
Type: `string`
Required: false
Default Value: `undefined`
Description: The controlled highlighted value of the combobox
**`id`**
Type: `string`
Required: false
Default Value: `undefined`
Description: The unique identifier of the machine.
**`ids`**
Type: `Partial<{
root: string
label: string
control: string
input: string
content: string
trigger: string
clearTrigger: string
item(id: string, index?: number | undefined): string
positioner: string
itemGroup(id: string | number): string
itemGroupLabel(id: string | number): string
}>`
Required: false
Default Value: `undefined`
Description: The ids of the elements in the combobox. Useful for composition.
**`immediate`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Whether to synchronize the present change immediately or defer it to the next frame
**`inputBehavior`**
Type: `'none' | 'autohighlight' | 'autocomplete'`
Required: false
Default Value: `"none"`
Description: Defines the auto-completion behavior of the combobox.
- `autohighlight`: The first focused item is highlighted as the user types
- `autocomplete`: Navigating the listbox with the arrow keys selects the item and the input is updated
**`inputValue`**
Type: `string`
Required: false
Default Value: `undefined`
Description: The controlled value of the combobox's input
**`invalid`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Whether the combobox is invalid
**`lazyMount`**
Type: `boolean`
Required: false
Default Value: `false`
Description: Whether to enable lazy mounting
**`loopFocus`**
Type: `boolean`
Required: false
Default Value: `true`
Description: Whether to loop the keyboard navigation through the items
**`multiple`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Whether to allow multiple selection.
**Good to know:** When `multiple` is `true`, the `selectionBehavior` is automatically set to `clear`.
It is recommended to render the selected items in a separate container.
**`name`**
Type: `string`
Required: false
Default Value: `undefined`
Description: The `name` attribute of the combobox's input. Useful for form submission
**`navigate`**
Type: `(details: NavigateDetails) => void`
Required: false
Default Value: `undefined`
Description: Function to navigate to the selected item
**`onExitComplete`**
Type: `VoidFunction`
Required: false
Default Value: `undefined`
Description: Function called when the animation ends in the closed state
**`onFocusOutside`**
Type: `(event: FocusOutsideEvent) => void`
Required: false
Default Value: `undefined`
Description: Function called when the focus is moved outside the component
**`onHighlightChange`**
Type: `(details: HighlightChangeDetails) => void`
Required: false
Default Value: `undefined`
Description: Function called when an item is highlighted using the pointer
or keyboard navigation.
**`onInputValueChange`**
Type: `(details: InputValueChangeDetails) => void`
Required: false
Default Value: `undefined`
Description: Function called when the input's value changes
**`onInteractOutside`**
Type: `(event: InteractOutsideEvent) => void`
Required: false
Default Value: `undefined`
Description: Function called when an interaction happens outside the component
**`onOpenChange`**
Type: `(details: OpenChangeDetails) => void`
Required: false
Default Value: `undefined`
Description: Function called when the popup is opened
**`onPointerDownOutside`**
Type: `(event: PointerDownOutsideEvent) => void`
Required: false
Default Value: `undefined`
Description: Function called when the pointer is pressed down outside the component
**`onValueChange`**
Type: `(details: ValueChangeDetails) => void`
Required: false
Default Value: `undefined`
Description: Function called when a new item is selected
**`open`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: The controlled open state of the combobox
**`openOnChange`**
Type: `boolean | ((details: InputValueChangeDetails) => boolean)`
Required: false
Default Value: `true`
Description: Whether to show the combobox when the input value changes
**`openOnClick`**
Type: `boolean`
Required: false
Default Value: `false`
Description: Whether to open the combobox popup on initial click on the input
**`openOnKeyPress`**
Type: `boolean`
Required: false
Default Value: `true`
Description: Whether to open the combobox on arrow key press
**`placeholder`**
Type: `string`
Required: false
Default Value: `undefined`
Description: The placeholder text of the combobox's input
**`positioning`**
Type: `PositioningOptions`
Required: false
Default Value: `{ placement: "bottom-start" }`
Description: The positioning options to dynamically position the menu
**`present`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Whether the node is present (controlled by the user)
**`readOnly`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Whether the combobox is readonly. This puts the combobox in a "non-editable" mode
but the user can still interact with it
**`required`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Whether the combobox is required
**`scrollToIndexFn`**
Type: `(details: ScrollToIndexDetails) => void`
Required: false
Default Value: `undefined`
Description: Function to scroll to a specific index
**`selectionBehavior`**
Type: `'replace' | 'clear' | 'preserve'`
Required: false
Default Value: `"replace"`
Description: The behavior of the combobox input when an item is selected
- `replace`: The selected item string is set as the input value
- `clear`: The input value is cleared
- `preserve`: The input value is preserved
**`translations`**
Type: `IntlTranslations`
Required: false
Default Value: `undefined`
Description: Specifies the localized strings that identifies the accessibility elements and their states
**`unmountOnExit`**
Type: `boolean`
Required: false
Default Value: `false`
Description: Whether to unmount on exit.
**`value`**
Type: `string[]`
Required: false
Default Value: `undefined`
Description: The controlled value of the combobox's selected items
#### Data Attributes
**`data-scope`**: combobox
**`data-part`**: root
**`data-invalid`**: Present when invalid
**`data-readonly`**: Present when read-only
### ClearTrigger
#### Props
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
#### Data Attributes
**`data-scope`**: combobox
**`data-part`**: clear-trigger
**`data-invalid`**: Present when invalid
### Content
#### Props
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
#### Data Attributes
**`data-scope`**: combobox
**`data-part`**: content
**`data-state`**: "open" | "closed"
**`data-placement`**: The placement of the content
### Control
#### Props
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
#### Data Attributes
**`data-scope`**: combobox
**`data-part`**: control
**`data-state`**: "open" | "closed"
**`data-focus`**: Present when focused
**`data-disabled`**: Present when disabled
**`data-invalid`**: Present when invalid
### Input
#### Props
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
#### Data Attributes
**`data-scope`**: combobox
**`data-part`**: input
**`data-invalid`**: Present when invalid
**`data-state`**: "open" | "closed"
### ItemGroupLabel
#### Props
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
### ItemGroup
#### Props
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
### ItemIndicator
#### Props
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
#### Data Attributes
**`data-scope`**: combobox
**`data-part`**: item-indicator
**`data-state`**: "checked" | "unchecked"
### Item
#### Props
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
**`item`**
Type: `any`
Required: false
Default Value: `undefined`
Description: The item to render
**`persistFocus`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Whether hovering outside should clear the highlighted state
#### Data Attributes
**`data-scope`**: combobox
**`data-part`**: item
**`data-highlighted`**: Present when highlighted
**`data-state`**: "checked" | "unchecked"
**`data-disabled`**: Present when disabled
**`data-value`**: The value of the item
### ItemText
#### Props
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
#### Data Attributes
**`data-scope`**: combobox
**`data-part`**: item-text
**`data-state`**: "checked" | "unchecked"
**`data-disabled`**: Present when disabled
**`data-highlighted`**: Present when highlighted
### Label
#### Props
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
#### Data Attributes
**`data-scope`**: combobox
**`data-part`**: label
**`data-readonly`**: Present when read-only
**`data-disabled`**: Present when disabled
**`data-invalid`**: Present when invalid
**`data-focus`**: Present when focused
### List
#### Props
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
### Positioner
#### Props
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
### RootProvider
#### Props
**`value`**
Type: `UseComboboxReturn`
Required: true
Default Value: `undefined`
Description: undefined
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
**`immediate`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Whether to synchronize the present change immediately or defer it to the next frame
**`lazyMount`**
Type: `boolean`
Required: false
Default Value: `false`
Description: Whether to enable lazy mounting
**`onExitComplete`**
Type: `VoidFunction`
Required: false
Default Value: `undefined`
Description: Function called when the animation ends in the closed state
**`present`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Whether the node is present (controlled by the user)
**`unmountOnExit`**
Type: `boolean`
Required: false
Default Value: `false`
Description: Whether to unmount on exit.
### Trigger
#### Props
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
**`focusable`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Whether the trigger is focusable
#### Data Attributes
**`data-scope`**: combobox
**`data-part`**: trigger
**`data-state`**: "open" | "closed"
**`data-invalid`**: Present when invalid
**`data-focusable`**:
**`data-readonly`**: Present when read-only
**`data-disabled`**: Present when disabled
## Accessibility
Complies with the [Combobox WAI-ARIA design pattern](https://www.w3.org/WAI/ARIA/apg/patterns/combobox/).
### Keyboard Support
**`ArrowDown`**
Description: When the combobox is closed, opens the listbox and highlights to the first option.
When the combobox is open, moves focus to the next option.
**`ArrowUp`**
Description: When the combobox is closed, opens the listbox and highlights to the last option.
When the combobox is open, moves focus to the previous option.
**`Home`**
Description: When the combobox is open, moves focus to the first option.
**`End`**
Description: When the combobox is open, moves focus to the last option.
**`Escape`**
Description: Closes the listbox.
**`Enter`**
Description: Selects the highlighted option and closes the combobox.
**`Esc`**
Description: Closes the combobox
# Combobox (SOLID)
## Anatomy
To set up the combobox correctly, you'll need to understand its anatomy and how we name its parts.
> Each part includes a `data-part` attribute to help identify them in the DOM.
## Examples
Learn how to use the `Combobox` component in your project. Let's take a look at the most basic example
```tsx
import { Combobox, createListCollection } from '@ark-ui/solid/combobox'
import { For, createMemo, createSignal } from 'solid-js'
import { Portal } from 'solid-js/web'
const initialItems = ['React', 'Solid', 'Vue']
export const Basic = () => {
const [items, setItems] = createSignal(initialItems)
const collection = createMemo(() => createListCollection({ items: items() }))
const handleInputChange = (details: Combobox.InputValueChangeDetails) => {
setItems(initialItems.filter((item) => item.toLowerCase().includes(details.inputValue.toLowerCase())))
}
return (
FrameworkOpenClearFrameworks
{(item) => (
{item}✓
)}
)
}
```
### Advanced Customization
Extended example that shows usage with complex item objects, including disabled state for certain options.
```tsx
import { Combobox, createListCollection } from '@ark-ui/solid/combobox'
import { For } from 'solid-js'
import { Portal } from 'solid-js/web'
export const Advanced = () => {
const collection = createListCollection({
items: [
{ label: 'React', value: 'react' },
{ label: 'Solid', value: 'solid' },
{ label: 'Vue', value: 'vue' },
{ label: 'Svelte', value: 'svelte', disabled: true },
],
})
return (
FrameworkOpenClearFrameworks
{(item) => (
{item.label}✓
)}
)
}
```
### Using the Field Component
The `Field` component helps manage form-related state and accessibility attributes of a combobox. It includes handling
ARIA labels, helper text, and error text to ensure proper accessibility.
```tsx
import { Combobox, createListCollection } from '@ark-ui/solid/combobox'
import { Field } from '@ark-ui/solid/field'
import { For } from 'solid-js'
export const WithField = (props: Field.RootProps) => {
const collection = createListCollection({ items: ['React', 'Solid', 'Vue'] })
return (
LabelOpenClear
{(item) => (
{item}✓
)}
Additional InfoError Info
)
}
```
### Using the Root Provider
The `RootProvider` component provides a context for the combobox. It accepts the value of the `useCombobox` hook. You
can leverage it to access the component state and methods from outside the combobox.
```tsx
import { Combobox, createListCollection, useCombobox } from '@ark-ui/solid/combobox'
import { For, createMemo, createSignal } from 'solid-js'
import { Portal } from 'solid-js/web'
const initialItems = ['React', 'Solid', 'Vue']
export const RootProvider = () => {
const [items, setItems] = createSignal(initialItems)
const collection = createMemo(() => createListCollection({ items: items() }))
const handleInputChange = (details: Combobox.InputValueChangeDetails) => {
setItems(initialItems.filter((item) => item.toLowerCase().includes(details.inputValue.toLowerCase())))
}
const combobox = useCombobox({ collection: collection(), onInputValueChange: handleInputChange })
return (
<>
FrameworkOpenClearFrameworks
{(item) => (
{item}✓
)}
>
)
}
```
> If you're using the `RootProvider` component, you don't need to use the `Root` component.
## API Reference
### Root
#### Props
**`collection`**
Type: `ListCollection`
Required: true
Default Value: `undefined`
Description: The collection of items
**`allowCustomValue`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Whether to allow typing custom values in the input
**`asChild`**
Type: `(props: ParentProps<'div'>) => Element`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
**`autoFocus`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Whether to autofocus the input on mount
**`closeOnSelect`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Whether to close the combobox when an item is selected.
**`composite`**
Type: `boolean`
Required: false
Default Value: `true`
Description: Whether the combobox is a composed with other composite widgets like tabs
**`defaultHighlightedValue`**
Type: `string`
Required: false
Default Value: `undefined`
Description: The initial highlighted value of the combobox when rendered.
Use when you don't need to control the highlighted value of the combobox.
**`defaultInputValue`**
Type: `string`
Required: false
Default Value: `""`
Description: The initial value of the combobox's input when rendered.
Use when you don't need to control the value of the combobox's input.
**`defaultOpen`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: The initial open state of the combobox when rendered.
Use when you don't need to control the open state of the combobox.
**`defaultValue`**
Type: `string[]`
Required: false
Default Value: `[]`
Description: The initial value of the combobox's selected items when rendered.
Use when you don't need to control the value of the combobox's selected items.
**`disabled`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Whether the combobox is disabled
**`disableLayer`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Whether to disable registering this a dismissable layer
**`form`**
Type: `string`
Required: false
Default Value: `undefined`
Description: The associate form of the combobox.
**`highlightedValue`**
Type: `string`
Required: false
Default Value: `undefined`
Description: The controlled highlighted value of the combobox
**`ids`**
Type: `Partial<{
root: string
label: string
control: string
input: string
content: string
trigger: string
clearTrigger: string
item(id: string, index?: number | undefined): string
positioner: string
itemGroup(id: string | number): string
itemGroupLabel(id: string | number): string
}>`
Required: false
Default Value: `undefined`
Description: The ids of the elements in the combobox. Useful for composition.
**`immediate`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Whether to synchronize the present change immediately or defer it to the next frame
**`inputBehavior`**
Type: `'none' | 'autocomplete' | 'autohighlight'`
Required: false
Default Value: `"none"`
Description: Defines the auto-completion behavior of the combobox.
- `autohighlight`: The first focused item is highlighted as the user types
- `autocomplete`: Navigating the listbox with the arrow keys selects the item and the input is updated
**`inputValue`**
Type: `string`
Required: false
Default Value: `undefined`
Description: The controlled value of the combobox's input
**`invalid`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Whether the combobox is invalid
**`lazyMount`**
Type: `boolean`
Required: false
Default Value: `false`
Description: Whether to enable lazy mounting
**`loopFocus`**
Type: `boolean`
Required: false
Default Value: `true`
Description: Whether to loop the keyboard navigation through the items
**`multiple`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Whether to allow multiple selection.
**Good to know:** When `multiple` is `true`, the `selectionBehavior` is automatically set to `clear`.
It is recommended to render the selected items in a separate container.
**`name`**
Type: `string`
Required: false
Default Value: `undefined`
Description: The `name` attribute of the combobox's input. Useful for form submission
**`navigate`**
Type: `(details: NavigateDetails) => void`
Required: false
Default Value: `undefined`
Description: Function to navigate to the selected item
**`onExitComplete`**
Type: `VoidFunction`
Required: false
Default Value: `undefined`
Description: Function called when the animation ends in the closed state
**`onFocusOutside`**
Type: `(event: FocusOutsideEvent) => void`
Required: false
Default Value: `undefined`
Description: Function called when the focus is moved outside the component
**`onHighlightChange`**
Type: `(details: HighlightChangeDetails) => void`
Required: false
Default Value: `undefined`
Description: Function called when an item is highlighted using the pointer
or keyboard navigation.
**`onInputValueChange`**
Type: `(details: InputValueChangeDetails) => void`
Required: false
Default Value: `undefined`
Description: Function called when the input's value changes
**`onInteractOutside`**
Type: `(event: InteractOutsideEvent) => void`
Required: false
Default Value: `undefined`
Description: Function called when an interaction happens outside the component
**`onOpenChange`**
Type: `(details: OpenChangeDetails) => void`
Required: false
Default Value: `undefined`
Description: Function called when the popup is opened
**`onPointerDownOutside`**
Type: `(event: PointerDownOutsideEvent) => void`
Required: false
Default Value: `undefined`
Description: Function called when the pointer is pressed down outside the component
**`onValueChange`**
Type: `(details: ValueChangeDetails) => void`
Required: false
Default Value: `undefined`
Description: Function called when a new item is selected
**`open`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: The controlled open state of the combobox
**`openOnChange`**
Type: `boolean | ((details: InputValueChangeDetails) => boolean)`
Required: false
Default Value: `true`
Description: Whether to show the combobox when the input value changes
**`openOnClick`**
Type: `boolean`
Required: false
Default Value: `false`
Description: Whether to open the combobox popup on initial click on the input
**`openOnKeyPress`**
Type: `boolean`
Required: false
Default Value: `true`
Description: Whether to open the combobox on arrow key press
**`placeholder`**
Type: `string`
Required: false
Default Value: `undefined`
Description: The placeholder text of the combobox's input
**`positioning`**
Type: `PositioningOptions`
Required: false
Default Value: `{ placement: "bottom-start" }`
Description: The positioning options to dynamically position the menu
**`present`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Whether the node is present (controlled by the user)
**`readOnly`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Whether the combobox is readonly. This puts the combobox in a "non-editable" mode
but the user can still interact with it
**`required`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Whether the combobox is required
**`scrollToIndexFn`**
Type: `(details: ScrollToIndexDetails) => void`
Required: false
Default Value: `undefined`
Description: Function to scroll to a specific index
**`selectionBehavior`**
Type: `'replace' | 'clear' | 'preserve'`
Required: false
Default Value: `"replace"`
Description: The behavior of the combobox input when an item is selected
- `replace`: The selected item string is set as the input value
- `clear`: The input value is cleared
- `preserve`: The input value is preserved
**`translations`**
Type: `IntlTranslations`
Required: false
Default Value: `undefined`
Description: Specifies the localized strings that identifies the accessibility elements and their states
**`unmountOnExit`**
Type: `boolean`
Required: false
Default Value: `false`
Description: Whether to unmount on exit.
**`value`**
Type: `string[]`
Required: false
Default Value: `undefined`
Description: The controlled value of the combobox's selected items
#### Data Attributes
**`data-scope`**: combobox
**`data-part`**: root
**`data-invalid`**: Present when invalid
**`data-readonly`**: Present when read-only
### ClearTrigger
#### Props
**`asChild`**
Type: `(props: ParentProps<'button'>) => Element`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
#### Data Attributes
**`data-scope`**: combobox
**`data-part`**: clear-trigger
**`data-invalid`**: Present when invalid
### Content
#### Props
**`asChild`**
Type: `(props: ParentProps<'div'>) => Element`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
#### Data Attributes
**`data-scope`**: combobox
**`data-part`**: content
**`data-state`**: "open" | "closed"
**`data-placement`**: The placement of the content
### Control
#### Props
**`asChild`**
Type: `(props: ParentProps<'div'>) => Element`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
#### Data Attributes
**`data-scope`**: combobox
**`data-part`**: control
**`data-state`**: "open" | "closed"
**`data-focus`**: Present when focused
**`data-disabled`**: Present when disabled
**`data-invalid`**: Present when invalid
### Input
#### Props
**`asChild`**
Type: `(props: ParentProps<'input'>) => Element`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
#### Data Attributes
**`data-scope`**: combobox
**`data-part`**: input
**`data-invalid`**: Present when invalid
**`data-state`**: "open" | "closed"
### ItemGroupLabel
#### Props
**`asChild`**
Type: `(props: ParentProps<'div'>) => Element`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
### ItemGroup
#### Props
**`asChild`**
Type: `(props: ParentProps<'div'>) => Element`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
### ItemIndicator
#### Props
**`asChild`**
Type: `(props: ParentProps<'div'>) => Element`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
#### Data Attributes
**`data-scope`**: combobox
**`data-part`**: item-indicator
**`data-state`**: "checked" | "unchecked"
### Item
#### Props
**`asChild`**
Type: `(props: ParentProps<'div'>) => Element`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
**`item`**
Type: `any`
Required: false
Default Value: `undefined`
Description: The item to render
**`persistFocus`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Whether hovering outside should clear the highlighted state
#### Data Attributes
**`data-scope`**: combobox
**`data-part`**: item
**`data-highlighted`**: Present when highlighted
**`data-state`**: "checked" | "unchecked"
**`data-disabled`**: Present when disabled
**`data-value`**: The value of the item
### ItemText
#### Props
**`asChild`**
Type: `(props: ParentProps<'span'>) => Element`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
#### Data Attributes
**`data-scope`**: combobox
**`data-part`**: item-text
**`data-state`**: "checked" | "unchecked"
**`data-disabled`**: Present when disabled
**`data-highlighted`**: Present when highlighted
### Label
#### Props
**`asChild`**
Type: `(props: ParentProps<'label'>) => Element`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
#### Data Attributes
**`data-scope`**: combobox
**`data-part`**: label
**`data-readonly`**: Present when read-only
**`data-disabled`**: Present when disabled
**`data-invalid`**: Present when invalid
**`data-focus`**: Present when focused
### List
#### Props
**`asChild`**
Type: `(props: ParentProps<'div'>) => Element`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
### Positioner
#### Props
**`asChild`**
Type: `(props: ParentProps<'div'>) => Element`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
### RootProvider
#### Props
**`value`**
Type: `UseComboboxReturn`
Required: true
Default Value: `undefined`
Description: undefined
**`asChild`**
Type: `(props: ParentProps<'div'>) => Element`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
**`immediate`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Whether to synchronize the present change immediately or defer it to the next frame
**`lazyMount`**
Type: `boolean`
Required: false
Default Value: `false`
Description: Whether to enable lazy mounting
**`onExitComplete`**
Type: `VoidFunction`
Required: false
Default Value: `undefined`
Description: Function called when the animation ends in the closed state
**`present`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Whether the node is present (controlled by the user)
**`unmountOnExit`**
Type: `boolean`
Required: false
Default Value: `false`
Description: Whether to unmount on exit.
### Trigger
#### Props
**`asChild`**
Type: `(props: ParentProps<'button'>) => Element`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
**`focusable`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Whether the trigger is focusable
#### Data Attributes
**`data-scope`**: combobox
**`data-part`**: trigger
**`data-state`**: "open" | "closed"
**`data-invalid`**: Present when invalid
**`data-focusable`**:
**`data-readonly`**: Present when read-only
**`data-disabled`**: Present when disabled
## Accessibility
Complies with the [Combobox WAI-ARIA design pattern](https://www.w3.org/WAI/ARIA/apg/patterns/combobox/).
### Keyboard Support
**`ArrowDown`**
Description: When the combobox is closed, opens the listbox and highlights to the first option.
When the combobox is open, moves focus to the next option.
**`ArrowUp`**
Description: When the combobox is closed, opens the listbox and highlights to the last option.
When the combobox is open, moves focus to the previous option.
**`Home`**
Description: When the combobox is open, moves focus to the first option.
**`End`**
Description: When the combobox is open, moves focus to the last option.
**`Escape`**
Description: Closes the listbox.
**`Enter`**
Description: Selects the highlighted option and closes the combobox.
**`Esc`**
Description: Closes the combobox
# Combobox (VUE)
## Anatomy
To set up the combobox correctly, you'll need to understand its anatomy and how we name its parts.
> Each part includes a `data-part` attribute to help identify them in the DOM.
## Examples
Learn how to use the `Combobox` component in your project. Let's take a look at the most basic example
```vue
FrameworkOpenClearFrameworks{{ item }}✓
```
### Advanced Customization
Extended example that shows usage with complex item objects, including disabled state for certain options.
```vue
FrameworkOpenClearFrameworks{{ item.label }}✓
```
### Using the Field Component
The `Field` component helps manage form-related state and accessibility attributes of a combobox. It includes handling
ARIA labels, helper text, and error text to ensure proper accessibility.
```vue
LabelOpenClearFrameworks{{ item }}✓Additional InfoError Info
```
### Using the Root Provider
The `RootProvider` component provides a context for the combobox. It accepts the value of the `useCombobox` hook. You
can leverage it to access the component state and methods from outside the combobox.
```vue
FrameworkOpenClearFrameworks{{ item }}✓
```
> If you're using the `RootProvider` component, you don't need to use the `Root` component.
## API Reference
### Root
#### Props
**`allowCustomValue`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Whether to allow typing custom values in the input
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
**`autoFocus`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Whether to autofocus the input on mount
**`closeOnSelect`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Whether to close the combobox when an item is selected.
**`collection`**
Type: `ListCollection`
Required: false
Default Value: `undefined`
Description: The collection of items
**`composite`**
Type: `boolean`
Required: false
Default Value: `true`
Description: Whether the combobox is a composed with other composite widgets like tabs
**`defaultHighlightedValue`**
Type: `string`
Required: false
Default Value: `undefined`
Description: The initial highlighted value of the combobox when rendered.
Use when you don't need to control the highlighted value of the combobox.
**`defaultInputValue`**
Type: `string`
Required: false
Default Value: `""`
Description: The initial value of the combobox's input when rendered.
Use when you don't need to control the value of the combobox's input.
**`defaultOpen`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: The initial open state of the combobox when rendered.
Use when you don't need to control the open state of the combobox.
**`defaultValue`**
Type: `string[]`
Required: false
Default Value: `[]`
Description: The initial value of the combobox's selected items when rendered.
Use when you don't need to control the value of the combobox's selected items.
**`disabled`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Whether the combobox is disabled
**`disableLayer`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Whether to disable registering this a dismissable layer
**`form`**
Type: `string`
Required: false
Default Value: `undefined`
Description: The associate form of the combobox.
**`highlightedValue`**
Type: `string`
Required: false
Default Value: `undefined`
Description: The controlled highlighted value of the combobox
**`id`**
Type: `string`
Required: false
Default Value: `undefined`
Description: The unique identifier of the machine.
**`ids`**
Type: `Partial<{
root: string
label: string
control: string
input: string
content: string
trigger: string
clearTrigger: string
item(id: string, index?: number | undefined): string
positioner: string
itemGroup(id: string | number): string
itemGroupLabel(id: string | number): string
}>`
Required: false
Default Value: `undefined`
Description: The ids of the elements in the combobox. Useful for composition.
**`inputBehavior`**
Type: `'autocomplete' | 'none' | 'autohighlight'`
Required: false
Default Value: `"none"`
Description: Defines the auto-completion behavior of the combobox.
- `autohighlight`: The first focused item is highlighted as the user types
- `autocomplete`: Navigating the listbox with the arrow keys selects the item and the input is updated
**`inputValue`**
Type: `string`
Required: false
Default Value: `undefined`
Description: The controlled value of the combobox's input
**`invalid`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Whether the combobox is invalid
**`lazyMount`**
Type: `boolean`
Required: false
Default Value: `false`
Description: Whether to enable lazy mounting
**`loopFocus`**
Type: `boolean`
Required: false
Default Value: `true`
Description: Whether to loop the keyboard navigation through the items
**`modelValue`**
Type: `string[]`
Required: false
Default Value: `undefined`
Description: The v-model value of the combobox
**`multiple`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Whether to allow multiple selection.
**Good to know:** When `multiple` is `true`, the `selectionBehavior` is automatically set to `clear`.
It is recommended to render the selected items in a separate container.
**`name`**
Type: `string`
Required: false
Default Value: `undefined`
Description: The `name` attribute of the combobox's input. Useful for form submission
**`navigate`**
Type: `(details: NavigateDetails) => void`
Required: false
Default Value: `undefined`
Description: Function to navigate to the selected item
**`open`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: The controlled open state of the combobox
**`openOnChange`**
Type: `boolean | ((details: InputValueChangeDetails) => boolean)`
Required: false
Default Value: `true`
Description: Whether to show the combobox when the input value changes
**`openOnClick`**
Type: `boolean`
Required: false
Default Value: `false`
Description: Whether to open the combobox popup on initial click on the input
**`openOnKeyPress`**
Type: `boolean`
Required: false
Default Value: `true`
Description: Whether to open the combobox on arrow key press
**`placeholder`**
Type: `string`
Required: false
Default Value: `undefined`
Description: The placeholder text of the combobox's input
**`positioning`**
Type: `PositioningOptions`
Required: false
Default Value: `{ placement: "bottom-start" }`
Description: The positioning options to dynamically position the menu
**`readOnly`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Whether the combobox is readonly. This puts the combobox in a "non-editable" mode
but the user can still interact with it
**`required`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Whether the combobox is required
**`scrollToIndexFn`**
Type: `(details: ScrollToIndexDetails) => void`
Required: false
Default Value: `undefined`
Description: Function to scroll to a specific index
**`selectionBehavior`**
Type: `'replace' | 'clear' | 'preserve'`
Required: false
Default Value: `"replace"`
Description: The behavior of the combobox input when an item is selected
- `replace`: The selected item string is set as the input value
- `clear`: The input value is cleared
- `preserve`: The input value is preserved
**`translations`**
Type: `IntlTranslations`
Required: false
Default Value: `undefined`
Description: Specifies the localized strings that identifies the accessibility elements and their states
**`unmountOnExit`**
Type: `boolean`
Required: false
Default Value: `false`
Description: Whether to unmount on exit.
#### Data Attributes
**`data-scope`**: combobox
**`data-part`**: root
**`data-invalid`**: Present when invalid
**`data-readonly`**: Present when read-only
### ClearTrigger
#### Props
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
#### Data Attributes
**`data-scope`**: combobox
**`data-part`**: clear-trigger
**`data-invalid`**: Present when invalid
### Content
#### Props
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
#### Data Attributes
**`data-scope`**: combobox
**`data-part`**: content
**`data-state`**: "open" | "closed"
**`data-placement`**: The placement of the content
### Control
#### Props
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
#### Data Attributes
**`data-scope`**: combobox
**`data-part`**: control
**`data-state`**: "open" | "closed"
**`data-focus`**: Present when focused
**`data-disabled`**: Present when disabled
**`data-invalid`**: Present when invalid
### Input
#### Props
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
#### Data Attributes
**`data-scope`**: combobox
**`data-part`**: input
**`data-invalid`**: Present when invalid
**`data-state`**: "open" | "closed"
### ItemGroupLabel
#### Props
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
### ItemGroup
#### Props
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
**`id`**
Type: `string`
Required: false
Default Value: `undefined`
Description: undefined
### ItemIndicator
#### Props
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
#### Data Attributes
**`data-scope`**: combobox
**`data-part`**: item-indicator
**`data-state`**: "checked" | "unchecked"
### Item
#### Props
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
**`item`**
Type: `any`
Required: false
Default Value: `undefined`
Description: The item to render
**`persistFocus`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Whether hovering outside should clear the highlighted state
#### Data Attributes
**`data-scope`**: combobox
**`data-part`**: item
**`data-highlighted`**: Present when highlighted
**`data-state`**: "checked" | "unchecked"
**`data-disabled`**: Present when disabled
**`data-value`**: The value of the item
### ItemText
#### Props
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
#### Data Attributes
**`data-scope`**: combobox
**`data-part`**: item-text
**`data-state`**: "checked" | "unchecked"
**`data-disabled`**: Present when disabled
**`data-highlighted`**: Present when highlighted
### Label
#### Props
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
#### Data Attributes
**`data-scope`**: combobox
**`data-part`**: label
**`data-readonly`**: Present when read-only
**`data-disabled`**: Present when disabled
**`data-invalid`**: Present when invalid
**`data-focus`**: Present when focused
### List
#### Props
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
### Positioner
#### Props
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
### RootProvider
#### Props
**`value`**
Type: `ComboboxApi`
Required: true
Default Value: `undefined`
Description: undefined
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
**`lazyMount`**
Type: `boolean`
Required: false
Default Value: `false`
Description: Whether to enable lazy mounting
**`unmountOnExit`**
Type: `boolean`
Required: false
Default Value: `false`
Description: Whether to unmount on exit.
### Trigger
#### Props
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
**`focusable`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Whether the trigger is focusable
#### Data Attributes
**`data-scope`**: combobox
**`data-part`**: trigger
**`data-state`**: "open" | "closed"
**`data-invalid`**: Present when invalid
**`data-focusable`**:
**`data-readonly`**: Present when read-only
**`data-disabled`**: Present when disabled
## Accessibility
Complies with the [Combobox WAI-ARIA design pattern](https://www.w3.org/WAI/ARIA/apg/patterns/combobox/).
### Keyboard Support
**`ArrowDown`**
Description: When the combobox is closed, opens the listbox and highlights to the first option.
When the combobox is open, moves focus to the next option.
**`ArrowUp`**
Description: When the combobox is closed, opens the listbox and highlights to the last option.
When the combobox is open, moves focus to the previous option.
**`Home`**
Description: When the combobox is open, moves focus to the first option.
**`End`**
Description: When the combobox is open, moves focus to the last option.
**`Escape`**
Description: Closes the listbox.
**`Enter`**
Description: Selects the highlighted option and closes the combobox.
**`Esc`**
Description: Closes the combobox
# Date Picker (REACT)
## Anatomy
To set up the date picker correctly, you'll need to understand its anatomy and how we name its parts.
> Each part includes a `data-part` attribute to help identify them in the DOM.
## Examples
Learn how to use the `DatePicker` component in your project. Let's take a look at the most basic example
```tsx
import { DatePicker } from '@ark-ui/react/date-picker'
import { Portal } from '@ark-ui/react/portal'
export const Basic = () => {
return (
Label📅Clear
{(datePicker) => (
<>
PrevNext
{datePicker.weekDays.map((weekDay, id) => (
{weekDay.short}
))}
{datePicker.weeks.map((week, id) => (
{week.map((day, id) => (
{day.day}
))}
))}
>
)}
{(datePicker) => (
<>
PrevNext
{datePicker.getMonthsGrid({ columns: 4, format: 'short' }).map((months, id) => (
{months.map((month, id) => (
{month.label}
))}
))}
>
)}
{(datePicker) => (
<>
PrevNext
{datePicker.getYearsGrid({ columns: 4 }).map((years, id) => (
{years.map((year, id) => (
{year.label}
))}
))}
>
)}
)
}
```
### Range Selection
To create a Date Picker that allows a range selection, set the `selectionMode` prop to `range`.
```tsx
import { DatePicker } from '@ark-ui/react/date-picker'
export const Range = () => {
return (
Label📅ClearLast 7 days
{(datePicker) => (
<>
PrevNext
{datePicker.weekDays.map((weekDay, id) => (
{weekDay.short}
))}
{datePicker.weeks.map((week, id) => (
{week.map((day, id) => (
{day.day}
))}
))}
>
)}
{(datePicker) => (
<>
PrevNext
{datePicker.getMonthsGrid({ columns: 4, format: 'short' }).map((months, id) => (
{months.map((month, id) => (
{month.label}
))}
))}
>
)}
{(datePicker) => (
<>
PrevNext
{datePicker.getYearsGrid({ columns: 4 }).map((years, id) => (
{years.map((year, id) => (
{year.label}
))}
))}
>
)}
)
}
```
### Standalone Date Picker
In some cases, you might want to display a non-dismissible date picker. This can be achieved by setting the `open` prop
to `true` and `closeOnSelect` prop to `false`.
> Important to note that standalone date picker doesn't use the `Portal`, `Positioner` and `Content` components.
```tsx
import { DatePicker } from '@ark-ui/react/date-picker'
export const Standalone = () => {
return (
{(datePicker) => (
<>
PrevNext
{datePicker.weekDays.map((weekDay, id) => (
{weekDay.short}
))}
{datePicker.weeks.map((week, id) => (
{week.map((day, id) => (
{day.day}
))}
))}
>
)}
{(datePicker) => (
<>
PrevNext
{datePicker.getMonthsGrid({ columns: 4, format: 'short' }).map((months, id) => (
{months.map((month, id) => (
{month.label}
))}
))}
>
)}
{(datePicker) => (
<>
PrevNext
{datePicker.getYearsGrid({ columns: 4 }).map((years, id) => (
{years.map((year, id) => (
{year.label}
))}
))}
>
)}
)
}
```
### Using the Root Provider
The `RootProvider` component provides a context for the date-picker. It accepts the value of the `useDate-picker` hook.
You can leverage it to access the component state and methods from outside the date-picker.
```tsx
import { DatePicker, useDatePicker } from '@ark-ui/react/date-picker'
import { Portal } from '@ark-ui/react/portal'
export const RootProvider = () => {
const datePicker = useDatePicker()
return (
<>
Label📅Clear
{(datePicker) => (
<>
PrevNext
{datePicker.weekDays.map((weekDay, id) => (
{weekDay.short}
))}
{datePicker.weeks.map((week, id) => (
{week.map((day, id) => (
{day.day}
))}
))}
>
)}
{(datePicker) => (
<>
PrevNext
{datePicker.getMonthsGrid({ columns: 4, format: 'short' }).map((months, id) => (
{months.map((month, id) => (
{month.label}
))}
))}
>
)}
{(datePicker) => (
<>
PrevNext
{datePicker.getYearsGrid({ columns: 4 }).map((years, id) => (
{years.map((year, id) => (
{year.label}
))}
))}
>
)}
>
)
}
```
> If you're using the `RootProvider` component, you don't need to use the `Root` component.
## API Reference
### Root
#### Props
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
**`closeOnSelect`**
Type: `boolean`
Required: false
Default Value: `true`
Description: Whether the calendar should close after the date selection is complete.
This is ignored when the selection mode is `multiple`.
**`defaultFocusedValue`**
Type: `DateValue`
Required: false
Default Value: `undefined`
Description: The initial focused date when rendered.
Use when you don't need to control the focused date of the date picker.
**`defaultOpen`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: The initial open state of the date picker when rendered.
Use when you don't need to control the open state of the date picker.
**`defaultValue`**
Type: `DateValue[]`
Required: false
Default Value: `undefined`
Description: The initial selected date(s) when rendered.
Use when you don't need to control the selected date(s) of the date picker.
**`defaultView`**
Type: `DateView`
Required: false
Default Value: `"day"`
Description: The default view of the calendar
**`disabled`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Whether the calendar is disabled.
**`fixedWeeks`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Whether the calendar should have a fixed number of weeks.
This renders the calendar with 6 weeks instead of 5 or 6.
**`focusedValue`**
Type: `DateValue`
Required: false
Default Value: `undefined`
Description: The controlled focused date.
**`format`**
Type: `(date: DateValue, details: LocaleDetails) => string`
Required: false
Default Value: `undefined`
Description: The format of the date to display in the input.
**`id`**
Type: `string`
Required: false
Default Value: `undefined`
Description: The unique identifier of the machine.
**`ids`**
Type: `Partial<{ root: string; label(index: number): string; table(id: string): string; tableHeader(id: string): string; tableBody(id: string): string; tableRow(id: string): string; content: string; ... 10 more ...; positioner: string; }>`
Required: false
Default Value: `undefined`
Description: The ids of the elements in the date picker. Useful for composition.
**`immediate`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Whether to synchronize the present change immediately or defer it to the next frame
**`isDateUnavailable`**
Type: `(date: DateValue, locale: string) => boolean`
Required: false
Default Value: `undefined`
Description: Returns whether a date of the calendar is available.
**`lazyMount`**
Type: `boolean`
Required: false
Default Value: `false`
Description: Whether to enable lazy mounting
**`locale`**
Type: `string`
Required: false
Default Value: `"en-US"`
Description: The locale (BCP 47 language tag) to use when formatting the date.
**`max`**
Type: `DateValue`
Required: false
Default Value: `undefined`
Description: The maximum date that can be selected.
**`maxView`**
Type: `DateView`
Required: false
Default Value: `"year"`
Description: The maximum view of the calendar
**`min`**
Type: `DateValue`
Required: false
Default Value: `undefined`
Description: The minimum date that can be selected.
**`minView`**
Type: `DateView`
Required: false
Default Value: `"day"`
Description: The minimum view of the calendar
**`name`**
Type: `string`
Required: false
Default Value: `undefined`
Description: The `name` attribute of the input element.
**`numOfMonths`**
Type: `number`
Required: false
Default Value: `undefined`
Description: The number of months to display.
**`onExitComplete`**
Type: `VoidFunction`
Required: false
Default Value: `undefined`
Description: Function called when the animation ends in the closed state
**`onFocusChange`**
Type: `(details: FocusChangeDetails) => void`
Required: false
Default Value: `undefined`
Description: Function called when the focused date changes.
**`onOpenChange`**
Type: `(details: OpenChangeDetails) => void`
Required: false
Default Value: `undefined`
Description: Function called when the calendar opens or closes.
**`onValueChange`**
Type: `(details: ValueChangeDetails) => void`
Required: false
Default Value: `undefined`
Description: Function called when the value changes.
**`onViewChange`**
Type: `(details: ViewChangeDetails) => void`
Required: false
Default Value: `undefined`
Description: Function called when the view changes.
**`open`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: The controlled open state of the date picker
**`parse`**
Type: `(value: string, details: LocaleDetails) => DateValue | undefined`
Required: false
Default Value: `undefined`
Description: Function to parse the date from the input back to a DateValue.
**`placeholder`**
Type: `string`
Required: false
Default Value: `undefined`
Description: The placeholder text to display in the input.
**`positioning`**
Type: `PositioningOptions`
Required: false
Default Value: `undefined`
Description: The user provided options used to position the date picker content
**`present`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Whether the node is present (controlled by the user)
**`readOnly`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Whether the calendar is read-only.
**`selectionMode`**
Type: `SelectionMode`
Required: false
Default Value: `"single"`
Description: The selection mode of the calendar.
- `single` - only one date can be selected
- `multiple` - multiple dates can be selected
- `range` - a range of dates can be selected
**`startOfWeek`**
Type: `number`
Required: false
Default Value: `undefined`
Description: The first day of the week.
`0` - Sunday
`1` - Monday
`2` - Tuesday
`3` - Wednesday
`4` - Thursday
`5` - Friday
`6` - Saturday
**`timeZone`**
Type: `string`
Required: false
Default Value: `"UTC"`
Description: The time zone to use
**`translations`**
Type: `IntlTranslations`
Required: false
Default Value: `undefined`
Description: The localized messages to use.
**`unmountOnExit`**
Type: `boolean`
Required: false
Default Value: `false`
Description: Whether to unmount on exit.
**`value`**
Type: `DateValue[]`
Required: false
Default Value: `undefined`
Description: The controlled selected date(s).
**`view`**
Type: `DateView`
Required: false
Default Value: `undefined`
Description: The view of the calendar
#### Data Attributes
**`data-scope`**: date-picker
**`data-part`**: root
**`data-state`**: "open" | "closed"
**`data-disabled`**: Present when disabled
**`data-readonly`**: Present when read-only
### ClearTrigger
#### Props
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
### Content
#### Props
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
#### Data Attributes
**`data-scope`**: date-picker
**`data-part`**: content
**`data-state`**: "open" | "closed"
**`data-placement`**: The placement of the content
### Control
#### Props
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
#### Data Attributes
**`data-scope`**: date-picker
**`data-part`**: control
**`data-disabled`**: Present when disabled
### Input
#### Props
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
**`fixOnBlur`**
Type: `boolean`
Required: false
Default Value: `true`
Description: Whether to fix the input value on blur.
**`index`**
Type: `number`
Required: false
Default Value: `undefined`
Description: The index of the input to focus.
#### Data Attributes
**`data-scope`**: date-picker
**`data-part`**: input
**`data-index`**: The index of the item
**`data-state`**: "open" | "closed"
### Label
#### Props
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
#### Data Attributes
**`data-scope`**: date-picker
**`data-part`**: label
**`data-state`**: "open" | "closed"
**`data-index`**: The index of the item
**`data-disabled`**: Present when disabled
**`data-readonly`**: Present when read-only
### MonthSelect
#### Props
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
### NextTrigger
#### Props
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
#### Data Attributes
**`data-scope`**: date-picker
**`data-part`**: next-trigger
**`data-disabled`**: Present when disabled
### Positioner
#### Props
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
### PresetTrigger
#### Props
**`value`**
Type: `PresetTriggerValue`
Required: true
Default Value: `undefined`
Description: undefined
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
### PrevTrigger
#### Props
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
#### Data Attributes
**`data-scope`**: date-picker
**`data-part`**: prev-trigger
**`data-disabled`**: Present when disabled
### RangeText
#### Props
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
### RootProvider
#### Props
**`value`**
Type: `UseDatePickerReturn`
Required: true
Default Value: `undefined`
Description: undefined
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
**`immediate`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Whether to synchronize the present change immediately or defer it to the next frame
**`lazyMount`**
Type: `boolean`
Required: false
Default Value: `false`
Description: Whether to enable lazy mounting
**`onExitComplete`**
Type: `VoidFunction`
Required: false
Default Value: `undefined`
Description: Function called when the animation ends in the closed state
**`present`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Whether the node is present (controlled by the user)
**`unmountOnExit`**
Type: `boolean`
Required: false
Default Value: `false`
Description: Whether to unmount on exit.
### TableBody
#### Props
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
#### Data Attributes
**`data-scope`**: date-picker
**`data-part`**: table-body
**`data-view`**: The view of the tablebody
**`data-disabled`**: Present when disabled
### TableCell
#### Props
**`value`**
Type: `number | DateValue`
Required: true
Default Value: `undefined`
Description: undefined
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
**`columns`**
Type: `number`
Required: false
Default Value: `undefined`
Description: undefined
**`disabled`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: undefined
**`visibleRange`**
Type: `VisibleRange`
Required: false
Default Value: `undefined`
Description: undefined
### TableCellTrigger
#### Props
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
### TableHead
#### Props
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
#### Data Attributes
**`data-scope`**: date-picker
**`data-part`**: table-head
**`data-view`**: The view of the tablehead
**`data-disabled`**: Present when disabled
### TableHeader
#### Props
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
#### Data Attributes
**`data-scope`**: date-picker
**`data-part`**: table-header
**`data-view`**: The view of the tableheader
**`data-disabled`**: Present when disabled
### Table
#### Props
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
**`columns`**
Type: `number`
Required: false
Default Value: `undefined`
Description: undefined
#### Data Attributes
**`data-scope`**: date-picker
**`data-part`**: table
**`data-columns`**:
**`data-view`**: The view of the table
### TableRow
#### Props
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
#### Data Attributes
**`data-scope`**: date-picker
**`data-part`**: table-row
**`data-disabled`**: Present when disabled
**`data-view`**: The view of the tablerow
### Trigger
#### Props
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
#### Data Attributes
**`data-scope`**: date-picker
**`data-part`**: trigger
**`data-placement`**: The placement of the trigger
**`data-state`**: "open" | "closed"
### ViewControl
#### Props
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
#### Data Attributes
**`data-scope`**: date-picker
**`data-part`**: view-control
**`data-view`**: The view of the viewcontrol
### View
#### Props
**`view`**
Type: `DateView`
Required: true
Default Value: `undefined`
Description: undefined
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
#### Data Attributes
**`data-scope`**: date-picker
**`data-part`**: view
**`data-view`**: The view of the view
### ViewTrigger
#### Props
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
#### Data Attributes
**`data-scope`**: date-picker
**`data-part`**: view-trigger
**`data-view`**: The view of the viewtrigger
### YearSelect
#### Props
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
## Accessibility
### Keyboard Support
**`ArrowLeft`**
Description: Moves focus to the previous day within the current week.
**`ArrowRight`**
Description: Moves focus to the next day within the current week.
**`ArrowUp`**
Description: Moves focus to the same day of the week in the previous week.
**`ArrowDown`**
Description: Moves focus to the same day of the week in the next week.
**`Home`**
Description: Moves focus to the first day of the current month.
**`End`**
Description: Moves focus to the last day of the current month.
**`PageUp`**
Description: Moves focus to the same day of the month in the previous month.
**`PageDown`**
Description: Moves focus to the same day of the month in the next month.
**`Enter`**
Description: Selects the focused date and closes the date picker.
**`Esc`**
Description: Closes the date picker without selecting any date.
# Date Picker (SOLID)
## Anatomy
To set up the date picker correctly, you'll need to understand its anatomy and how we name its parts.
> Each part includes a `data-part` attribute to help identify them in the DOM.
## Examples
Learn how to use the `DatePicker` component in your project. Let's take a look at the most basic example
```tsx
import { DatePicker } from '@ark-ui/solid/date-picker'
import { Index, Portal } from 'solid-js/web'
export const Basic = () => {
return (
Label📅Clear
{(context) => (
<>
PrevNext
{(weekDay) => {weekDay().short}}
{(week) => (
{(day) => (
{day().day}
)}
)}
>
)}
{(context) => (
<>
PrevNext
{(months) => (
{(month) => (
{month().label}
)}
)}
>
)}
{(context) => (
<>
PrevNext
{(years) => (
{(year) => (
{year().label}
)}
)}
>
)}
)
}
```
### Range Selection
To create a Date Picker that allows a range selection, set the `selectionMode` prop to `range`.
```tsx
import { DatePicker } from '@ark-ui/solid/date-picker'
import { Index, createMemo } from 'solid-js'
import { Portal } from 'solid-js/web'
export const Range = () => {
return (
Label📅ClearLast 7 days
)
}
```
### Standalone Date Picker
In some cases, you might want to display a non-dismissible date picker. This can be achieved by setting the `open` prop
to `true` and `closeOnSelect` prop to `false`.
> Important to note that standalone date picker doesn't use the `Portal`, `Positioner` and `Content` components.
```tsx
import { DatePicker } from '@ark-ui/solid/date-picker'
import { Index } from 'solid-js'
export const Standalone = () => {
return (
{(context) => (
<>
PrevNext
{(weekDay) => {weekDay().short}}
{(week) => (
{(day) => (
{day().day}
)}
)}
>
)}
)
}
```
### Using the Root Provider
The `RootProvider` component provides a context for the date-picker. It accepts the value of the `useDate-picker` hook.
You can leverage it to access the component state and methods from outside the date-picker.
```tsx
import { DatePicker, useDatePicker } from '@ark-ui/solid/date-picker'
import { Index, Portal } from 'solid-js/web'
export const RootProvider = () => {
const datePicker = useDatePicker()
return (
<>
Label📅Clear
{(context) => (
<>
PrevNext
{(weekDay) => {weekDay().short}}
{(week) => (
{(day) => (
{day().day}
)}
)}
>
)}
{(context) => (
<>
PrevNext
{(months) => (
{(month) => (
{month().label}
)}
)}
>
)}
{(context) => (
<>
PrevNext
{(years) => (
{(year) => (
{year().label}
)}
)}
>
)}
>
)
}
```
> If you're using the `RootProvider` component, you don't need to use the `Root` component.
## API Reference
### Root
#### Props
**`asChild`**
Type: `(props: ParentProps<'div'>) => Element`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
**`closeOnSelect`**
Type: `boolean`
Required: false
Default Value: `true`
Description: Whether the calendar should close after the date selection is complete.
This is ignored when the selection mode is `multiple`.
**`defaultFocusedValue`**
Type: `DateValue`
Required: false
Default Value: `undefined`
Description: The initial focused date when rendered.
Use when you don't need to control the focused date of the date picker.
**`defaultOpen`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: The initial open state of the date picker when rendered.
Use when you don't need to control the open state of the date picker.
**`defaultValue`**
Type: `DateValue[]`
Required: false
Default Value: `undefined`
Description: The initial selected date(s) when rendered.
Use when you don't need to control the selected date(s) of the date picker.
**`defaultView`**
Type: `DateView`
Required: false
Default Value: `"day"`
Description: The default view of the calendar
**`disabled`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Whether the calendar is disabled.
**`fixedWeeks`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Whether the calendar should have a fixed number of weeks.
This renders the calendar with 6 weeks instead of 5 or 6.
**`focusedValue`**
Type: `DateValue`
Required: false
Default Value: `undefined`
Description: The controlled focused date.
**`format`**
Type: `(date: DateValue, details: LocaleDetails) => string`
Required: false
Default Value: `undefined`
Description: The format of the date to display in the input.
**`ids`**
Type: `Partial<{ root: string; label(index: number): string; table(id: string): string; tableHeader(id: string): string; tableBody(id: string): string; tableRow(id: string): string; content: string; ... 10 more ...; positioner: string; }>`
Required: false
Default Value: `undefined`
Description: The ids of the elements in the date picker. Useful for composition.
**`immediate`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Whether to synchronize the present change immediately or defer it to the next frame
**`isDateUnavailable`**
Type: `(date: DateValue, locale: string) => boolean`
Required: false
Default Value: `undefined`
Description: Returns whether a date of the calendar is available.
**`lazyMount`**
Type: `boolean`
Required: false
Default Value: `false`
Description: Whether to enable lazy mounting
**`locale`**
Type: `string`
Required: false
Default Value: `"en-US"`
Description: The locale (BCP 47 language tag) to use when formatting the date.
**`max`**
Type: `DateValue`
Required: false
Default Value: `undefined`
Description: The maximum date that can be selected.
**`maxView`**
Type: `DateView`
Required: false
Default Value: `"year"`
Description: The maximum view of the calendar
**`min`**
Type: `DateValue`
Required: false
Default Value: `undefined`
Description: The minimum date that can be selected.
**`minView`**
Type: `DateView`
Required: false
Default Value: `"day"`
Description: The minimum view of the calendar
**`name`**
Type: `string`
Required: false
Default Value: `undefined`
Description: The `name` attribute of the input element.
**`numOfMonths`**
Type: `number`
Required: false
Default Value: `undefined`
Description: The number of months to display.
**`onExitComplete`**
Type: `VoidFunction`
Required: false
Default Value: `undefined`
Description: Function called when the animation ends in the closed state
**`onFocusChange`**
Type: `(details: FocusChangeDetails) => void`
Required: false
Default Value: `undefined`
Description: Function called when the focused date changes.
**`onOpenChange`**
Type: `(details: OpenChangeDetails) => void`
Required: false
Default Value: `undefined`
Description: Function called when the calendar opens or closes.
**`onValueChange`**
Type: `(details: ValueChangeDetails) => void`
Required: false
Default Value: `undefined`
Description: Function called when the value changes.
**`onViewChange`**
Type: `(details: ViewChangeDetails) => void`
Required: false
Default Value: `undefined`
Description: Function called when the view changes.
**`open`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: The controlled open state of the date picker
**`parse`**
Type: `(value: string, details: LocaleDetails) => DateValue | undefined`
Required: false
Default Value: `undefined`
Description: Function to parse the date from the input back to a DateValue.
**`placeholder`**
Type: `string`
Required: false
Default Value: `undefined`
Description: The placeholder text to display in the input.
**`positioning`**
Type: `PositioningOptions`
Required: false
Default Value: `undefined`
Description: The user provided options used to position the date picker content
**`present`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Whether the node is present (controlled by the user)
**`readOnly`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Whether the calendar is read-only.
**`selectionMode`**
Type: `SelectionMode`
Required: false
Default Value: `"single"`
Description: The selection mode of the calendar.
- `single` - only one date can be selected
- `multiple` - multiple dates can be selected
- `range` - a range of dates can be selected
**`startOfWeek`**
Type: `number`
Required: false
Default Value: `undefined`
Description: The first day of the week.
`0` - Sunday
`1` - Monday
`2` - Tuesday
`3` - Wednesday
`4` - Thursday
`5` - Friday
`6` - Saturday
**`timeZone`**
Type: `string`
Required: false
Default Value: `"UTC"`
Description: The time zone to use
**`translations`**
Type: `IntlTranslations`
Required: false
Default Value: `undefined`
Description: The localized messages to use.
**`unmountOnExit`**
Type: `boolean`
Required: false
Default Value: `false`
Description: Whether to unmount on exit.
**`value`**
Type: `DateValue[]`
Required: false
Default Value: `undefined`
Description: The controlled selected date(s).
**`view`**
Type: `DateView`
Required: false
Default Value: `undefined`
Description: The view of the calendar
#### Data Attributes
**`data-scope`**: date-picker
**`data-part`**: root
**`data-state`**: "open" | "closed"
**`data-disabled`**: Present when disabled
**`data-readonly`**: Present when read-only
### ClearTrigger
#### Props
**`asChild`**
Type: `(props: ParentProps<'button'>) => Element`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
### Content
#### Props
**`asChild`**
Type: `(props: ParentProps<'div'>) => Element`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
#### Data Attributes
**`data-scope`**: date-picker
**`data-part`**: content
**`data-state`**: "open" | "closed"
**`data-placement`**: The placement of the content
### Control
#### Props
**`asChild`**
Type: `(props: ParentProps<'div'>) => Element`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
#### Data Attributes
**`data-scope`**: date-picker
**`data-part`**: control
**`data-disabled`**: Present when disabled
### Input
#### Props
**`asChild`**
Type: `(props: ParentProps<'input'>) => Element`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
**`fixOnBlur`**
Type: `boolean`
Required: false
Default Value: `true`
Description: Whether to fix the input value on blur.
**`index`**
Type: `number`
Required: false
Default Value: `undefined`
Description: The index of the input to focus.
#### Data Attributes
**`data-scope`**: date-picker
**`data-part`**: input
**`data-index`**: The index of the item
**`data-state`**: "open" | "closed"
### Label
#### Props
**`asChild`**
Type: `(props: ParentProps<'label'>) => Element`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
#### Data Attributes
**`data-scope`**: date-picker
**`data-part`**: label
**`data-state`**: "open" | "closed"
**`data-index`**: The index of the item
**`data-disabled`**: Present when disabled
**`data-readonly`**: Present when read-only
### MonthSelect
#### Props
**`asChild`**
Type: `(props: ParentProps<'select'>) => Element`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
### NextTrigger
#### Props
**`asChild`**
Type: `(props: ParentProps<'button'>) => Element`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
#### Data Attributes
**`data-scope`**: date-picker
**`data-part`**: next-trigger
**`data-disabled`**: Present when disabled
### Positioner
#### Props
**`asChild`**
Type: `(props: ParentProps<'div'>) => Element`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
### PresetTrigger
#### Props
**`value`**
Type: `PresetTriggerValue`
Required: true
Default Value: `undefined`
Description: undefined
**`asChild`**
Type: `(props: ParentProps<'button'>) => Element`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
### PrevTrigger
#### Props
**`asChild`**
Type: `(props: ParentProps<'button'>) => Element`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
#### Data Attributes
**`data-scope`**: date-picker
**`data-part`**: prev-trigger
**`data-disabled`**: Present when disabled
### RangeText
#### Props
**`asChild`**
Type: `(props: ParentProps<'div'>) => Element`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
### RootProvider
#### Props
**`value`**
Type: `UseDatePickerReturn`
Required: true
Default Value: `undefined`
Description: undefined
**`asChild`**
Type: `(props: ParentProps<'div'>) => Element`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
**`immediate`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Whether to synchronize the present change immediately or defer it to the next frame
**`lazyMount`**
Type: `boolean`
Required: false
Default Value: `false`
Description: Whether to enable lazy mounting
**`onExitComplete`**
Type: `VoidFunction`
Required: false
Default Value: `undefined`
Description: Function called when the animation ends in the closed state
**`present`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Whether the node is present (controlled by the user)
**`unmountOnExit`**
Type: `boolean`
Required: false
Default Value: `false`
Description: Whether to unmount on exit.
### TableBody
#### Props
**`asChild`**
Type: `(props: ParentProps<'tbody'>) => Element`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
#### Data Attributes
**`data-scope`**: date-picker
**`data-part`**: table-body
**`data-view`**: The view of the tablebody
**`data-disabled`**: Present when disabled
### TableCell
#### Props
**`value`**
Type: `number | DateValue`
Required: true
Default Value: `undefined`
Description: undefined
**`asChild`**
Type: `(props: ParentProps<'td'>) => Element`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
**`columns`**
Type: `number`
Required: false
Default Value: `undefined`
Description: undefined
**`disabled`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: undefined
**`visibleRange`**
Type: `VisibleRange`
Required: false
Default Value: `undefined`
Description: undefined
### TableCellTrigger
#### Props
**`asChild`**
Type: `(props: ParentProps<'div'>) => Element`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
### TableHead
#### Props
**`asChild`**
Type: `(props: ParentProps<'thead'>) => Element`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
#### Data Attributes
**`data-scope`**: date-picker
**`data-part`**: table-head
**`data-view`**: The view of the tablehead
**`data-disabled`**: Present when disabled
### TableHeader
#### Props
**`asChild`**
Type: `(props: ParentProps<'th'>) => Element`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
#### Data Attributes
**`data-scope`**: date-picker
**`data-part`**: table-header
**`data-view`**: The view of the tableheader
**`data-disabled`**: Present when disabled
### Table
#### Props
**`asChild`**
Type: `(props: ParentProps<'table'>) => Element`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
**`columns`**
Type: `number`
Required: false
Default Value: `undefined`
Description: undefined
#### Data Attributes
**`data-scope`**: date-picker
**`data-part`**: table
**`data-columns`**:
**`data-view`**: The view of the table
### TableRow
#### Props
**`asChild`**
Type: `(props: ParentProps<'tr'>) => Element`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
#### Data Attributes
**`data-scope`**: date-picker
**`data-part`**: table-row
**`data-disabled`**: Present when disabled
**`data-view`**: The view of the tablerow
### Trigger
#### Props
**`asChild`**
Type: `(props: ParentProps<'button'>) => Element`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
#### Data Attributes
**`data-scope`**: date-picker
**`data-part`**: trigger
**`data-placement`**: The placement of the trigger
**`data-state`**: "open" | "closed"
### ViewControl
#### Props
**`asChild`**
Type: `(props: ParentProps<'div'>) => Element`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
#### Data Attributes
**`data-scope`**: date-picker
**`data-part`**: view-control
**`data-view`**: The view of the viewcontrol
### View
#### Props
**`view`**
Type: `DateView`
Required: true
Default Value: `undefined`
Description: undefined
**`asChild`**
Type: `(props: ParentProps<'div'>) => Element`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
#### Data Attributes
**`data-scope`**: date-picker
**`data-part`**: view
**`data-view`**: The view of the view
### ViewTrigger
#### Props
**`asChild`**
Type: `(props: ParentProps<'button'>) => Element`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
#### Data Attributes
**`data-scope`**: date-picker
**`data-part`**: view-trigger
**`data-view`**: The view of the viewtrigger
### YearSelect
#### Props
**`asChild`**
Type: `(props: ParentProps<'select'>) => Element`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
## Accessibility
### Keyboard Support
**`ArrowLeft`**
Description: Moves focus to the previous day within the current week.
**`ArrowRight`**
Description: Moves focus to the next day within the current week.
**`ArrowUp`**
Description: Moves focus to the same day of the week in the previous week.
**`ArrowDown`**
Description: Moves focus to the same day of the week in the next week.
**`Home`**
Description: Moves focus to the first day of the current month.
**`End`**
Description: Moves focus to the last day of the current month.
**`PageUp`**
Description: Moves focus to the same day of the month in the previous month.
**`PageDown`**
Description: Moves focus to the same day of the month in the next month.
**`Enter`**
Description: Selects the focused date and closes the date picker.
**`Esc`**
Description: Closes the date picker without selecting any date.
# Date Picker (VUE)
## Anatomy
To set up the date picker correctly, you'll need to understand its anatomy and how we name its parts.
> Each part includes a `data-part` attribute to help identify them in the DOM.
## Examples
Learn how to use the `DatePicker` component in your project. Let's take a look at the most basic example
```vue
Label📅ClearPrevNext
{{ weekDay.short }}
{{ day.day }}PrevNext{{ month.label }}PrevNext{{ year.label }}
```
### Range Selection
To create a Date Picker that allows a range selection, set the `selectionMode` prop to `range`.
```vue
Label📅ClearLast 7 daysPrevNext
{{ weekDay.short }}
{{ day.day }}PrevNext{{ month.label }}PrevNext{{ year.label }}
```
### Standalone Date Picker
In some cases, you might want to display a non-dismissible date picker. This can be achieved by setting the `open` prop
to `true` and `closeOnSelect` prop to `false`.
> Important to note that standalone date picker doesn't use the `Portal`, `Positioner` and `Content` components.
```vue
PrevNext
{{ weekDay.short }}
{{ day.day }}PrevNext{{ month.label }}PrevNext{{ year.label }}
```
### Using the Root Provider
The `RootProvider` component provides a context for the date-picker. It accepts the value of the `useDate-picker` hook.
You can leverage it to access the component state and methods from outside the date-picker.
```vue
Label📅ClearPrevNext
{{ weekDay.short }}
{{ day.day }}PrevNext{{ month.label }}PrevNext{{ year.label }}
```
> If you're using the `RootProvider` component, you don't need to use the `Root` component.
## API Reference
### Root
#### Props
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
**`closeOnSelect`**
Type: `boolean`
Required: false
Default Value: `true`
Description: Whether the calendar should close after the date selection is complete.
This is ignored when the selection mode is `multiple`.
**`defaultFocusedValue`**
Type: `DateValue`
Required: false
Default Value: `undefined`
Description: The initial focused date when rendered.
Use when you don't need to control the focused date of the date picker.
**`defaultOpen`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: The initial open state of the date picker when rendered.
Use when you don't need to control the open state of the date picker.
**`defaultValue`**
Type: `DateValue[]`
Required: false
Default Value: `undefined`
Description: The initial selected date(s) when rendered.
Use when you don't need to control the selected date(s) of the date picker.
**`defaultView`**
Type: `DateView`
Required: false
Default Value: `"day"`
Description: The default view of the calendar
**`disabled`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Whether the calendar is disabled.
**`fixedWeeks`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Whether the calendar should have a fixed number of weeks.
This renders the calendar with 6 weeks instead of 5 or 6.
**`focusedValue`**
Type: `DateValue`
Required: false
Default Value: `undefined`
Description: The controlled focused date.
**`format`**
Type: `(date: DateValue, details: LocaleDetails) => string`
Required: false
Default Value: `undefined`
Description: The format of the date to display in the input.
**`id`**
Type: `string`
Required: false
Default Value: `undefined`
Description: The unique identifier of the machine.
**`ids`**
Type: `Partial<{ root: string; label(index: number): string; table(id: string): string; tableHeader(id: string): string; tableBody(id: string): string; tableRow(id: string): string; content: string; ... 10 more ...; positioner: string; }>`
Required: false
Default Value: `undefined`
Description: The ids of the elements in the date picker. Useful for composition.
**`isDateUnavailable`**
Type: `(date: DateValue, locale: string) => boolean`
Required: false
Default Value: `undefined`
Description: Returns whether a date of the calendar is available.
**`lazyMount`**
Type: `boolean`
Required: false
Default Value: `false`
Description: Whether to enable lazy mounting
**`locale`**
Type: `string`
Required: false
Default Value: `"en-US"`
Description: The locale (BCP 47 language tag) to use when formatting the date.
**`max`**
Type: `DateValue`
Required: false
Default Value: `undefined`
Description: The maximum date that can be selected.
**`maxView`**
Type: `DateView`
Required: false
Default Value: `"year"`
Description: The maximum view of the calendar
**`min`**
Type: `DateValue`
Required: false
Default Value: `undefined`
Description: The minimum date that can be selected.
**`minView`**
Type: `DateView`
Required: false
Default Value: `"day"`
Description: The minimum view of the calendar
**`modelValue`**
Type: `DateValue[]`
Required: false
Default Value: `undefined`
Description: The v-model value of the date picker
**`name`**
Type: `string`
Required: false
Default Value: `undefined`
Description: The `name` attribute of the input element.
**`numOfMonths`**
Type: `number`
Required: false
Default Value: `undefined`
Description: The number of months to display.
**`open`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: The controlled open state of the date picker
**`parse`**
Type: `(value: string, details: LocaleDetails) => DateValue | undefined`
Required: false
Default Value: `undefined`
Description: Function to parse the date from the input back to a DateValue.
**`placeholder`**
Type: `string`
Required: false
Default Value: `undefined`
Description: The placeholder text to display in the input.
**`positioning`**
Type: `PositioningOptions`
Required: false
Default Value: `undefined`
Description: The user provided options used to position the date picker content
**`readOnly`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Whether the calendar is read-only.
**`selectionMode`**
Type: `SelectionMode`
Required: false
Default Value: `"single"`
Description: The selection mode of the calendar.
- `single` - only one date can be selected
- `multiple` - multiple dates can be selected
- `range` - a range of dates can be selected
**`startOfWeek`**
Type: `number`
Required: false
Default Value: `undefined`
Description: The first day of the week.
`0` - Sunday
`1` - Monday
`2` - Tuesday
`3` - Wednesday
`4` - Thursday
`5` - Friday
`6` - Saturday
**`timeZone`**
Type: `string`
Required: false
Default Value: `"UTC"`
Description: The time zone to use
**`translations`**
Type: `IntlTranslations`
Required: false
Default Value: `undefined`
Description: The localized messages to use.
**`unmountOnExit`**
Type: `boolean`
Required: false
Default Value: `false`
Description: Whether to unmount on exit.
**`view`**
Type: `DateView`
Required: false
Default Value: `undefined`
Description: The view of the calendar
#### Emits
**`focusChange`**
Type: `[details: FocusChangeDetails]`
Description: Function called when the focused date changes.
**`openChange`**
Type: `[details: OpenChangeDetails]`
Description: Function called when the calendar opens or closes.
**`update:focusedValue`**
Type: `[focusedValue: DateValue]`
Description: The callback fired when the focused date changes.
**`update:modelValue`**
Type: `[value: DateValue[]]`
Description: The callback fired when the model value changes.
**`update:open`**
Type: `[open: boolean]`
Description: The callback fired when the open state changes.
**`update:view`**
Type: `[view: DateView]`
Description: The callback fired when the view changes.
**`valueChange`**
Type: `[details: ValueChangeDetails]`
Description: Function called when the value changes.
**`viewChange`**
Type: `[details: ViewChangeDetails]`
Description: Function called when the view changes.
#### Data Attributes
**`data-scope`**: date-picker
**`data-part`**: root
**`data-state`**: "open" | "closed"
**`data-disabled`**: Present when disabled
**`data-readonly`**: Present when read-only
### ClearTrigger
#### Props
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
### Content
#### Props
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
#### Data Attributes
**`data-scope`**: date-picker
**`data-part`**: content
**`data-state`**: "open" | "closed"
**`data-placement`**: The placement of the content
### Control
#### Props
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
#### Data Attributes
**`data-scope`**: date-picker
**`data-part`**: control
**`data-disabled`**: Present when disabled
### Input
#### Props
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
**`fixOnBlur`**
Type: `boolean`
Required: false
Default Value: `true`
Description: Whether to fix the input value on blur.
**`index`**
Type: `number`
Required: false
Default Value: `undefined`
Description: The index of the input to focus.
#### Data Attributes
**`data-scope`**: date-picker
**`data-part`**: input
**`data-index`**: The index of the item
**`data-state`**: "open" | "closed"
### Label
#### Props
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
#### Data Attributes
**`data-scope`**: date-picker
**`data-part`**: label
**`data-state`**: "open" | "closed"
**`data-index`**: The index of the item
**`data-disabled`**: Present when disabled
**`data-readonly`**: Present when read-only
### MonthSelect
#### Props
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
### NextTrigger
#### Props
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
#### Data Attributes
**`data-scope`**: date-picker
**`data-part`**: next-trigger
**`data-disabled`**: Present when disabled
### Positioner
#### Props
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
### PresetTrigger
#### Props
**`value`**
Type: `PresetTriggerValue`
Required: true
Default Value: `undefined`
Description: undefined
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
### PrevTrigger
#### Props
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
#### Data Attributes
**`data-scope`**: date-picker
**`data-part`**: prev-trigger
**`data-disabled`**: Present when disabled
### RangeText
#### Props
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
### RootProvider
#### Props
**`value`**
Type: `DatePickerApi`
Required: true
Default Value: `undefined`
Description: undefined
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
**`lazyMount`**
Type: `boolean`
Required: false
Default Value: `false`
Description: Whether to enable lazy mounting
**`unmountOnExit`**
Type: `boolean`
Required: false
Default Value: `false`
Description: Whether to unmount on exit.
### TableBody
#### Props
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
#### Data Attributes
**`data-scope`**: date-picker
**`data-part`**: table-body
**`data-view`**: The view of the tablebody
**`data-disabled`**: Present when disabled
### TableCell
#### Props
**`value`**
Type: `Reactive`
Required: true
Default Value: `undefined`
Description: undefined
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
**`columns`**
Type: `number`
Required: false
Default Value: `undefined`
Description: undefined
**`disabled`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: undefined
**`visibleRange`**
Type: `VisibleRange`
Required: false
Default Value: `undefined`
Description: undefined
### TableCellTrigger
#### Props
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
### TableHead
#### Props
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
#### Data Attributes
**`data-scope`**: date-picker
**`data-part`**: table-head
**`data-view`**: The view of the tablehead
**`data-disabled`**: Present when disabled
### TableHeader
#### Props
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
#### Data Attributes
**`data-scope`**: date-picker
**`data-part`**: table-header
**`data-view`**: The view of the tableheader
**`data-disabled`**: Present when disabled
### Table
#### Props
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
**`columns`**
Type: `number`
Required: false
Default Value: `undefined`
Description: undefined
**`id`**
Type: `string`
Required: false
Default Value: `undefined`
Description: undefined
**`view`**
Type: `DateView`
Required: false
Default Value: `undefined`
Description: undefined
#### Data Attributes
**`data-scope`**: date-picker
**`data-part`**: table
**`data-columns`**:
**`data-view`**: The view of the table
### TableRow
#### Props
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
#### Data Attributes
**`data-scope`**: date-picker
**`data-part`**: table-row
**`data-disabled`**: Present when disabled
**`data-view`**: The view of the tablerow
### Trigger
#### Props
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
#### Data Attributes
**`data-scope`**: date-picker
**`data-part`**: trigger
**`data-placement`**: The placement of the trigger
**`data-state`**: "open" | "closed"
### ViewControl
#### Props
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
#### Data Attributes
**`data-scope`**: date-picker
**`data-part`**: view-control
**`data-view`**: The view of the viewcontrol
### View
#### Props
**`view`**
Type: `DateView`
Required: true
Default Value: `undefined`
Description: undefined
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
#### Data Attributes
**`data-scope`**: date-picker
**`data-part`**: view
**`data-view`**: The view of the view
### ViewTrigger
#### Props
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
#### Data Attributes
**`data-scope`**: date-picker
**`data-part`**: view-trigger
**`data-view`**: The view of the viewtrigger
### YearSelect
#### Props
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
## Accessibility
### Keyboard Support
**`ArrowLeft`**
Description: Moves focus to the previous day within the current week.
**`ArrowRight`**
Description: Moves focus to the next day within the current week.
**`ArrowUp`**
Description: Moves focus to the same day of the week in the previous week.
**`ArrowDown`**
Description: Moves focus to the same day of the week in the next week.
**`Home`**
Description: Moves focus to the first day of the current month.
**`End`**
Description: Moves focus to the last day of the current month.
**`PageUp`**
Description: Moves focus to the same day of the month in the previous month.
**`PageDown`**
Description: Moves focus to the same day of the month in the next month.
**`Enter`**
Description: Selects the focused date and closes the date picker.
**`Esc`**
Description: Closes the date picker without selecting any date.
# Dialog (REACT)
## Anatomy
To use the dialog component correctly, you'll need to understand its anatomy and how we name its parts.
> Each part includes a `data-part` attribute to help identify them in the DOM.
## Examples
Learn how to use the `Dialog` component in your project. Let's take a look at the most basic example
```tsx
import { Dialog } from '@ark-ui/react/dialog'
import { Portal } from '@ark-ui/react/portal'
export const Basic = () => (
Open DialogDialog TitleDialog DescriptionClose
)
```
### Controlled Dialog
To create a controlled Dialog component, manage the state of the dialog using the `open` and `onOpenChange` props:
```tsx
import { Dialog } from '@ark-ui/react/dialog'
import { Portal } from '@ark-ui/react/portal'
import { useState } from 'react'
export const Controlled = () => {
const [isOpen, setIsOpen] = useState(false)
return (
<>
setIsOpen(e.open)}>
Dialog TitleDialog DescriptionClose
>
)
}
```
### Lazy Mounting
Lazy mounting is a feature that allows the content of a dialog to be rendered only when the dialog is first opened. This
is useful for performance optimization, especially when dialog content is large or complex. To enable lazy mounting, use
the `lazyMount` prop on the `Dialog.Root` component.
In addition, the `unmountOnExit` prop can be used in conjunction with `lazyMount` to unmount the dialog content when the
Dialog is closed, freeing up resources. The next time the dialog is activated, its content will be re-rendered.
```tsx
import { Dialog } from '@ark-ui/react/dialog'
import { Portal } from '@ark-ui/react/portal'
export const LazyMount = () => (
console.log('onExitComplete invoked')}>
Open DialogDialog TitleDialog DescriptionClose
)
```
### Using Render Function
The Dialog component supports the use of a render function as a child for more control. This allows access to dialog
states like `isOpen`:
```tsx
import { Dialog } from '@ark-ui/react/dialog'
import { Portal } from '@ark-ui/react/portal'
export const RenderFn = () => (
Open DialogDialog TitleDialog DescriptionClose{(dialog) =>
Dialog is {dialog.open ? 'open' : 'closed'}
}
)
```
### Using the Root Provider
The `RootProvider` component provides a context for the dialog. It accepts the value of the `useDialog` hook. You can
leverage it to access the component state and methods from outside the dialog.
```tsx
import { Dialog, useDialog } from '@ark-ui/react/dialog'
import { Portal } from '@ark-ui/react/portal'
export const RootProvider = () => {
const dialog = useDialog()
return (
<>
Open DialogDialog TitleDialog DescriptionClose
>
)
}
```
> If you're using the `RootProvider` component, you don't need to use the `Root` component.
## API Reference
### Root
#### Props
**`aria-label`**
Type: `string`
Required: false
Default Value: `undefined`
Description: Human readable label for the dialog, in event the dialog title is not rendered
**`closeOnEscape`**
Type: `boolean`
Required: false
Default Value: `true`
Description: Whether to close the dialog when the escape key is pressed
**`closeOnInteractOutside`**
Type: `boolean`
Required: false
Default Value: `true`
Description: Whether to close the dialog when the outside is clicked
**`defaultOpen`**
Type: `boolean`
Required: false
Default Value: `false`
Description: The initial open state of the dialog when rendered.
Use when you don't need to control the open state of the dialog.
**`finalFocusEl`**
Type: `() => MaybeElement`
Required: false
Default Value: `undefined`
Description: Element to receive focus when the dialog is closed
**`id`**
Type: `string`
Required: false
Default Value: `undefined`
Description: The unique identifier of the machine.
**`ids`**
Type: `Partial<{
trigger: string
positioner: string
backdrop: string
content: string
closeTrigger: string
title: string
description: string
}>`
Required: false
Default Value: `undefined`
Description: The ids of the elements in the dialog. Useful for composition.
**`immediate`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Whether to synchronize the present change immediately or defer it to the next frame
**`initialFocusEl`**
Type: `() => MaybeElement`
Required: false
Default Value: `undefined`
Description: Element to receive focus when the dialog is opened
**`lazyMount`**
Type: `boolean`
Required: false
Default Value: `false`
Description: Whether to enable lazy mounting
**`modal`**
Type: `boolean`
Required: false
Default Value: `true`
Description: Whether to prevent pointer interaction outside the element and hide all content below it
**`onEscapeKeyDown`**
Type: `(event: KeyboardEvent) => void`
Required: false
Default Value: `undefined`
Description: Function called when the escape key is pressed
**`onExitComplete`**
Type: `VoidFunction`
Required: false
Default Value: `undefined`
Description: Function called when the animation ends in the closed state
**`onFocusOutside`**
Type: `(event: FocusOutsideEvent) => void`
Required: false
Default Value: `undefined`
Description: Function called when the focus is moved outside the component
**`onInteractOutside`**
Type: `(event: InteractOutsideEvent) => void`
Required: false
Default Value: `undefined`
Description: Function called when an interaction happens outside the component
**`onOpenChange`**
Type: `(details: OpenChangeDetails) => void`
Required: false
Default Value: `undefined`
Description: Function to call when the dialog's open state changes
**`onPointerDownOutside`**
Type: `(event: PointerDownOutsideEvent) => void`
Required: false
Default Value: `undefined`
Description: Function called when the pointer is pressed down outside the component
**`open`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: The controlled open state of the dialog
**`persistentElements`**
Type: `(() => Element | null)[]`
Required: false
Default Value: `undefined`
Description: Returns the persistent elements that:
- should not have pointer-events disabled
- should not trigger the dismiss event
**`present`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Whether the node is present (controlled by the user)
**`preventScroll`**
Type: `boolean`
Required: false
Default Value: `true`
Description: Whether to prevent scrolling behind the dialog when it's opened
**`restoreFocus`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Whether to restore focus to the element that had focus before the dialog was opened
**`role`**
Type: `'dialog' | 'alertdialog'`
Required: false
Default Value: `"dialog"`
Description: The dialog's role
**`trapFocus`**
Type: `boolean`
Required: false
Default Value: `true`
Description: Whether to trap focus inside the dialog when it's opened
**`unmountOnExit`**
Type: `boolean`
Required: false
Default Value: `false`
Description: Whether to unmount on exit.
### Backdrop
#### Props
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
#### Data Attributes
**`data-scope`**: dialog
**`data-part`**: backdrop
**`data-state`**: "open" | "closed"
### CloseTrigger
#### Props
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
### Content
#### Props
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
#### Data Attributes
**`data-scope`**: dialog
**`data-part`**: content
**`data-state`**: "open" | "closed"
### Description
#### Props
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
### Positioner
#### Props
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
### RootProvider
#### Props
**`value`**
Type: `UseDialogReturn`
Required: true
Default Value: `undefined`
Description: undefined
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
**`immediate`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Whether to synchronize the present change immediately or defer it to the next frame
**`lazyMount`**
Type: `boolean`
Required: false
Default Value: `false`
Description: Whether to enable lazy mounting
**`onExitComplete`**
Type: `VoidFunction`
Required: false
Default Value: `undefined`
Description: Function called when the animation ends in the closed state
**`present`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Whether the node is present (controlled by the user)
**`unmountOnExit`**
Type: `boolean`
Required: false
Default Value: `false`
Description: Whether to unmount on exit.
### Title
#### Props
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
### Trigger
#### Props
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
#### Data Attributes
**`data-scope`**: dialog
**`data-part`**: trigger
**`data-state`**: "open" | "closed"
## Accessibility
Complies with the [Dialog WAI-ARIA design pattern](https://www.w3.org/WAI/ARIA/apg/patterns/dialog-modal/).
### Keyboard Support
**`Enter`**
Description: When focus is on the trigger, opens the dialog.
**`Tab`**
Description: Moves focus to the next focusable element within the content. Focus is trapped within the dialog.
**`Shift + Tab`**
Description: Moves focus to the previous focusable element. Focus is trapped within the dialog.
**`Esc`**
Description: Closes the dialog and moves focus to trigger or the defined final focus element
# Dialog (SOLID)
## Anatomy
To use the dialog component correctly, you'll need to understand its anatomy and how we name its parts.
> Each part includes a `data-part` attribute to help identify them in the DOM.
## Examples
Learn how to use the `Dialog` component in your project. Let's take a look at the most basic example
```tsx
import { Dialog } from '@ark-ui/solid/dialog'
import { Portal } from 'solid-js/web'
export const Basic = () => {
return (
Open DialogDialog TitleDialog DescriptionClose
)
}
```
### Controlled Dialog
To create a controlled Dialog component, manage the state of the dialog using the `open` and `onOpenChange` props:
```tsx
import { Dialog } from '@ark-ui/solid/dialog'
import { createSignal } from 'solid-js'
import { Portal } from 'solid-js/web'
export const Controlled = () => {
const [open, setOpen] = createSignal(false)
return (
<>
setOpen(false)}>
Dialog TitleDialog DescriptionClose
>
)
}
```
### Lazy Mounting
Lazy mounting is a feature that allows the content of a dialog to be rendered only when the dialog is first opened. This
is useful for performance optimization, especially when dialog content is large or complex. To enable lazy mounting, use
the `lazyMount` prop on the `Dialog.Root` component.
In addition, the `unmountOnExit` prop can be used in conjunction with `lazyMount` to unmount the dialog content when the
Dialog is closed, freeing up resources. The next time the dialog is activated, its content will be re-rendered.
```tsx
import { Dialog } from '@ark-ui/solid/dialog'
export const LazyMount = () => {
return (
Open DialogDialog TitleDialog DescriptionClose
)
}
```
### Using Render Function
The Dialog component supports the use of a render function as a child for more control. This allows access to dialog
states like `isOpen`:
```tsx
import { Dialog } from '@ark-ui/solid/dialog'
import { Portal } from 'solid-js/web'
export const RenderFn = () => {
return (
Open DialogDialog TitleDialog DescriptionClose{(context) =>
Dialog is {context().open ? 'open' : 'closed'}
}
)
}
```
### Using the Root Provider
The `RootProvider` component provides a context for the dialog. It accepts the value of the `useDialog` hook. You can
leverage it to access the component state and methods from outside the dialog.
```tsx
import { Dialog, useDialog } from '@ark-ui/solid/dialog'
import { Portal } from 'solid-js/web'
export const RootProvider = () => {
const dialog = useDialog()
return (
<>
Open DialogDialog TitleDialog DescriptionClose
>
)
}
```
> If you're using the `RootProvider` component, you don't need to use the `Root` component.
## API Reference
### Root
#### Props
**`aria-label`**
Type: `string`
Required: false
Default Value: `undefined`
Description: Human readable label for the dialog, in event the dialog title is not rendered
**`closeOnEscape`**
Type: `boolean`
Required: false
Default Value: `true`
Description: Whether to close the dialog when the escape key is pressed
**`closeOnInteractOutside`**
Type: `boolean`
Required: false
Default Value: `true`
Description: Whether to close the dialog when the outside is clicked
**`defaultOpen`**
Type: `boolean`
Required: false
Default Value: `false`
Description: The initial open state of the dialog when rendered.
Use when you don't need to control the open state of the dialog.
**`finalFocusEl`**
Type: `() => MaybeElement`
Required: false
Default Value: `undefined`
Description: Element to receive focus when the dialog is closed
**`id`**
Type: `string`
Required: false
Default Value: `undefined`
Description: The unique identifier of the machine.
**`ids`**
Type: `Partial<{
trigger: string
positioner: string
backdrop: string
content: string
closeTrigger: string
title: string
description: string
}>`
Required: false
Default Value: `undefined`
Description: The ids of the elements in the dialog. Useful for composition.
**`immediate`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Whether to synchronize the present change immediately or defer it to the next frame
**`initialFocusEl`**
Type: `() => MaybeElement`
Required: false
Default Value: `undefined`
Description: Element to receive focus when the dialog is opened
**`lazyMount`**
Type: `boolean`
Required: false
Default Value: `false`
Description: Whether to enable lazy mounting
**`modal`**
Type: `boolean`
Required: false
Default Value: `true`
Description: Whether to prevent pointer interaction outside the element and hide all content below it
**`onEscapeKeyDown`**
Type: `(event: KeyboardEvent) => void`
Required: false
Default Value: `undefined`
Description: Function called when the escape key is pressed
**`onExitComplete`**
Type: `VoidFunction`
Required: false
Default Value: `undefined`
Description: Function called when the animation ends in the closed state
**`onFocusOutside`**
Type: `(event: FocusOutsideEvent) => void`
Required: false
Default Value: `undefined`
Description: Function called when the focus is moved outside the component
**`onInteractOutside`**
Type: `(event: InteractOutsideEvent) => void`
Required: false
Default Value: `undefined`
Description: Function called when an interaction happens outside the component
**`onOpenChange`**
Type: `(details: OpenChangeDetails) => void`
Required: false
Default Value: `undefined`
Description: Function to call when the dialog's open state changes
**`onPointerDownOutside`**
Type: `(event: PointerDownOutsideEvent) => void`
Required: false
Default Value: `undefined`
Description: Function called when the pointer is pressed down outside the component
**`open`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: The controlled open state of the dialog
**`persistentElements`**
Type: `(() => Element | null)[]`
Required: false
Default Value: `undefined`
Description: Returns the persistent elements that:
- should not have pointer-events disabled
- should not trigger the dismiss event
**`present`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Whether the node is present (controlled by the user)
**`preventScroll`**
Type: `boolean`
Required: false
Default Value: `true`
Description: Whether to prevent scrolling behind the dialog when it's opened
**`restoreFocus`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Whether to restore focus to the element that had focus before the dialog was opened
**`role`**
Type: `'dialog' | 'alertdialog'`
Required: false
Default Value: `"dialog"`
Description: The dialog's role
**`trapFocus`**
Type: `boolean`
Required: false
Default Value: `true`
Description: Whether to trap focus inside the dialog when it's opened
**`unmountOnExit`**
Type: `boolean`
Required: false
Default Value: `false`
Description: Whether to unmount on exit.
### Backdrop
#### Props
**`asChild`**
Type: `(props: ParentProps<'div'>) => Element`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
#### Data Attributes
**`data-scope`**: dialog
**`data-part`**: backdrop
**`data-state`**: "open" | "closed"
### CloseTrigger
#### Props
**`asChild`**
Type: `(props: ParentProps<'button'>) => Element`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
### Content
#### Props
**`asChild`**
Type: `(props: ParentProps<'div'>) => Element`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
#### Data Attributes
**`data-scope`**: dialog
**`data-part`**: content
**`data-state`**: "open" | "closed"
### Description
#### Props
**`asChild`**
Type: `(props: ParentProps<'div'>) => Element`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
### Positioner
#### Props
**`asChild`**
Type: `(props: ParentProps<'div'>) => Element`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
### RootProvider
#### Props
**`value`**
Type: `UseDialogReturn`
Required: true
Default Value: `undefined`
Description: undefined
**`immediate`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Whether to synchronize the present change immediately or defer it to the next frame
**`lazyMount`**
Type: `boolean`
Required: false
Default Value: `false`
Description: Whether to enable lazy mounting
**`onExitComplete`**
Type: `VoidFunction`
Required: false
Default Value: `undefined`
Description: Function called when the animation ends in the closed state
**`present`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Whether the node is present (controlled by the user)
**`unmountOnExit`**
Type: `boolean`
Required: false
Default Value: `false`
Description: Whether to unmount on exit.
### Title
#### Props
**`asChild`**
Type: `(props: ParentProps<'h2'>) => Element`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
### Trigger
#### Props
**`asChild`**
Type: `(props: ParentProps<'button'>) => Element`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
#### Data Attributes
**`data-scope`**: dialog
**`data-part`**: trigger
**`data-state`**: "open" | "closed"
## Accessibility
Complies with the [Dialog WAI-ARIA design pattern](https://www.w3.org/WAI/ARIA/apg/patterns/dialog-modal/).
### Keyboard Support
**`Enter`**
Description: When focus is on the trigger, opens the dialog.
**`Tab`**
Description: Moves focus to the next focusable element within the content. Focus is trapped within the dialog.
**`Shift + Tab`**
Description: Moves focus to the previous focusable element. Focus is trapped within the dialog.
**`Esc`**
Description: Closes the dialog and moves focus to trigger or the defined final focus element
# Dialog (VUE)
## Anatomy
To use the dialog component correctly, you'll need to understand its anatomy and how we name its parts.
> Each part includes a `data-part` attribute to help identify them in the DOM.
## Examples
Learn how to use the `Dialog` component in your project. Let's take a look at the most basic example
```vue
Open DialogDialog TitleDialog DescriptionClose
```
### Controlled Dialog
To create a controlled Dialog component, manage the state of the dialog using the `open` and `onOpenChange` props:
```vue
Dialog TitleDialog DescriptionClose
```
### Lazy Mounting
Lazy mounting is a feature that allows the content of a dialog to be rendered only when the dialog is first opened. This
is useful for performance optimization, especially when dialog content is large or complex. To enable lazy mounting, use
the `lazyMount` prop on the `Dialog.Root` component.
In addition, the `unmountOnExit` prop can be used in conjunction with `lazyMount` to unmount the dialog content when the
Dialog is closed, freeing up resources. The next time the dialog is activated, its content will be re-rendered.
```vue
Open DialogDialog TitleDialog DescriptionClose
```
### Using Render Function
The Dialog component supports the use of a render function as a child for more control. This allows access to dialog
states like `isOpen`:
```vue
Open DialogDialog TitleDialog DescriptionClose
Dialog is {{ dialog.open ? 'open' : 'closed' }}
```
### Using the Root Provider
The `RootProvider` component provides a context for the dialog. It accepts the value of the `useDialog` hook. You can
leverage it to access the component state and methods from outside the dialog.
```vue
Open DialogDialog TitleDialog DescriptionClose
```
> If you're using the `RootProvider` component, you don't need to use the `Root` component.
## API Reference
### Root
#### Props
**`aria-label`**
Type: `string`
Required: false
Default Value: `undefined`
Description: Human readable label for the dialog, in event the dialog title is not rendered
**`closeOnEscape`**
Type: `boolean`
Required: false
Default Value: `true`
Description: Whether to close the dialog when the escape key is pressed
**`closeOnInteractOutside`**
Type: `boolean`
Required: false
Default Value: `true`
Description: Whether to close the dialog when the outside is clicked
**`defaultOpen`**
Type: `boolean`
Required: false
Default Value: `false`
Description: The initial open state of the dialog when rendered.
Use when you don't need to control the open state of the dialog.
**`finalFocusEl`**
Type: `() => HTMLElement | null`
Required: false
Default Value: `undefined`
Description: Element to receive focus when the dialog is closed
**`id`**
Type: `string`
Required: false
Default Value: `undefined`
Description: The unique identifier of the machine.
**`ids`**
Type: `Partial<{
trigger: string
positioner: string
backdrop: string
content: string
closeTrigger: string
title: string
description: string
}>`
Required: false
Default Value: `undefined`
Description: The ids of the elements in the dialog. Useful for composition.
**`initialFocusEl`**
Type: `() => HTMLElement | null`
Required: false
Default Value: `undefined`
Description: Element to receive focus when the dialog is opened
**`lazyMount`**
Type: `boolean`
Required: false
Default Value: `false`
Description: Whether to enable lazy mounting
**`modal`**
Type: `boolean`
Required: false
Default Value: `true`
Description: Whether to prevent pointer interaction outside the element and hide all content below it
**`open`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: The controlled open state of the dialog
**`persistentElements`**
Type: `(() => Element | null)[]`
Required: false
Default Value: `undefined`
Description: Returns the persistent elements that:
- should not have pointer-events disabled
- should not trigger the dismiss event
**`preventScroll`**
Type: `boolean`
Required: false
Default Value: `true`
Description: Whether to prevent scrolling behind the dialog when it's opened
**`restoreFocus`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Whether to restore focus to the element that had focus before the dialog was opened
**`role`**
Type: `'dialog' | 'alertdialog'`
Required: false
Default Value: `"dialog"`
Description: The dialog's role
**`trapFocus`**
Type: `boolean`
Required: false
Default Value: `true`
Description: Whether to trap focus inside the dialog when it's opened
**`unmountOnExit`**
Type: `boolean`
Required: false
Default Value: `false`
Description: Whether to unmount on exit.
#### Emits
**`escapeKeyDown`**
Type: `[event: KeyboardEvent]`
Description: Function called when the escape key is pressed
**`focusOutside`**
Type: `[event: FocusOutsideEvent]`
Description: Function called when the focus is moved outside the component
**`interactOutside`**
Type: `[event: InteractOutsideEvent]`
Description: Function called when an interaction happens outside the component
**`openChange`**
Type: `[details: OpenChangeDetails]`
Description: Function to call when the dialog's open state changes
**`pointerDownOutside`**
Type: `[event: PointerDownOutsideEvent]`
Description: Function called when the pointer is pressed down outside the component
**`update:open`**
Type: `[open: boolean]`
Description: The callback fired when the open state changes.
### Backdrop
#### Props
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
#### Data Attributes
**`data-scope`**: dialog
**`data-part`**: backdrop
**`data-state`**: "open" | "closed"
### CloseTrigger
#### Props
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
### Content
#### Props
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
#### Data Attributes
**`data-scope`**: dialog
**`data-part`**: content
**`data-state`**: "open" | "closed"
### Description
#### Props
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
### Positioner
#### Props
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
### RootProvider
#### Props
**`value`**
Type: `DialogApi`
Required: true
Default Value: `undefined`
Description: undefined
**`lazyMount`**
Type: `boolean`
Required: false
Default Value: `false`
Description: Whether to enable lazy mounting
**`unmountOnExit`**
Type: `boolean`
Required: false
Default Value: `false`
Description: Whether to unmount on exit.
### Title
#### Props
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
### Trigger
#### Props
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
#### Data Attributes
**`data-scope`**: dialog
**`data-part`**: trigger
**`data-state`**: "open" | "closed"
## Accessibility
Complies with the [Dialog WAI-ARIA design pattern](https://www.w3.org/WAI/ARIA/apg/patterns/dialog-modal/).
### Keyboard Support
**`Enter`**
Description: When focus is on the trigger, opens the dialog.
**`Tab`**
Description: Moves focus to the next focusable element within the content. Focus is trapped within the dialog.
**`Shift + Tab`**
Description: Moves focus to the previous focusable element. Focus is trapped within the dialog.
**`Esc`**
Description: Closes the dialog and moves focus to trigger or the defined final focus element
# Editable (REACT)
## Anatomy
To set up the editable correctly, you'll need to understand its anatomy and how we name its parts.
> Each part includes a `data-part` attribute to help identify them in the DOM.
## Examples
Learn how to use the `Editable` component in your project. Let's take a look at the most basic example:
```tsx
import { Editable } from '@ark-ui/react/editable'
export const Basic = () => (
Label
)
```
### Using custom controls
In some cases, you might need to use custom controls to toggle the edit and read mode. We use the render prop pattern to
provide access to the internal state of the component.
```tsx
import { Editable } from '@ark-ui/react/editable'
export const CustomControls = () => (
Label
{(editable) => (
{editable.editing ? (
<>
SaveCancel
>
) : (
Edit
)}
)}
)
```
### Auto-resizing the editable
To auto-grow the editable as the content changes, set the `autoResize` prop to `true`.
```tsx
{/*...*/}
```
### Setting a maxWidth
It is a common pattern to set a maximum of the editable as it auto-grows. To achieve this, set the `maxWidth` prop to
the desired value.
```tsx
{/*...*/}
```
### Editing with double click
The editable supports two modes of activating the "edit" state:
- when the preview part is focused (with pointer or keyboard).
- when the preview part is double-clicked.
To change the mode to double-click, pass the prop `activationMode="dblclick"`.
```tsx
{/*...*/}
```
### Using the Field Component
The `Field` component helps manage form-related state and accessibility attributes of an editable. It includes handling
ARIA labels, helper text, and error text to ensure proper accessibility.
```tsx
import { Editable } from '@ark-ui/react/editable'
import { Field } from '@ark-ui/react/field'
export const WithField = (props: Field.RootProps) => (
LabelAdditional InfoError Info
)
```
### Using the Root Provider
The `RootProvider` component provides a context for the editable. It accepts the value of the `useEditable` hook. You
can leverage it to access the component state and methods from outside the editable.
```tsx
import { Editable, useEditable } from '@ark-ui/react/editable'
export const RootProvider = () => {
const editable = useEditable({ placeholder: 'Placeholder' })
return (
<>
Label
>
)
}
```
> If you're using the `RootProvider` component, you don't need to use the `Root` component.
## API Reference
### Root
#### Props
**`activationMode`**
Type: `ActivationMode`
Required: false
Default Value: `"focus"`
Description: The activation mode for the preview element.
- "focus" - Enter edit mode when the preview is focused
- "dblclick" - Enter edit mode when the preview is double-clicked
- "click" - Enter edit mode when the preview is clicked
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
**`autoResize`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Whether the editable should auto-resize to fit the content.
**`defaultEdit`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Whether the editable is in edit mode by default.
**`defaultValue`**
Type: `string`
Required: false
Default Value: `undefined`
Description: The initial value of the editable when rendered.
Use when you don't need to control the value of the editable.
**`disabled`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Whether the editable is disabled.
**`edit`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Whether the editable is in edit mode.
**`finalFocusEl`**
Type: `() => HTMLElement | null`
Required: false
Default Value: `undefined`
Description: The element to receive focus when the editable is closed.
**`form`**
Type: `string`
Required: false
Default Value: `undefined`
Description: The associate form of the underlying input.
**`id`**
Type: `string`
Required: false
Default Value: `undefined`
Description: The unique identifier of the machine.
**`ids`**
Type: `Partial<{
root: string
area: string
label: string
preview: string
input: string
control: string
submitTrigger: string
cancelTrigger: string
editTrigger: string
}>`
Required: false
Default Value: `undefined`
Description: The ids of the elements in the editable. Useful for composition.
**`invalid`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Whether the input's value is invalid.
**`maxLength`**
Type: `number`
Required: false
Default Value: `undefined`
Description: The maximum number of characters allowed in the editable
**`name`**
Type: `string`
Required: false
Default Value: `undefined`
Description: The name attribute of the editable component. Used for form submission.
**`onEditChange`**
Type: `(details: EditChangeDetails) => void`
Required: false
Default Value: `undefined`
Description: Function to call when the edit mode changes.
**`onFocusOutside`**
Type: `(event: FocusOutsideEvent) => void`
Required: false
Default Value: `undefined`
Description: Function called when the focus is moved outside the component
**`onInteractOutside`**
Type: `(event: InteractOutsideEvent) => void`
Required: false
Default Value: `undefined`
Description: Function called when an interaction happens outside the component
**`onPointerDownOutside`**
Type: `(event: PointerDownOutsideEvent) => void`
Required: false
Default Value: `undefined`
Description: Function called when the pointer is pressed down outside the component
**`onValueChange`**
Type: `(details: ValueChangeDetails) => void`
Required: false
Default Value: `undefined`
Description: Function to call when the value changes.
**`onValueCommit`**
Type: `(details: ValueChangeDetails) => void`
Required: false
Default Value: `undefined`
Description: Function to call when the value is committed.
**`onValueRevert`**
Type: `(details: ValueChangeDetails) => void`
Required: false
Default Value: `undefined`
Description: Function to call when the value is reverted.
**`placeholder`**
Type: `string | { edit: string; preview: string }`
Required: false
Default Value: `undefined`
Description: The placeholder text for the editable.
**`readOnly`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Whether the editable is read-only.
**`required`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Whether the editable is required.
**`selectOnFocus`**
Type: `boolean`
Required: false
Default Value: `true`
Description: Whether to select the text in the input when it is focused.
**`submitMode`**
Type: `SubmitMode`
Required: false
Default Value: `"both"`
Description: The action that triggers submit in the edit mode:
- "enter" - Trigger submit when the enter key is pressed
- "blur" - Trigger submit when the editable is blurred
- "none" - No action will trigger submit. You need to use the submit button
- "both" - Pressing `Enter` and blurring the input will trigger submit
**`translations`**
Type: `IntlTranslations`
Required: false
Default Value: `undefined`
Description: The translations for the editable.
**`value`**
Type: `string`
Required: false
Default Value: `undefined`
Description: The controlled value of the editable.
### Area
#### Props
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
#### Data Attributes
**`data-scope`**: editable
**`data-part`**: area
**`data-focus`**: Present when focused
**`data-disabled`**: Present when disabled
**`data-placeholder-shown`**: Present when placeholder is shown
### CancelTrigger
#### Props
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
### Control
#### Props
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
### EditTrigger
#### Props
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
### Input
#### Props
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
#### Data Attributes
**`data-scope`**: editable
**`data-part`**: input
**`data-disabled`**: Present when disabled
**`data-readonly`**: Present when read-only
**`data-invalid`**: Present when invalid
**`data-autoresize`**:
### Label
#### Props
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
#### Data Attributes
**`data-scope`**: editable
**`data-part`**: label
**`data-focus`**: Present when focused
**`data-invalid`**: Present when invalid
### Preview
#### Props
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
#### Data Attributes
**`data-scope`**: editable
**`data-part`**: preview
**`data-placeholder-shown`**: Present when placeholder is shown
**`data-readonly`**: Present when read-only
**`data-disabled`**: Present when disabled
**`data-invalid`**: Present when invalid
**`data-autoresize`**:
### RootProvider
#### Props
**`value`**
Type: `UseEditableReturn`
Required: true
Default Value: `undefined`
Description: undefined
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
### SubmitTrigger
#### Props
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
## Accessibility
### Keyboard Support
**`Enter`**
Description: Saves the edited content and exits edit mode.
**`Escape`**
Description: Discards the changes and exits edit mode.
# Editable (SOLID)
## Anatomy
To set up the editable correctly, you'll need to understand its anatomy and how we name its parts.
> Each part includes a `data-part` attribute to help identify them in the DOM.
## Examples
Learn how to use the `Editable` component in your project. Let's take a look at the most basic example:
```tsx
import { Editable } from '@ark-ui/solid/editable'
export const Basic = () => (
Label
)
```
### Using custom controls
In some cases, you might need to use custom controls to toggle the edit and read mode. We use the render prop pattern to
provide access to the internal state of the component.
```tsx
import { Editable } from '@ark-ui/solid/editable'
import { Show } from 'solid-js'
export const CustomControls = () => (
Label
{(editable) => (
Edit}>
SaveCanvel
)}
)
```
### Auto-resizing the editable
To auto-grow the editable as the content changes, set the `autoResize` prop to `true`.
```tsx
{/*...*/}
```
### Setting a maxWidth
It is a common pattern to set a maximum of the editable as it auto-grows. To achieve this, set the `maxWidth` prop to
the desired value.
```tsx
{/*...*/}
```
### Editing with double click
The editable supports two modes of activating the "edit" state:
- when the preview part is focused (with pointer or keyboard).
- when the preview part is double-clicked.
To change the mode to double-click, pass the prop `activationMode="dblclick"`.
```tsx
{/*...*/}
```
### Using the Field Component
The `Field` component helps manage form-related state and accessibility attributes of an editable. It includes handling
ARIA labels, helper text, and error text to ensure proper accessibility.
```tsx
import { Editable } from '@ark-ui/solid/editable'
import { Field } from '@ark-ui/solid/field'
export const WithField = (props: Field.RootProps) => (
LabelAdditional InfoError Info
)
```
### Using the Root Provider
The `RootProvider` component provides a context for the editable. It accepts the value of the `useEditable` hook. You
can leverage it to access the component state and methods from outside the editable.
```tsx
import { Editable, useEditable } from '@ark-ui/solid/editable'
export const RootProvider = () => {
const editable = useEditable({ placeholder: 'Placeholder' })
return (
<>
Label
>
)
}
```
> If you're using the `RootProvider` component, you don't need to use the `Root` component.
## API Reference
### Root
#### Props
**`activationMode`**
Type: `ActivationMode`
Required: false
Default Value: `"focus"`
Description: The activation mode for the preview element.
- "focus" - Enter edit mode when the preview is focused
- "dblclick" - Enter edit mode when the preview is double-clicked
- "click" - Enter edit mode when the preview is clicked
**`asChild`**
Type: `(props: ParentProps<'div'>) => Element`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
**`autoResize`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Whether the editable should auto-resize to fit the content.
**`defaultEdit`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Whether the editable is in edit mode by default.
**`defaultValue`**
Type: `string`
Required: false
Default Value: `undefined`
Description: The initial value of the editable when rendered.
Use when you don't need to control the value of the editable.
**`disabled`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Whether the editable is disabled.
**`edit`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Whether the editable is in edit mode.
**`finalFocusEl`**
Type: `() => HTMLElement | null`
Required: false
Default Value: `undefined`
Description: The element to receive focus when the editable is closed.
**`form`**
Type: `string`
Required: false
Default Value: `undefined`
Description: The associate form of the underlying input.
**`ids`**
Type: `Partial<{
root: string
area: string
label: string
preview: string
input: string
control: string
submitTrigger: string
cancelTrigger: string
editTrigger: string
}>`
Required: false
Default Value: `undefined`
Description: The ids of the elements in the editable. Useful for composition.
**`invalid`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Whether the input's value is invalid.
**`maxLength`**
Type: `number`
Required: false
Default Value: `undefined`
Description: The maximum number of characters allowed in the editable
**`name`**
Type: `string`
Required: false
Default Value: `undefined`
Description: The name attribute of the editable component. Used for form submission.
**`onEditChange`**
Type: `(details: EditChangeDetails) => void`
Required: false
Default Value: `undefined`
Description: Function to call when the edit mode changes.
**`onFocusOutside`**
Type: `(event: FocusOutsideEvent) => void`
Required: false
Default Value: `undefined`
Description: Function called when the focus is moved outside the component
**`onInteractOutside`**
Type: `(event: InteractOutsideEvent) => void`
Required: false
Default Value: `undefined`
Description: Function called when an interaction happens outside the component
**`onPointerDownOutside`**
Type: `(event: PointerDownOutsideEvent) => void`
Required: false
Default Value: `undefined`
Description: Function called when the pointer is pressed down outside the component
**`onValueChange`**
Type: `(details: ValueChangeDetails) => void`
Required: false
Default Value: `undefined`
Description: Function to call when the value changes.
**`onValueCommit`**
Type: `(details: ValueChangeDetails) => void`
Required: false
Default Value: `undefined`
Description: Function to call when the value is committed.
**`onValueRevert`**
Type: `(details: ValueChangeDetails) => void`
Required: false
Default Value: `undefined`
Description: Function to call when the value is reverted.
**`placeholder`**
Type: `string | { edit: string; preview: string }`
Required: false
Default Value: `undefined`
Description: The placeholder text for the editable.
**`readOnly`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Whether the editable is read-only.
**`required`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Whether the editable is required.
**`selectOnFocus`**
Type: `boolean`
Required: false
Default Value: `true`
Description: Whether to select the text in the input when it is focused.
**`submitMode`**
Type: `SubmitMode`
Required: false
Default Value: `"both"`
Description: The action that triggers submit in the edit mode:
- "enter" - Trigger submit when the enter key is pressed
- "blur" - Trigger submit when the editable is blurred
- "none" - No action will trigger submit. You need to use the submit button
- "both" - Pressing `Enter` and blurring the input will trigger submit
**`translations`**
Type: `IntlTranslations`
Required: false
Default Value: `undefined`
Description: The translations for the editable.
**`value`**
Type: `string`
Required: false
Default Value: `undefined`
Description: The controlled value of the editable.
### Area
#### Props
**`asChild`**
Type: `(props: ParentProps<'div'>) => Element`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
#### Data Attributes
**`data-scope`**: editable
**`data-part`**: area
**`data-focus`**: Present when focused
**`data-disabled`**: Present when disabled
**`data-placeholder-shown`**: Present when placeholder is shown
### CancelTrigger
#### Props
**`asChild`**
Type: `(props: ParentProps<'button'>) => Element`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
### Control
#### Props
**`asChild`**
Type: `(props: ParentProps<'div'>) => Element`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
### EditTrigger
#### Props
**`asChild`**
Type: `(props: ParentProps<'button'>) => Element`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
### Input
#### Props
**`asChild`**
Type: `(props: ParentProps<'input'>) => Element`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
#### Data Attributes
**`data-scope`**: editable
**`data-part`**: input
**`data-disabled`**: Present when disabled
**`data-readonly`**: Present when read-only
**`data-invalid`**: Present when invalid
**`data-autoresize`**:
### Label
#### Props
**`asChild`**
Type: `(props: ParentProps<'label'>) => Element`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
#### Data Attributes
**`data-scope`**: editable
**`data-part`**: label
**`data-focus`**: Present when focused
**`data-invalid`**: Present when invalid
### Preview
#### Props
**`asChild`**
Type: `(props: ParentProps<'span'>) => Element`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
#### Data Attributes
**`data-scope`**: editable
**`data-part`**: preview
**`data-placeholder-shown`**: Present when placeholder is shown
**`data-readonly`**: Present when read-only
**`data-disabled`**: Present when disabled
**`data-invalid`**: Present when invalid
**`data-autoresize`**:
### RootProvider
#### Props
**`value`**
Type: `UseEditableReturn`
Required: true
Default Value: `undefined`
Description: undefined
**`asChild`**
Type: `(props: ParentProps<'div'>) => Element`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
### SubmitTrigger
#### Props
**`asChild`**
Type: `(props: ParentProps<'button'>) => Element`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
## Accessibility
### Keyboard Support
**`Enter`**
Description: Saves the edited content and exits edit mode.
**`Escape`**
Description: Discards the changes and exits edit mode.
# Editable (VUE)
## Anatomy
To set up the editable correctly, you'll need to understand its anatomy and how we name its parts.
> Each part includes a `data-part` attribute to help identify them in the DOM.
## Examples
Learn how to use the `Editable` component in your project. Let's take a look at the most basic example:
```vue
Label
```
### Using custom controls
In some cases, you might need to use custom controls to toggle the edit and read mode. We use the render prop pattern to
provide access to the internal state of the component.
```vue
LabelSaveCancelEdit
```
### Auto-resizing the editable
To auto-grow the editable as the content changes, set the `autoResize` prop to `true`.
```tsx
{/*...*/}
```
### Setting a maxWidth
It is a common pattern to set a maximum of the editable as it auto-grows. To achieve this, set the `maxWidth` prop to
the desired value.
```tsx
{/*...*/}
```
### Editing with double click
The editable supports two modes of activating the "edit" state:
- when the preview part is focused (with pointer or keyboard).
- when the preview part is double-clicked.
To change the mode to double-click, pass the prop `activationMode="dblclick"`.
```tsx
{/*...*/}
```
### Using the Field Component
The `Field` component helps manage form-related state and accessibility attributes of an editable. It includes handling
ARIA labels, helper text, and error text to ensure proper accessibility.
```vue
LabelAdditional InfoError Info
```
### Using the Root Provider
The `RootProvider` component provides a context for the editable. It accepts the value of the `useEditable` hook. You
can leverage it to access the component state and methods from outside the editable.
```vue
Label
```
> If you're using the `RootProvider` component, you don't need to use the `Root` component.
## API Reference
### Root
#### Props
**`activationMode`**
Type: `ActivationMode`
Required: false
Default Value: `"focus"`
Description: The activation mode for the preview element.
- "focus" - Enter edit mode when the preview is focused
- "dblclick" - Enter edit mode when the preview is double-clicked
- "click" - Enter edit mode when the preview is clicked
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
**`autoResize`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Whether the editable should auto-resize to fit the content.
**`defaultEdit`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Whether the editable is in edit mode by default.
**`defaultValue`**
Type: `string`
Required: false
Default Value: `undefined`
Description: The initial value of the editable when rendered.
Use when you don't need to control the value of the editable.
**`disabled`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Whether the editable is disabled.
**`edit`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Whether the editable is in edit mode.
**`finalFocusEl`**
Type: `() => HTMLElement | null`
Required: false
Default Value: `undefined`
Description: The element to receive focus when the editable is closed.
**`form`**
Type: `string`
Required: false
Default Value: `undefined`
Description: The associate form of the underlying input.
**`id`**
Type: `string`
Required: false
Default Value: `undefined`
Description: The unique identifier of the machine.
**`ids`**
Type: `Partial<{
root: string
area: string
label: string
preview: string
input: string
control: string
submitTrigger: string
cancelTrigger: string
editTrigger: string
}>`
Required: false
Default Value: `undefined`
Description: The ids of the elements in the editable. Useful for composition.
**`invalid`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Whether the input's value is invalid.
**`maxLength`**
Type: `number`
Required: false
Default Value: `undefined`
Description: The maximum number of characters allowed in the editable
**`modelValue`**
Type: `string`
Required: false
Default Value: `undefined`
Description: The v-model value of the editable
**`name`**
Type: `string`
Required: false
Default Value: `undefined`
Description: The name attribute of the editable component. Used for form submission.
**`placeholder`**
Type: `string | { edit: string; preview: string }`
Required: false
Default Value: `undefined`
Description: The placeholder text for the editable.
**`readOnly`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Whether the editable is read-only.
**`required`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Whether the editable is required.
**`selectOnFocus`**
Type: `boolean`
Required: false
Default Value: `true`
Description: Whether to select the text in the input when it is focused.
**`submitMode`**
Type: `SubmitMode`
Required: false
Default Value: `"both"`
Description: The action that triggers submit in the edit mode:
- "enter" - Trigger submit when the enter key is pressed
- "blur" - Trigger submit when the editable is blurred
- "none" - No action will trigger submit. You need to use the submit button
- "both" - Pressing `Enter` and blurring the input will trigger submit
**`translations`**
Type: `IntlTranslations`
Required: false
Default Value: `undefined`
Description: The translations for the editable.
#### Emits
**`editChange`**
Type: `[details: EditChangeDetails]`
Description: Function to call when the edit mode changes.
**`focusOutside`**
Type: `[event: FocusOutsideEvent]`
Description: Function called when the focus is moved outside the component
**`interactOutside`**
Type: `[event: InteractOutsideEvent]`
Description: Function called when an interaction happens outside the component
**`pointerDownOutside`**
Type: `[event: PointerDownOutsideEvent]`
Description: Function called when the pointer is pressed down outside the component
**`update:edit`**
Type: `[edit: boolean]`
Description: Event handler called when the edit state of the editable changes.
**`update:modelValue`**
Type: `[value: string]`
Description: The callback fired when the model value changes.
**`valueChange`**
Type: `[details: ValueChangeDetails]`
Description: Function to call when the value changes.
**`valueCommit`**
Type: `[details: ValueChangeDetails]`
Description: Function to call when the value is committed.
**`valueRevert`**
Type: `[details: ValueChangeDetails]`
Description: Function to call when the value is reverted.
### Area
#### Props
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
#### Data Attributes
**`data-scope`**: editable
**`data-part`**: area
**`data-focus`**: Present when focused
**`data-disabled`**: Present when disabled
**`data-placeholder-shown`**: Present when placeholder is shown
### CancelTrigger
#### Props
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
### Control
#### Props
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
### EditTrigger
#### Props
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
### Input
#### Props
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
#### Data Attributes
**`data-scope`**: editable
**`data-part`**: input
**`data-disabled`**: Present when disabled
**`data-readonly`**: Present when read-only
**`data-invalid`**: Present when invalid
**`data-autoresize`**:
### Label
#### Props
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
#### Data Attributes
**`data-scope`**: editable
**`data-part`**: label
**`data-focus`**: Present when focused
**`data-invalid`**: Present when invalid
### Preview
#### Props
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
#### Data Attributes
**`data-scope`**: editable
**`data-part`**: preview
**`data-placeholder-shown`**: Present when placeholder is shown
**`data-readonly`**: Present when read-only
**`data-disabled`**: Present when disabled
**`data-invalid`**: Present when invalid
**`data-autoresize`**:
### RootProvider
#### Props
**`value`**
Type: `EditableApi`
Required: true
Default Value: `undefined`
Description: undefined
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
### SubmitTrigger
#### Props
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
## Accessibility
### Keyboard Support
**`Enter`**
Description: Saves the edited content and exits edit mode.
**`Escape`**
Description: Discards the changes and exits edit mode.
# Field (REACT)
## Examples
The `Field` component provides contexts such as `invalid`, `disabled`, `required`, and `readOnly` for form elements.
While most Ark UI components natively support these contexts, you can also use the `Field` component with standard HTML
form elements.
### Input
This example shows how to use the `Field` component with a standard input field.
```tsx
import { Field } from '@ark-ui/react/field'
export const Input = () => {
return (
LabelSome additional InfoError Info
)
}
```
### Textarea
This example illustrates how to use the `Field` component with a textarea element.
```tsx
import { Field } from '@ark-ui/react/field'
export const Textarea = () => {
return (
LabelSome additional InfoError Info
)
}
```
### Textarea Autoresize
Pass the `autoresize` prop to the `Textarea` component to enable automatic resizing as the user types.
```tsx
import { Field } from '@ark-ui/react/field'
export const Textarea = () => {
return (
LabelSome additional InfoError Info
)
}
```
### Select
This example demonstrates how to integrate the `Field` component with a select dropdown.
```tsx
import { Field } from '@ark-ui/react/field'
export const Select = () => {
return (
LabelSome additional InfoError Info
)
}
```
### Using Ark Components
This example demonstrates how to integrate the `Field` and `Checkbox` components. For more examples of using the `Field`
component with various Ark UI elements, refer to their respective documentation.
```tsx
import { Checkbox } from '@ark-ui/react/checkbox'
import { Field } from '@ark-ui/react/field'
import { CheckIcon, MinusIcon } from 'lucide-react'
export const WithField = (props: Field.RootProps) => (
LabelAdditional InfoError Info
)
```
### Using the Root Provider
The `RootProvider` component provides a context for the field. It accepts the value of the `useField` hook. You can
leverage it to access the component state and methods from outside the field.
```tsx
import { Field, useField } from '@ark-ui/react/field'
import { useState } from 'react'
export const RootProvider = () => {
const [invalid, setInvalid] = useState(false)
const value = useField({
invalid,
})
return (
<>
LabelSome additional InfoError Info
>
)
}
```
> If you're using the `RootProvider` component, you don't need to use the `Root` component.
## API Reference
### Root
#### Props
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
**`disabled`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Indicates whether the field is disabled.
**`ids`**
Type: `ElementIds`
Required: false
Default Value: `undefined`
Description: The ids of the field parts.
**`invalid`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Indicates whether the field is invalid.
**`readOnly`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Indicates whether the field is read-only.
**`required`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Indicates whether the field is required.
### ErrorText
#### Props
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
### HelperText
#### Props
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
### Input
#### Props
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
### Label
#### Props
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
### RequiredIndicator
#### Props
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
**`fallback`**
Type: `string | number | bigint | boolean | ReactElement> | Iterable | ReactPortal | Promise<...>`
Required: false
Default Value: `undefined`
Description: undefined
### RootProvider
#### Props
**`value`**
Type: `{ ariaDescribedby: string | undefined; ids: { root: string; control: string; label: string; errorText: string; helperText: string; }; refs: { rootRef: RefObject; }; ... 11 more ...; getRequiredIndicatorProps: () => Omit<...>; }`
Required: true
Default Value: `undefined`
Description: undefined
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
### Select
#### Props
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
### Textarea
#### Props
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
**`autoresize`**
Type: `boolean`
Required: false
Default Value: `false`
Description: Whether the textarea should autoresize
# Field (SOLID)
## Examples
The `Field` component provides contexts such as `invalid`, `disabled`, `required`, and `readOnly` for form elements.
While most Ark UI components natively support these contexts, you can also use the `Field` component with standard HTML
form elements.
### Input
This example shows how to use the `Field` component with a standard input field.
```tsx
import { Field } from '@ark-ui/solid/field'
export const Input = () => {
return (
LabelSome additional InfoError Info
)
}
```
### Textarea
This example illustrates how to use the `Field` component with a textarea element.
```tsx
import { Field } from '@ark-ui/solid/field'
export const Textarea = () => {
return (
LabelSome additional InfoError Info
)
}
```
### Textarea Autoresize
Pass the `autoresize` prop to the `Textarea` component to enable automatic resizing as the user types.
```tsx
import { Field } from '@ark-ui/solid/field'
export const Textarea = () => {
return (
LabelSome additional InfoError Info
)
}
```
### Select
This example demonstrates how to integrate the `Field` component with a select dropdown.
```tsx
import { Field } from '@ark-ui/solid/field'
export const Select = () => {
return (
LabelSome additional InfoError Info
)
}
```
### Using Ark Components
This example demonstrates how to integrate the `Field` and `Checkbox` components. For more examples of using the `Field`
component with various Ark UI elements, refer to their respective documentation.
```tsx
import { Checkbox } from '@ark-ui/solid/checkbox'
import { Field } from '@ark-ui/solid/field'
import { CheckIcon, MinusIcon } from 'lucide-solid'
export const WithField = (props: Field.RootProps) => (
LabelAdditional InfoError Info
)
```
### Using the Root Provider
The `RootProvider` component provides a context for the field. It accepts the value of the `useField` hook. You can
leverage it to access the component state and methods from outside the field.
```tsx
import { Field, useField } from '@ark-ui/solid/field'
import { createMemo, createSignal } from 'solid-js'
export const RootProvider = () => {
const [invalid, setInvalid] = createSignal(false)
const fieldProps = createMemo(() => ({
invalid: invalid(),
}))
const value = useField(fieldProps)
return (
<>
LabelSome additional InfoError Info
>
)
}
```
> If you're using the `RootProvider` component, you don't need to use the `Root` component.
## API Reference
### Root
#### Props
**`asChild`**
Type: `(props: ParentProps<'div'>) => Element`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
**`disabled`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Indicates whether the field is disabled.
**`ids`**
Type: `ElementIds`
Required: false
Default Value: `undefined`
Description: The ids of the field parts.
**`invalid`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Indicates whether the field is invalid.
**`readOnly`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Indicates whether the field is read-only.
**`required`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Indicates whether the field is required.
### ErrorText
#### Props
**`asChild`**
Type: `(props: ParentProps<'span'>) => Element`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
### HelperText
#### Props
**`asChild`**
Type: `(props: ParentProps<'span'>) => Element`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
### Input
#### Props
**`asChild`**
Type: `(props: ParentProps<'input'>) => Element`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
### Label
#### Props
**`asChild`**
Type: `(props: ParentProps<'label'>) => Element`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
### RequiredIndicator
#### Props
**`asChild`**
Type: `(props: ParentProps<'span'>) => Element`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
**`fallback`**
Type: `number | boolean | Node | ArrayElement | (string & {})`
Required: false
Default Value: `undefined`
Description: undefined
### RootProvider
#### Props
**`value`**
Type: `Accessor<{ ariaDescribedby: string; ids: { control: string; label: string; errorText: string; helperText: string; }; refs: { rootRef: Setter; }; ... 11 more ...; getRequiredIndicatorProps: () => { ...; }; }>`
Required: true
Default Value: `undefined`
Description: undefined
**`asChild`**
Type: `(props: ParentProps<'div'>) => Element`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
### Select
#### Props
**`asChild`**
Type: `(props: ParentProps<'select'>) => Element`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
### Textarea
#### Props
**`asChild`**
Type: `(props: ParentProps<'textarea'>) => Element`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
**`autoresize`**
Type: `boolean`
Required: false
Default Value: `false`
Description: Whether the textarea should autoresize
# Field (VUE)
## Examples
The `Field` component provides contexts such as `invalid`, `disabled`, `required`, and `readOnly` for form elements.
While most Ark UI components natively support these contexts, you can also use the `Field` component with standard HTML
form elements.
### Input
This example shows how to use the `Field` component with a standard input field.
```vue
LabelSome additional InfoError Info
```
### Textarea
This example illustrates how to use the `Field` component with a textarea element.
```vue
LabelSome additional InfoError Info
```
### Textarea Autoresize
Pass the `autoresize` prop to the `Textarea` component to enable automatic resizing as the user types.
```vue
LabelSome additional InfoError Info
```
### Select
This example demonstrates how to integrate the `Field` component with a select dropdown.
```vue
LabelSome additional InfoError Info
```
### Using Ark Components
This example demonstrates how to integrate the `Field` and `Checkbox` components. For more examples of using the `Field`
component with various Ark UI elements, refer to their respective documentation.
```vue
LabelAdditional InfoError Info
```
### Using the Root Provider
The `RootProvider` component provides a context for the field. It accepts the value of the `useField` hook. You can
leverage it to access the component state and methods from outside the field.
```vue
LabelSome additional InfoError Info
```
> If you're using the `RootProvider` component, you don't need to use the `Root` component.
## API Reference
### Root
#### Props
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
**`disabled`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Indicates whether the field is disabled.
**`id`**
Type: `string`
Required: false
Default Value: `undefined`
Description: The id of the field.
**`ids`**
Type: `ElementIds`
Required: false
Default Value: `undefined`
Description: The ids of the field parts.
**`invalid`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Indicates whether the field is invalid.
**`readOnly`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Indicates whether the field is read-only.
**`required`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Indicates whether the field is required.
### ErrorText
#### Props
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
### HelperText
#### Props
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
### Input
#### Props
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
**`modelValue`**
Type: `any`
Required: false
Default Value: `undefined`
Description: undefined
### Label
#### Props
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
### RequiredIndicator
#### Props
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
### RootProvider
#### Props
**`value`**
Type: `{ ariaDescribedby: string | undefined; ids: { control: string; label: string; errorText: string; helperText: string; }; refs: { rootRef: Ref; }; disabled: boolean | undefined; ... 10 more ...; getRequiredIndicatorProps: () => HTMLAttributes; }`
Required: true
Default Value: `undefined`
Description: undefined
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
### Select
#### Props
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
**`modelValue`**
Type: `any`
Required: false
Default Value: `undefined`
Description: undefined
### Textarea
#### Props
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
**`autoresize`**
Type: `boolean`
Required: false
Default Value: `false`
Description: Whether the textarea should autoresize
**`modelValue`**
Type: `string | number | readonly string[]`
Required: false
Default Value: `undefined`
Description: undefined
# Fieldset (REACT)
## Examples
The `Fieldset` component provides contexts such as `invalid` and `disabled` for form elements. While most Ark UI
components natively support these contexts, you can also use the `Field` component with standard HTML form elements.
### Basic Usage
Learn how to use the `Fieldset` component in your project. Let's take a look at the most basic example:
```tsx
import { Fieldset } from '@ark-ui/react/fieldset'
export const Basic = (props: Fieldset.RootProps) => {
return (
LegendHelper textError text
)
}
```
### Fieldset with Fields
This example demonstrates how to use the `Field` component with a standard input field within a `Fieldset`.
```tsx
import { Field } from '@ark-ui/react/field'
import { Fieldset } from '@ark-ui/react/fieldset'
export const WithField = (props: Fieldset.RootProps) => {
return (
LegendFieldset Helper TextFieldset Error TextLabelField Helper TextField Error Text
)
}
```
### Fieldset with other Form Elements
This example shows how to use the `Fieldset` component with other Ark UI form elements like `Checkbox`.
```tsx
import { Checkbox } from '@ark-ui/react/checkbox'
import { Field } from '@ark-ui/react/field'
import { Fieldset } from '@ark-ui/react/fieldset'
export const WithCheckbox = (props: Fieldset.RootProps) => {
return (
LegendFieldset Helper TextFieldset Error TextLabel✔️Field Heler TextField Error Text
)
}
```
### Using the Root Provider
The `RootProvider` component provides a context for the fieldset. It accepts the value of the `useFieldset` hook. You
can leverage it to access the component state and methods from outside the fieldset.
```tsx
Example not found```
> If you're using the `RootProvider` component, you don't need to use the `Root` component.
## API Reference
### Root
#### Props
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
**`invalid`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Indicates whether the fieldset is invalid.
### ErrorText
#### Props
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
### HelperText
#### Props
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
### Legend
#### Props
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
### RootProvider
#### Props
**`value`**
Type: `{ refs: { rootRef: RefObject; }; disabled: boolean; invalid: boolean; getRootProps: () => Omit, HTMLFieldSetElement>, "ref">; getLegendProps: () => Omit<...>; getHelperTextProps: () => Omit<...>; getErrorTextProps: () => Omit<....`
Required: true
Default Value: `undefined`
Description: undefined
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
# Fieldset (SOLID)
## Examples
The `Fieldset` component provides contexts such as `invalid` and `disabled` for form elements. While most Ark UI
components natively support these contexts, you can also use the `Field` component with standard HTML form elements.
### Basic Usage
Learn how to use the `Fieldset` component in your project. Let's take a look at the most basic example:
```tsx
import { Fieldset } from '@ark-ui/solid/fieldset'
export const Basic = (props: Fieldset.RootProps) => {
return (
LegendHelper textError text
)
}
```
### Fieldset with Fields
This example demonstrates how to use the `Field` component with a standard input field within a `Fieldset`.
```tsx
import { Field } from '@ark-ui/solid/field'
import { Fieldset } from '@ark-ui/solid/fieldset'
export const WithField = (props: Fieldset.RootProps) => {
return (
LegendFieldset Helper TextFieldset Error TextLabelField Helper TextField Error Text
)
}
```
### Fieldset with other Form Elements
This example shows how to use the `Fieldset` component with other Ark UI form elements like `Checkbox`.
```tsx
import { Checkbox } from '@ark-ui/solid/checkbox'
import { Field } from '@ark-ui/solid/field'
import { Fieldset } from '@ark-ui/solid/fieldset'
export const WithCheckbox = (props: Fieldset.RootProps) => {
return (
LegendFieldset Helper TextFieldset Error TextLabel✔️Field Heler TextField Error Text
)
}
```
### Using the Root Provider
The `RootProvider` component provides a context for the fieldset. It accepts the value of the `useFieldset` hook. You
can leverage it to access the component state and methods from outside the fieldset.
```tsx
Example not found```
> If you're using the `RootProvider` component, you don't need to use the `Root` component.
## API Reference
### Root
#### Props
**`asChild`**
Type: `(props: ParentProps<'fieldset'>) => Element`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
**`invalid`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Indicates whether the fieldset is invalid.
### ErrorText
#### Props
**`asChild`**
Type: `(props: ParentProps<'span'>) => Element`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
### HelperText
#### Props
**`asChild`**
Type: `(props: ParentProps<'span'>) => Element`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
### Legend
#### Props
**`asChild`**
Type: `(props: ParentProps<'legend'>) => Element`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
### RootProvider
#### Props
**`value`**
Type: `Accessor<{ refs: { rootRef: HTMLFieldSetElement | undefined; }; disabled: boolean; invalid: boolean; getRootProps: () => { disabled: boolean; 'data-disabled': Booleanish; 'data-invalid': Booleanish; 'aria-describedby': string | undefined; "data-scope": string; "data-part": string; }; getLegendProps: () => { ...; }; ...`
Required: true
Default Value: `undefined`
Description: undefined
**`asChild`**
Type: `(props: ParentProps<'fieldset'>) => Element`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
# Fieldset (VUE)
## Examples
The `Fieldset` component provides contexts such as `invalid` and `disabled` for form elements. While most Ark UI
components natively support these contexts, you can also use the `Field` component with standard HTML form elements.
### Basic Usage
Learn how to use the `Fieldset` component in your project. Let's take a look at the most basic example:
```vue
LegendHelper textError text
```
### Fieldset with Fields
This example demonstrates how to use the `Field` component with a standard input field within a `Fieldset`.
```vue
LegendFieldset Helper TextFieldset Error TextLabelField Helper TextField Error Text
```
### Fieldset with other Form Elements
This example shows how to use the `Fieldset` component with other Ark UI form elements like `Checkbox`.
```vue
LegendFieldset Helper TextFieldset Error TextCheckbox✔️Field Heler TextField Error Text
```
### Using the Root Provider
The `RootProvider` component provides a context for the fieldset. It accepts the value of the `useFieldset` hook. You
can leverage it to access the component state and methods from outside the fieldset.
```vue
Example not found```
> If you're using the `RootProvider` component, you don't need to use the `Root` component.
## API Reference
### Root
#### Props
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
**`disabled`**
Type: `boolean | 'true' | 'false'`
Required: false
Default Value: `undefined`
Description: Indicates whether the fieldset is disabled.
**`id`**
Type: `string`
Required: false
Default Value: `undefined`
Description: The id of the fieldset.
**`invalid`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Indicates whether the fieldset is invalid.
### ErrorText
#### Props
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
### HelperText
#### Props
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
### Legend
#### Props
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
### RootProvider
#### Props
**`value`**
Type: `{ refs: { rootRef: Ref; }; disabled: boolean | "true" | "false" | undefined; invalid: boolean | undefined; getRootProps: () => FieldsetHTMLAttributes; getLegendProps: () => { ...; }; getHelperTextProps: () => { ...; }; getErrorTextProps: () => HTMLAttributes; }`
Required: true
Default Value: `undefined`
Description: undefined
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
# File Upload (REACT)
## Anatomy
To set up the file upload component correctly, you'll need to understand its anatomy and how we name its parts.
> Each part includes a `data-part` attribute to help identify them in the DOM.
## Examples
Learn how to use the `FileUpload` component in your project. Let's take a look at the most basic example:
```tsx
import { FileUpload } from '@ark-ui/react/file-upload'
import { FileIcon } from 'lucide-react'
export const Basic = () => {
return (
File UploadDrag your file(s) hereChoose file(s)
{({ acceptedFiles }) =>
acceptedFiles.map((file) => (
X
))
}
)
}
```
### Using the Field Component
The `Field` component helps manage form-related state and accessibility attributes of an file upload. It includes
handling ARIA labels, helper text, and error text to ensure proper accessibility.
```tsx
import { Field } from '@ark-ui/react/field'
import { FileUpload } from '@ark-ui/react/file-upload'
export const WithField = (props: Field.RootProps) => (
LabelSelectAdditional InfoError Info
)
```
### Using the Root Provider
The `RootProvider` component provides a context for the file-upload. It accepts the value of the `useFile-upload` hook.
You can leverage it to access the component state and methods from outside the file-upload.
```tsx
import { FileUpload, useFileUpload } from '@ark-ui/react/file-upload'
import { FileIcon } from 'lucide-react'
export const RootProvider = () => {
const fileUpload = useFileUpload({ maxFiles: 5 })
return (
<>
File UploadDrag your file(s) hereChoose file(s)
{({ acceptedFiles }) =>
acceptedFiles.map((file) => (
X
))
}
>
)
}
```
> If you're using the `RootProvider` component, you don't need to use the `Root` component.
## API Reference
### Root
#### Props
**`accept`**
Type: `Record | FileMimeType | FileMimeType[]`
Required: false
Default Value: `undefined`
Description: The accept file types
**`allowDrop`**
Type: `boolean`
Required: false
Default Value: `true`
Description: Whether to allow drag and drop in the dropzone element
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
**`capture`**
Type: `'user' | 'environment'`
Required: false
Default Value: `undefined`
Description: The default camera to use when capturing media
**`directory`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Whether to accept directories, only works in webkit browsers
**`disabled`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Whether the file input is disabled
**`ids`**
Type: `Partial<{
root: string
dropzone: string
hiddenInput: string
trigger: string
label: string
item(id: string): string
itemName(id: string): string
itemSizeText(id: string): string
itemPreview(id: string): string
}>`
Required: false
Default Value: `undefined`
Description: The ids of the elements. Useful for composition.
**`invalid`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Whether the file input is invalid
**`locale`**
Type: `string`
Required: false
Default Value: `"en-US"`
Description: The current locale. Based on the BCP 47 definition.
**`maxFiles`**
Type: `number`
Required: false
Default Value: `1`
Description: The maximum number of files
**`maxFileSize`**
Type: `number`
Required: false
Default Value: `Infinity`
Description: The maximum file size in bytes
**`minFileSize`**
Type: `number`
Required: false
Default Value: `0`
Description: The minimum file size in bytes
**`name`**
Type: `string`
Required: false
Default Value: `undefined`
Description: The name of the underlying file input
**`onFileAccept`**
Type: `(details: FileAcceptDetails) => void`
Required: false
Default Value: `undefined`
Description: Function called when the file is accepted
**`onFileChange`**
Type: `(details: FileChangeDetails) => void`
Required: false
Default Value: `undefined`
Description: Function called when the value changes, whether accepted or rejected
**`onFileReject`**
Type: `(details: FileRejectDetails) => void`
Required: false
Default Value: `undefined`
Description: Function called when the file is rejected
**`preventDocumentDrop`**
Type: `boolean`
Required: false
Default Value: `true`
Description: Whether to prevent the drop event on the document
**`required`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Whether the file input is required
**`translations`**
Type: `IntlTranslations`
Required: false
Default Value: `undefined`
Description: The localized messages to use.
**`validate`**
Type: `(file: File, details: FileValidateDetails) => FileError[] | null`
Required: false
Default Value: `undefined`
Description: Function to validate a file
#### Data Attributes
**`data-scope`**: file-upload
**`data-part`**: root
**`data-disabled`**: Present when disabled
**`data-dragging`**: Present when in the dragging state
### ClearTrigger
#### Props
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
#### Data Attributes
**`data-scope`**: file-upload
**`data-part`**: clear-trigger
**`data-disabled`**: Present when disabled
### Dropzone
#### Props
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
**`disableClick`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Whether to disable the click event on the dropzone
#### Data Attributes
**`data-scope`**: file-upload
**`data-part`**: dropzone
**`data-invalid`**: Present when invalid
**`data-disabled`**: Present when disabled
**`data-dragging`**: Present when in the dragging state
### HiddenInput
#### Props
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
### ItemDeleteTrigger
#### Props
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
#### Data Attributes
**`data-scope`**: file-upload
**`data-part`**: item-delete-trigger
**`data-disabled`**: Present when disabled
### ItemGroup
#### Props
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
#### Data Attributes
**`data-scope`**: file-upload
**`data-part`**: item-group
**`data-disabled`**: Present when disabled
### ItemName
#### Props
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
#### Data Attributes
**`data-scope`**: file-upload
**`data-part`**: item-name
**`data-disabled`**: Present when disabled
### ItemPreviewImage
#### Props
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
#### Data Attributes
**`data-scope`**: file-upload
**`data-part`**: item-preview-image
**`data-disabled`**: Present when disabled
### ItemPreview
#### Props
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
**`type`**
Type: `string`
Required: false
Default Value: `'.*'`
Description: The file type to match against. Matches all file types by default.
#### Data Attributes
**`data-scope`**: file-upload
**`data-part`**: item-preview
**`data-disabled`**: Present when disabled
### Item
#### Props
**`file`**
Type: `File`
Required: true
Default Value: `undefined`
Description: undefined
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
#### Data Attributes
**`data-scope`**: file-upload
**`data-part`**: item
**`data-disabled`**: Present when disabled
### ItemSizeText
#### Props
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
#### Data Attributes
**`data-scope`**: file-upload
**`data-part`**: item-size-text
**`data-disabled`**: Present when disabled
### Label
#### Props
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
#### Data Attributes
**`data-scope`**: file-upload
**`data-part`**: label
**`data-disabled`**: Present when disabled
### RootProvider
#### Props
**`value`**
Type: `UseFileUploadReturn`
Required: true
Default Value: `undefined`
Description: undefined
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
### Trigger
#### Props
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
#### Data Attributes
**`data-scope`**: file-upload
**`data-part`**: trigger
**`data-disabled`**: Present when disabled
**`data-invalid`**: Present when invalid
# File Upload (SOLID)
## Anatomy
To set up the file upload component correctly, you'll need to understand its anatomy and how we name its parts.
> Each part includes a `data-part` attribute to help identify them in the DOM.
## Examples
Learn how to use the `FileUpload` component in your project. Let's take a look at the most basic example:
```tsx
import { FileUpload } from '@ark-ui/solid/file-upload'
import { For } from 'solid-js'
export const Basic = () => (
File UploadDrag your file(s) hereChoose file(s)
{(context) => (
{(file) => (
Any IconX
)}
)}
)
```
### Using the Field Component
The `Field` component helps manage form-related state and accessibility attributes of an file upload. It includes
handling ARIA labels, helper text, and error text to ensure proper accessibility.
```tsx
import { Field } from '@ark-ui/solid/field'
import { FileUpload } from '@ark-ui/solid/file-upload'
export const WithField = (props: Field.RootProps) => (
LabelSelectAdditional InfoError Info
)
```
### Using the Root Provider
The `RootProvider` component provides a context for the file-upload. It accepts the value of the `useFile-upload` hook.
You can leverage it to access the component state and methods from outside the file-upload.
```tsx
import { FileUpload, useFileUpload } from '@ark-ui/solid/file-upload'
import { For } from 'solid-js'
export const RootProvider = () => {
const fileUpload = useFileUpload({ maxFiles: 5 })
return (
<>
File UploadDrag your file(s)hereChoose file(s)
{(context) => (
{(file) => (
Any IconX
)}
)}
>
)
}
```
> If you're using the `RootProvider` component, you don't need to use the `Root` component.
## API Reference
### Root
#### Props
**`accept`**
Type: `Record | FileMimeType | FileMimeType[]`
Required: false
Default Value: `undefined`
Description: The accept file types
**`allowDrop`**
Type: `boolean`
Required: false
Default Value: `true`
Description: Whether to allow drag and drop in the dropzone element
**`asChild`**
Type: `(props: ParentProps<'div'>) => Element`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
**`capture`**
Type: `'user' | 'environment'`
Required: false
Default Value: `undefined`
Description: The default camera to use when capturing media
**`directory`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Whether to accept directories, only works in webkit browsers
**`disabled`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Whether the file input is disabled
**`ids`**
Type: `Partial<{
root: string
dropzone: string
hiddenInput: string
trigger: string
label: string
item(id: string): string
itemName(id: string): string
itemSizeText(id: string): string
itemPreview(id: string): string
}>`
Required: false
Default Value: `undefined`
Description: The ids of the elements. Useful for composition.
**`invalid`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Whether the file input is invalid
**`locale`**
Type: `string`
Required: false
Default Value: `"en-US"`
Description: The current locale. Based on the BCP 47 definition.
**`maxFiles`**
Type: `number`
Required: false
Default Value: `1`
Description: The maximum number of files
**`maxFileSize`**
Type: `number`
Required: false
Default Value: `Infinity`
Description: The maximum file size in bytes
**`minFileSize`**
Type: `number`
Required: false
Default Value: `0`
Description: The minimum file size in bytes
**`name`**
Type: `string`
Required: false
Default Value: `undefined`
Description: The name of the underlying file input
**`onFileAccept`**
Type: `(details: FileAcceptDetails) => void`
Required: false
Default Value: `undefined`
Description: Function called when the file is accepted
**`onFileChange`**
Type: `(details: FileChangeDetails) => void`
Required: false
Default Value: `undefined`
Description: Function called when the value changes, whether accepted or rejected
**`onFileReject`**
Type: `(details: FileRejectDetails) => void`
Required: false
Default Value: `undefined`
Description: Function called when the file is rejected
**`preventDocumentDrop`**
Type: `boolean`
Required: false
Default Value: `true`
Description: Whether to prevent the drop event on the document
**`required`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Whether the file input is required
**`translations`**
Type: `IntlTranslations`
Required: false
Default Value: `undefined`
Description: The localized messages to use.
**`validate`**
Type: `(file: File, details: FileValidateDetails) => FileError[] | null`
Required: false
Default Value: `undefined`
Description: Function to validate a file
#### Data Attributes
**`data-scope`**: file-upload
**`data-part`**: root
**`data-disabled`**: Present when disabled
**`data-dragging`**: Present when in the dragging state
### ClearTrigger
#### Props
**`asChild`**
Type: `(props: ParentProps<'button'>) => Element`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
#### Data Attributes
**`data-scope`**: file-upload
**`data-part`**: clear-trigger
**`data-disabled`**: Present when disabled
### Dropzone
#### Props
**`asChild`**
Type: `(props: ParentProps<'div'>) => Element`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
**`disableClick`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Whether to disable the click event on the dropzone
#### Data Attributes
**`data-scope`**: file-upload
**`data-part`**: dropzone
**`data-invalid`**: Present when invalid
**`data-disabled`**: Present when disabled
**`data-dragging`**: Present when in the dragging state
### HiddenInput
#### Props
**`asChild`**
Type: `(props: ParentProps<'input'>) => Element`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
### ItemDeleteTrigger
#### Props
**`asChild`**
Type: `(props: ParentProps<'button'>) => Element`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
#### Data Attributes
**`data-scope`**: file-upload
**`data-part`**: item-delete-trigger
**`data-disabled`**: Present when disabled
### ItemGroup
#### Props
**`asChild`**
Type: `(props: ParentProps<'ul'>) => Element`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
#### Data Attributes
**`data-scope`**: file-upload
**`data-part`**: item-group
**`data-disabled`**: Present when disabled
### ItemName
#### Props
**`asChild`**
Type: `(props: ParentProps<'div'>) => Element`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
#### Data Attributes
**`data-scope`**: file-upload
**`data-part`**: item-name
**`data-disabled`**: Present when disabled
### ItemPreviewImage
#### Props
**`asChild`**
Type: `(props: ParentProps<'img'>) => Element`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
#### Data Attributes
**`data-scope`**: file-upload
**`data-part`**: item-preview-image
**`data-disabled`**: Present when disabled
### ItemPreview
#### Props
**`asChild`**
Type: `(props: ParentProps<'div'>) => Element`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
**`type`**
Type: `string`
Required: false
Default Value: `'.*'`
Description: The file type to match against. Matches all file types by default.
#### Data Attributes
**`data-scope`**: file-upload
**`data-part`**: item-preview
**`data-disabled`**: Present when disabled
### Item
#### Props
**`file`**
Type: `File`
Required: true
Default Value: `undefined`
Description: undefined
**`asChild`**
Type: `(props: ParentProps<'li'>) => Element`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
#### Data Attributes
**`data-scope`**: file-upload
**`data-part`**: item
**`data-disabled`**: Present when disabled
### ItemSizeText
#### Props
**`asChild`**
Type: `(props: ParentProps<'div'>) => Element`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
#### Data Attributes
**`data-scope`**: file-upload
**`data-part`**: item-size-text
**`data-disabled`**: Present when disabled
### Label
#### Props
**`asChild`**
Type: `(props: ParentProps<'label'>) => Element`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
#### Data Attributes
**`data-scope`**: file-upload
**`data-part`**: label
**`data-disabled`**: Present when disabled
### RootProvider
#### Props
**`value`**
Type: `UseFileUploadReturn`
Required: true
Default Value: `undefined`
Description: undefined
**`asChild`**
Type: `(props: ParentProps<'div'>) => Element`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
### Trigger
#### Props
**`asChild`**
Type: `(props: ParentProps<'button'>) => Element`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
#### Data Attributes
**`data-scope`**: file-upload
**`data-part`**: trigger
**`data-disabled`**: Present when disabled
**`data-invalid`**: Present when invalid
# File Upload (VUE)
## Anatomy
To set up the file upload component correctly, you'll need to understand its anatomy and how we name its parts.
> Each part includes a `data-part` attribute to help identify them in the DOM.
## Examples
Learn how to use the `FileUpload` component in your project. Let's take a look at the most basic example:
```vue
File UploadDrop your files hereChoose file(s)
Generic Icon
X
```
### Using the Field Component
The `Field` component helps manage form-related state and accessibility attributes of an file upload. It includes
handling ARIA labels, helper text, and error text to ensure proper accessibility.
```vue
LabelSelectAdditional InfoError Info
```
### Using the Root Provider
The `RootProvider` component provides a context for the file-upload. It accepts the value of the `useFile-upload` hook.
You can leverage it to access the component state and methods from outside the file-upload.
```vue
File UploadDrop your files hereChoose file(s)
Generic Icon
X
```
> If you're using the `RootProvider` component, you don't need to use the `Root` component.
## API Reference
### Root
#### Props
**`accept`**
Type: `Record | FileMimeType | FileMimeType[]`
Required: false
Default Value: `undefined`
Description: The accept file types
**`allowDrop`**
Type: `boolean`
Required: false
Default Value: `true`
Description: Whether to allow drag and drop in the dropzone element
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
**`capture`**
Type: `'user' | 'environment'`
Required: false
Default Value: `undefined`
Description: The default camera to use when capturing media
**`directory`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Whether to accept directories, only works in webkit browsers
**`disabled`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Whether the file input is disabled
**`id`**
Type: `string`
Required: false
Default Value: `undefined`
Description: The unique identifier of the machine.
**`ids`**
Type: `Partial<{
root: string
dropzone: string
hiddenInput: string
trigger: string
label: string
item(id: string): string
itemName(id: string): string
itemSizeText(id: string): string
itemPreview(id: string): string
}>`
Required: false
Default Value: `undefined`
Description: The ids of the elements. Useful for composition.
**`invalid`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Whether the file input is invalid
**`locale`**
Type: `string`
Required: false
Default Value: `"en-US"`
Description: The current locale. Based on the BCP 47 definition.
**`maxFiles`**
Type: `number`
Required: false
Default Value: `1`
Description: The maximum number of files
**`maxFileSize`**
Type: `number`
Required: false
Default Value: `Infinity`
Description: The maximum file size in bytes
**`minFileSize`**
Type: `number`
Required: false
Default Value: `0`
Description: The minimum file size in bytes
**`name`**
Type: `string`
Required: false
Default Value: `undefined`
Description: The name of the underlying file input
**`preventDocumentDrop`**
Type: `boolean`
Required: false
Default Value: `true`
Description: Whether to prevent the drop event on the document
**`required`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Whether the file input is required
**`translations`**
Type: `IntlTranslations`
Required: false
Default Value: `undefined`
Description: The localized messages to use.
**`validate`**
Type: `(file: File, details: FileValidateDetails) => FileError[] | null`
Required: false
Default Value: `undefined`
Description: Function to validate a file
#### Emits
**`fileAccept`**
Type: `[details: FileAcceptDetails]`
Description: Function called when the file is accepted
**`fileChange`**
Type: `[details: FileChangeDetails]`
Description: Function called when the value changes, whether accepted or rejected
**`fileReject`**
Type: `[details: FileRejectDetails]`
Description: Function called when the file is rejected
#### Data Attributes
**`data-scope`**: file-upload
**`data-part`**: root
**`data-disabled`**: Present when disabled
**`data-dragging`**: Present when in the dragging state
### ClearTrigger
#### Props
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
#### Data Attributes
**`data-scope`**: file-upload
**`data-part`**: clear-trigger
**`data-disabled`**: Present when disabled
### Dropzone
#### Props
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
**`disableClick`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Whether to disable the click event on the dropzone
#### Data Attributes
**`data-scope`**: file-upload
**`data-part`**: dropzone
**`data-invalid`**: Present when invalid
**`data-disabled`**: Present when disabled
**`data-dragging`**: Present when in the dragging state
### HiddenInput
#### Props
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
### ItemDeleteTrigger
#### Props
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
#### Data Attributes
**`data-scope`**: file-upload
**`data-part`**: item-delete-trigger
**`data-disabled`**: Present when disabled
### ItemGroup
#### Props
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
#### Data Attributes
**`data-scope`**: file-upload
**`data-part`**: item-group
**`data-disabled`**: Present when disabled
### ItemName
#### Props
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
#### Data Attributes
**`data-scope`**: file-upload
**`data-part`**: item-name
**`data-disabled`**: Present when disabled
### ItemPreviewImage
#### Props
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
#### Data Attributes
**`data-scope`**: file-upload
**`data-part`**: item-preview-image
**`data-disabled`**: Present when disabled
### ItemPreview
#### Props
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
**`type`**
Type: `string`
Required: false
Default Value: `'.*'`
Description: The file type to match against. Matches all file types by default.
#### Data Attributes
**`data-scope`**: file-upload
**`data-part`**: item-preview
**`data-disabled`**: Present when disabled
### Item
#### Props
**`file`**
Type: `File`
Required: true
Default Value: `undefined`
Description: undefined
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
#### Data Attributes
**`data-scope`**: file-upload
**`data-part`**: item
**`data-disabled`**: Present when disabled
### ItemSizeText
#### Props
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
#### Data Attributes
**`data-scope`**: file-upload
**`data-part`**: item-size-text
**`data-disabled`**: Present when disabled
### Label
#### Props
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
#### Data Attributes
**`data-scope`**: file-upload
**`data-part`**: label
**`data-disabled`**: Present when disabled
### RootProvider
#### Props
**`value`**
Type: `FileUploadApi`
Required: true
Default Value: `undefined`
Description: undefined
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
### Trigger
#### Props
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
#### Data Attributes
**`data-scope`**: file-upload
**`data-part`**: trigger
**`data-disabled`**: Present when disabled
**`data-invalid`**: Present when invalid
# Hover Card (REACT)
## Anatomy
To set up the hover card correctly, you'll need to understand its anatomy and how we name its parts.
> Each part includes a `data-part` attribute to help identify them in the DOM.
## Examples
Learn how to use the `HoverCard` component in your project. Let's take a look at the most basic example:
```tsx
import { HoverCard } from '@ark-ui/react/hover-card'
import { Portal } from '@ark-ui/react/portal'
export const Basic = () => (
Hover me
Content
)
```
### Controlled HoverCard
The controlled `HoverCard` component provides an interface for managing the state of the hover card using the `open` and
`onOpenChange` props:
```tsx
import { HoverCard } from '@ark-ui/react/hover-card'
import { Portal } from '@ark-ui/react/portal'
import { useState } from 'react'
export const Controlled = () => {
const [isOpen, setOpen] = useState(false)
return (
<>
setOpen(false)}>
Hover me
Content
>
)
}
```
### Custom Positioning
The `HoverCard` component can be customized in its placement and distance from the trigger element through the
`positioning` prop:
```tsx
import { HoverCard } from '@ark-ui/react/hover-card'
import { Portal } from '@ark-ui/react/portal'
export const Positioning = () => (
Hover me
Content
)
```
### Render Prop Usage
The `HoverCard` component can also accept a render prop, giving the user more control over rendering behavior. This is
useful for dynamically updating the trigger based on the state of the `HoverCard`:
```tsx
import { HoverCard } from '@ark-ui/react/hover-card'
import { Portal } from '@ark-ui/react/portal'
export const RenderProp = () => (
{(hoverCard) => Hover me {hoverCard.open ? '▲' : '▼'} }
Content
)
```
### Using the Root Provider
The `RootProvider` component provides a context for the hover-card. It accepts the value of the `useHover-card` hook.
You can leverage it to access the component state and methods from outside the hover-card.
```tsx
import { HoverCard, useHoverCard } from '@ark-ui/react/hover-card'
import { Portal } from '@ark-ui/react/portal'
export const RootProvider = () => {
const hoverCard = useHoverCard()
return (
<>
Hover me
Content
>
)
}
```
> If you're using the `RootProvider` component, you don't need to use the `Root` component.
## API Reference
### Root
#### Props
**`closeDelay`**
Type: `number`
Required: false
Default Value: `300`
Description: The duration from when the mouse leaves the trigger or content until the hover card closes.
**`defaultOpen`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: The initial open state of the hover card when rendered.
Use when you don't need to control the open state of the hover card.
**`id`**
Type: `string`
Required: false
Default Value: `undefined`
Description: The unique identifier of the machine.
**`ids`**
Type: `Partial<{ trigger: string; content: string; positioner: string; arrow: string }>`
Required: false
Default Value: `undefined`
Description: The ids of the elements in the popover. Useful for composition.
**`immediate`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Whether to synchronize the present change immediately or defer it to the next frame
**`lazyMount`**
Type: `boolean`
Required: false
Default Value: `false`
Description: Whether to enable lazy mounting
**`onExitComplete`**
Type: `VoidFunction`
Required: false
Default Value: `undefined`
Description: Function called when the animation ends in the closed state
**`onFocusOutside`**
Type: `(event: FocusOutsideEvent) => void`
Required: false
Default Value: `undefined`
Description: Function called when the focus is moved outside the component
**`onInteractOutside`**
Type: `(event: InteractOutsideEvent) => void`
Required: false
Default Value: `undefined`
Description: Function called when an interaction happens outside the component
**`onOpenChange`**
Type: `(details: OpenChangeDetails) => void`
Required: false
Default Value: `undefined`
Description: Function called when the hover card opens or closes.
**`onPointerDownOutside`**
Type: `(event: PointerDownOutsideEvent) => void`
Required: false
Default Value: `undefined`
Description: Function called when the pointer is pressed down outside the component
**`open`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: The controlled open state of the hover card
**`openDelay`**
Type: `number`
Required: false
Default Value: `700`
Description: The duration from when the mouse enters the trigger until the hover card opens.
**`positioning`**
Type: `PositioningOptions`
Required: false
Default Value: `undefined`
Description: The user provided options used to position the popover content
**`present`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Whether the node is present (controlled by the user)
**`unmountOnExit`**
Type: `boolean`
Required: false
Default Value: `false`
Description: Whether to unmount on exit.
### Arrow
#### Props
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
### ArrowTip
#### Props
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
### Content
#### Props
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
#### Data Attributes
**`data-scope`**: hover-card
**`data-part`**: content
**`data-state`**: "open" | "closed"
**`data-placement`**: The placement of the content
### Positioner
#### Props
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
### RootProvider
#### Props
**`value`**
Type: `UseHoverCardReturn`
Required: true
Default Value: `undefined`
Description: undefined
**`immediate`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Whether to synchronize the present change immediately or defer it to the next frame
**`lazyMount`**
Type: `boolean`
Required: false
Default Value: `false`
Description: Whether to enable lazy mounting
**`onExitComplete`**
Type: `VoidFunction`
Required: false
Default Value: `undefined`
Description: Function called when the animation ends in the closed state
**`present`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Whether the node is present (controlled by the user)
**`unmountOnExit`**
Type: `boolean`
Required: false
Default Value: `false`
Description: Whether to unmount on exit.
### Trigger
#### Props
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
#### Data Attributes
**`data-scope`**: hover-card
**`data-part`**: trigger
**`data-placement`**: The placement of the trigger
**`data-state`**: "open" | "closed"
# Hover Card (SOLID)
## Anatomy
To set up the hover card correctly, you'll need to understand its anatomy and how we name its parts.
> Each part includes a `data-part` attribute to help identify them in the DOM.
## Examples
Learn how to use the `HoverCard` component in your project. Let's take a look at the most basic example:
```tsx
import { HoverCard } from '@ark-ui/solid/hover-card'
import { Portal } from 'solid-js/web'
export const Basic = () => (
Hover me
Content
)
```
### Controlled HoverCard
The controlled `HoverCard` component provides an interface for managing the state of the hover card using the `open` and
`onOpenChange` props:
```tsx
import { HoverCard } from '@ark-ui/solid/hover-card'
import { createSignal } from 'solid-js'
import { Portal } from 'solid-js/web'
export const Controlled = () => {
const [isOpen, setOpen] = createSignal(false)
return (
<>
setOpen(false)}>
Hover me
Content
>
)
}
```
### Custom Positioning
The `HoverCard` component can be customized in its placement and distance from the trigger element through the
`positioning` prop:
```tsx
import { HoverCard } from '@ark-ui/solid/hover-card'
import { Portal } from 'solid-js/web'
export const Positioning = () => (
Hover me
Content
)
```
### Render Prop Usage
The `HoverCard` component can also accept a render prop, giving the user more control over rendering behavior. This is
useful for dynamically updating the trigger based on the state of the `HoverCard`:
```tsx
import { HoverCard } from '@ark-ui/solid/hover-card'
import { Portal } from 'solid-js/web'
export const RenderProp = () => (
{(context) => Hover me {context().open ? '▲' : '▼'} }
Content
)
```
### Using the Root Provider
The `RootProvider` component provides a context for the hover-card. It accepts the value of the `useHover-card` hook.
You can leverage it to access the component state and methods from outside the hover-card.
```tsx
import { HoverCard, useHoverCard } from '@ark-ui/solid/hover-card'
import { Portal } from 'solid-js/web'
export const RootProvider = () => {
const hoverCard = useHoverCard()
return (
<>
Hover me
Content
>
)
}
```
> If you're using the `RootProvider` component, you don't need to use the `Root` component.
## API Reference
### Root
#### Props
**`closeDelay`**
Type: `number`
Required: false
Default Value: `300`
Description: The duration from when the mouse leaves the trigger or content until the hover card closes.
**`defaultOpen`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: The initial open state of the hover card when rendered.
Use when you don't need to control the open state of the hover card.
**`id`**
Type: `string`
Required: false
Default Value: `undefined`
Description: The unique identifier of the machine.
**`ids`**
Type: `Partial<{ trigger: string; content: string; positioner: string; arrow: string }>`
Required: false
Default Value: `undefined`
Description: The ids of the elements in the popover. Useful for composition.
**`immediate`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Whether to synchronize the present change immediately or defer it to the next frame
**`lazyMount`**
Type: `boolean`
Required: false
Default Value: `false`
Description: Whether to enable lazy mounting
**`onExitComplete`**
Type: `VoidFunction`
Required: false
Default Value: `undefined`
Description: Function called when the animation ends in the closed state
**`onFocusOutside`**
Type: `(event: FocusOutsideEvent) => void`
Required: false
Default Value: `undefined`
Description: Function called when the focus is moved outside the component
**`onInteractOutside`**
Type: `(event: InteractOutsideEvent) => void`
Required: false
Default Value: `undefined`
Description: Function called when an interaction happens outside the component
**`onOpenChange`**
Type: `(details: OpenChangeDetails) => void`
Required: false
Default Value: `undefined`
Description: Function called when the hover card opens or closes.
**`onPointerDownOutside`**
Type: `(event: PointerDownOutsideEvent) => void`
Required: false
Default Value: `undefined`
Description: Function called when the pointer is pressed down outside the component
**`open`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: The controlled open state of the hover card
**`openDelay`**
Type: `number`
Required: false
Default Value: `700`
Description: The duration from when the mouse enters the trigger until the hover card opens.
**`positioning`**
Type: `PositioningOptions`
Required: false
Default Value: `undefined`
Description: The user provided options used to position the popover content
**`present`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Whether the node is present (controlled by the user)
**`unmountOnExit`**
Type: `boolean`
Required: false
Default Value: `false`
Description: Whether to unmount on exit.
### Arrow
#### Props
**`asChild`**
Type: `(props: ParentProps<'div'>) => Element`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
### ArrowTip
#### Props
**`asChild`**
Type: `(props: ParentProps<'div'>) => Element`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
### Content
#### Props
**`asChild`**
Type: `(props: ParentProps<'div'>) => Element`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
#### Data Attributes
**`data-scope`**: hover-card
**`data-part`**: content
**`data-state`**: "open" | "closed"
**`data-placement`**: The placement of the content
### Positioner
#### Props
**`asChild`**
Type: `(props: ParentProps<'div'>) => Element`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
### RootProvider
#### Props
**`value`**
Type: `UseHoverCardReturn`
Required: true
Default Value: `undefined`
Description: undefined
**`immediate`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Whether to synchronize the present change immediately or defer it to the next frame
**`lazyMount`**
Type: `boolean`
Required: false
Default Value: `false`
Description: Whether to enable lazy mounting
**`onExitComplete`**
Type: `VoidFunction`
Required: false
Default Value: `undefined`
Description: Function called when the animation ends in the closed state
**`present`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Whether the node is present (controlled by the user)
**`unmountOnExit`**
Type: `boolean`
Required: false
Default Value: `false`
Description: Whether to unmount on exit.
### Trigger
#### Props
**`asChild`**
Type: `(props: ParentProps<'button'>) => Element`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
#### Data Attributes
**`data-scope`**: hover-card
**`data-part`**: trigger
**`data-placement`**: The placement of the trigger
**`data-state`**: "open" | "closed"
# Hover Card (VUE)
## Anatomy
To set up the hover card correctly, you'll need to understand its anatomy and how we name its parts.
> Each part includes a `data-part` attribute to help identify them in the DOM.
## Examples
Learn how to use the `HoverCard` component in your project. Let's take a look at the most basic example:
```vue
Hover me
Content
```
### Controlled HoverCard
The controlled `HoverCard` component provides an interface for managing the state of the hover card using the `open` and
`onOpenChange` props:
```vue
Hover me
Content
```
### Custom Positioning
The `HoverCard` component can be customized in its placement and distance from the trigger element through the
`positioning` prop:
```vue
Hover me
Content
```
### Render Prop Usage
The `HoverCard` component can also accept a render prop, giving the user more control over rendering behavior. This is
useful for dynamically updating the trigger based on the state of the `HoverCard`:
```vue
Hover me {{ hoverCard.open ? '▲' : '▼' }}
Content
```
### Using the Root Provider
The `RootProvider` component provides a context for the hover-card. It accepts the value of the `useHover-card` hook.
You can leverage it to access the component state and methods from outside the hover-card.
```vue
Hover me
Content
```
> If you're using the `RootProvider` component, you don't need to use the `Root` component.
## API Reference
### Root
#### Props
**`closeDelay`**
Type: `number`
Required: false
Default Value: `300`
Description: The duration from when the mouse leaves the trigger or content until the hover card closes.
**`defaultOpen`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: The initial open state of the hover card when rendered.
Use when you don't need to control the open state of the hover card.
**`id`**
Type: `string`
Required: false
Default Value: `undefined`
Description: The unique identifier of the machine.
**`ids`**
Type: `Partial<{ trigger: string; content: string; positioner: string; arrow: string }>`
Required: false
Default Value: `undefined`
Description: The ids of the elements in the popover. Useful for composition.
**`lazyMount`**
Type: `boolean`
Required: false
Default Value: `false`
Description: Whether to enable lazy mounting
**`open`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: The controlled open state of the hover card
**`openDelay`**
Type: `number`
Required: false
Default Value: `700`
Description: The duration from when the mouse enters the trigger until the hover card opens.
**`positioning`**
Type: `PositioningOptions`
Required: false
Default Value: `undefined`
Description: The user provided options used to position the popover content
**`unmountOnExit`**
Type: `boolean`
Required: false
Default Value: `false`
Description: Whether to unmount on exit.
#### Emits
**`focusOutside`**
Type: `[event: FocusOutsideEvent]`
Description: Function called when the focus is moved outside the component
**`interactOutside`**
Type: `[event: InteractOutsideEvent]`
Description: Function called when an interaction happens outside the component
**`openChange`**
Type: `[details: OpenChangeDetails]`
Description: Function called when the hover card opens or closes.
**`pointerDownOutside`**
Type: `[event: PointerDownOutsideEvent]`
Description: Function called when the pointer is pressed down outside the component
**`update:open`**
Type: `[open: boolean]`
Description: The callback fired when the open state changes.
### Arrow
#### Props
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
### ArrowTip
#### Props
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
### Content
#### Props
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
#### Data Attributes
**`data-scope`**: hover-card
**`data-part`**: content
**`data-state`**: "open" | "closed"
**`data-placement`**: The placement of the content
### Positioner
#### Props
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
### RootProvider
#### Props
**`value`**
Type: `HoverCardApi`
Required: true
Default Value: `undefined`
Description: undefined
**`lazyMount`**
Type: `boolean`
Required: false
Default Value: `false`
Description: Whether to enable lazy mounting
**`unmountOnExit`**
Type: `boolean`
Required: false
Default Value: `false`
Description: Whether to unmount on exit.
### Trigger
#### Props
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
#### Data Attributes
**`data-scope`**: hover-card
**`data-part`**: trigger
**`data-placement`**: The placement of the trigger
**`data-state`**: "open" | "closed"
# Menu (REACT)
## Anatomy
To set up the menu correctly, you'll need to understand its anatomy and how we name its parts.
> Each part includes a `data-part` attribute to help identify them in the DOM.
## Examples
Learn how to use the `Menu` component in your project. Let's take a look at the most basic example:
```tsx
import { Menu } from '@ark-ui/react/menu'
export const Basic = () => (
Open menu ➡️ReactSolidVue
)
```
### Listening to item selection
Pass the `onSelect` prop to the Menu component to perform some custom logic when an item is selected. The callback is
invoked with the `id` of the item.
```tsx
import { Menu } from '@ark-ui/react/menu'
import { useState } from 'react'
export const Controlled = () => {
const [isOpen, setIsOpen] = useState(false)
return (
<>
Open menu ➡️ReactSolidVue
>
)
}
```
### Grouping menu items
When the number of menu items gets much, it might be useful to group related menu items. To achieve this, render the
`Menu.ItemGroup` component around the `Menu.Item` components. The `Menu.ItemGroupLabel` component can be used to add a
label to the group.
```tsx
import { Menu } from '@ark-ui/react/menu'
export const Group = () => (
Open menuJS FrameworksReactSolidVueCSS FrameworksPandaTailwind
)
```
### Separating menu items
To separate menu items, render the `Menu.Separator` component.
```tsx
import { Menu } from '@ark-ui/react/menu'
export const Separator = () => (
Open menuReactSolidVue
)
```
### Context menu
To show the menu when a trigger element is right-clicked, use the `Menu.ContextTrigger` component.
Context menus are also opened during a long-press of roughly `700ms` when the pointer is pen or touch.
```tsx
import { Menu } from '@ark-ui/react/menu'
export const Context = () => (
Right click meReactSolidVue
)
```
### Nested menu
To show a nested menu, render another `Menu` component and use the `Menu.TriggerItem` component to open the submenu.
```tsx
import { Menu } from '@ark-ui/react/menu'
import { Portal } from '@ark-ui/react/portal'
export const Nested = () => (
Open menuJS FrameworksReactSolidVueCSS FrameworksPandaTailwind
)
```
### Checkbox
To add a checkbox to a menu item, use the `Menu.Checkbox` component.
```tsx
import { Menu } from '@ark-ui/react/menu'
import { useState } from 'react'
export const Checkbox = () => {
const [checked, setChecked] = useState(false)
return (
Open menu✅Check me
)
}
```
### Radio Group
To group radio option items, use the `Menu.RadioGroup` component.
```tsx
import { Menu } from '@ark-ui/react/menu'
import { useState } from 'react'
export const RadioGroup = () => {
const [value, setValue] = useState('React')
return (
Open menu setValue(e.value)}>
JS Frameworks
{['React', 'Solid', 'Vue'].map((framework) => (
✅{framework}
))}
)
}
```
### Using the Root Provider
The `RootProvider` component provides a context for the menu. It accepts the value of the `useMenu` hook. You can
leverage it to access the component state and methods from outside the menu.
```tsx
import { Menu, useMenu } from '@ark-ui/react/menu'
export const RootProvider = () => {
const menu = useMenu()
return (
<>
Open menu ➡️ReactSolidVue
>
)
}
```
> If you're using the `RootProvider` component, you don't need to use the `Root` component.
## API Reference
### Root
#### Props
**`anchorPoint`**
Type: `Point`
Required: false
Default Value: `undefined`
Description: The positioning point for the menu. Can be set by the context menu trigger or the button trigger.
**`aria-label`**
Type: `string`
Required: false
Default Value: `undefined`
Description: The accessibility label for the menu
**`closeOnSelect`**
Type: `boolean`
Required: false
Default Value: `true`
Description: Whether to close the menu when an option is selected
**`composite`**
Type: `boolean`
Required: false
Default Value: `true`
Description: Whether the menu is a composed with other composite widgets like a combobox or tabs
**`defaultHighlightedValue`**
Type: `string`
Required: false
Default Value: `undefined`
Description: The initial highlighted value of the menu item when rendered.
Use when you don't need to control the highlighted value of the menu item.
**`defaultOpen`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: The initial open state of the menu when rendered.
Use when you don't need to control the open state of the menu.
**`highlightedValue`**
Type: `string`
Required: false
Default Value: `undefined`
Description: The controlled highlighted value of the menu item.
**`id`**
Type: `string`
Required: false
Default Value: `undefined`
Description: The unique identifier of the machine.
**`ids`**
Type: `Partial<{
trigger: string
contextTrigger: string
content: string
groupLabel(id: string): string
group(id: string): string
positioner: string
arrow: string
}>`
Required: false
Default Value: `undefined`
Description: The ids of the elements in the menu. Useful for composition.
**`immediate`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Whether to synchronize the present change immediately or defer it to the next frame
**`lazyMount`**
Type: `boolean`
Required: false
Default Value: `false`
Description: Whether to enable lazy mounting
**`loopFocus`**
Type: `boolean`
Required: false
Default Value: `false`
Description: Whether to loop the keyboard navigation.
**`navigate`**
Type: `(details: NavigateDetails) => void`
Required: false
Default Value: `undefined`
Description: Function to navigate to the selected item if it's an anchor element
**`onEscapeKeyDown`**
Type: `(event: KeyboardEvent) => void`
Required: false
Default Value: `undefined`
Description: Function called when the escape key is pressed
**`onExitComplete`**
Type: `VoidFunction`
Required: false
Default Value: `undefined`
Description: Function called when the animation ends in the closed state
**`onFocusOutside`**
Type: `(event: FocusOutsideEvent) => void`
Required: false
Default Value: `undefined`
Description: Function called when the focus is moved outside the component
**`onHighlightChange`**
Type: `(details: HighlightChangeDetails) => void`
Required: false
Default Value: `undefined`
Description: Function called when the highlighted menu item changes.
**`onInteractOutside`**
Type: `(event: InteractOutsideEvent) => void`
Required: false
Default Value: `undefined`
Description: Function called when an interaction happens outside the component
**`onOpenChange`**
Type: `(details: OpenChangeDetails) => void`
Required: false
Default Value: `undefined`
Description: Function called when the menu opens or closes
**`onPointerDownOutside`**
Type: `(event: PointerDownOutsideEvent) => void`
Required: false
Default Value: `undefined`
Description: Function called when the pointer is pressed down outside the component
**`onSelect`**
Type: `(details: SelectionDetails) => void`
Required: false
Default Value: `undefined`
Description: Function called when a menu item is selected.
**`open`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: The controlled open state of the menu
**`positioning`**
Type: `PositioningOptions`
Required: false
Default Value: `undefined`
Description: The options used to dynamically position the menu
**`present`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Whether the node is present (controlled by the user)
**`typeahead`**
Type: `boolean`
Required: false
Default Value: `true`
Description: Whether the pressing printable characters should trigger typeahead navigation
**`unmountOnExit`**
Type: `boolean`
Required: false
Default Value: `false`
Description: Whether to unmount on exit.
### Arrow
#### Props
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
### ArrowTip
#### Props
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
### CheckboxItem
#### Props
**`checked`**
Type: `boolean`
Required: true
Default Value: `undefined`
Description: Whether the option is checked
**`value`**
Type: `string`
Required: true
Default Value: `undefined`
Description: The value of the option
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
**`closeOnSelect`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Whether the menu should be closed when the option is selected.
**`disabled`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Whether the menu item is disabled
**`onCheckedChange`**
Type: `(checked: boolean) => void`
Required: false
Default Value: `undefined`
Description: Function called when the option state is changed
**`valueText`**
Type: `string`
Required: false
Default Value: `undefined`
Description: The textual value of the option. Used in typeahead navigation of the menu.
If not provided, the text content of the menu item will be used.
### Content
#### Props
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
#### Data Attributes
**`data-scope`**: menu
**`data-part`**: content
**`data-state`**: "open" | "closed"
**`data-placement`**: The placement of the content
### ContextTrigger
#### Props
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
### Indicator
#### Props
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
#### Data Attributes
**`data-scope`**: menu
**`data-part`**: indicator
**`data-state`**: "open" | "closed"
### ItemGroupLabel
#### Props
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
### ItemGroup
#### Props
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
### ItemIndicator
#### Props
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
#### Data Attributes
**`data-scope`**: menu
**`data-part`**: item-indicator
**`data-disabled`**: Present when disabled
**`data-highlighted`**: Present when highlighted
**`data-state`**: "checked" | "unchecked"
### Item
#### Props
**`value`**
Type: `string`
Required: true
Default Value: `undefined`
Description: The unique value of the menu item option.
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
**`closeOnSelect`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Whether the menu should be closed when the option is selected.
**`disabled`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Whether the menu item is disabled
**`valueText`**
Type: `string`
Required: false
Default Value: `undefined`
Description: The textual value of the option. Used in typeahead navigation of the menu.
If not provided, the text content of the menu item will be used.
#### Data Attributes
**`data-scope`**: menu
**`data-part`**: item
**`data-disabled`**: Present when disabled
**`data-highlighted`**: Present when highlighted
**`data-valuetext`**: The human-readable value
### ItemText
#### Props
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
#### Data Attributes
**`data-scope`**: menu
**`data-part`**: item-text
**`data-disabled`**: Present when disabled
**`data-highlighted`**: Present when highlighted
**`data-state`**: "checked" | "unchecked"
### Positioner
#### Props
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
### RadioItemGroup
#### Props
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
**`onValueChange`**
Type: `(e: ValueChangeDetails) => void`
Required: false
Default Value: `undefined`
Description: undefined
**`value`**
Type: `string`
Required: false
Default Value: `undefined`
Description: undefined
### RadioItem
#### Props
**`value`**
Type: `string`
Required: true
Default Value: `undefined`
Description: The value of the option
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
**`closeOnSelect`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Whether the menu should be closed when the option is selected.
**`disabled`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Whether the menu item is disabled
**`valueText`**
Type: `string`
Required: false
Default Value: `undefined`
Description: The textual value of the option. Used in typeahead navigation of the menu.
If not provided, the text content of the menu item will be used.
### RootProvider
#### Props
**`value`**
Type: `UseMenuReturn`
Required: true
Default Value: `undefined`
Description: undefined
**`immediate`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Whether to synchronize the present change immediately or defer it to the next frame
**`lazyMount`**
Type: `boolean`
Required: false
Default Value: `false`
Description: Whether to enable lazy mounting
**`onExitComplete`**
Type: `VoidFunction`
Required: false
Default Value: `undefined`
Description: Function called when the animation ends in the closed state
**`present`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Whether the node is present (controlled by the user)
**`unmountOnExit`**
Type: `boolean`
Required: false
Default Value: `false`
Description: Whether to unmount on exit.
### Separator
#### Props
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
### TriggerItem
#### Props
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
### Trigger
#### Props
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
#### Data Attributes
**`data-scope`**: menu
**`data-part`**: trigger
**`data-placement`**: The placement of the trigger
**`data-state`**: "open" | "closed"
## Accessibility
Complies with the [Menu WAI-ARIA design pattern](https://www.w3.org/WAI/ARIA/apg/patterns/menubar/).
### Keyboard Support
**`Space`**
Description: Activates/Selects the highlighted item
**`Enter`**
Description: Activates/Selects the highlighted item
**`ArrowDown`**
Description: Highlights the next item in the menu
**`ArrowUp`**
Description: Highlights the previous item in the menu
**`ArrowRight + ArrowLeft`**
Description: When focus is on trigger, opens or closes the submenu depending on reading direction.
**`Esc`**
Description: Closes the menu and moves focus to the trigger
# Menu (SOLID)
## Anatomy
To set up the menu correctly, you'll need to understand its anatomy and how we name its parts.
> Each part includes a `data-part` attribute to help identify them in the DOM.
## Examples
Learn how to use the `Menu` component in your project. Let's take a look at the most basic example:
```tsx
import { Menu } from '@ark-ui/solid/menu'
export const Basic = () => (
Open menu ➡️ReactSolidVue
)
```
### Listening to item selection
Pass the `onSelect` prop to the Menu component to perform some custom logic when an item is selected. The callback is
invoked with the `id` of the item.
```tsx
import { Menu } from '@ark-ui/solid/menu'
import { createSignal } from 'solid-js'
export const Controlled = () => {
const [isOpen, setIsOpen] = createSignal(false)
return (
<>
console.log(id)}>
Open menu ➡️ReactSolidVue
>
)
}
```
### Grouping menu items
When the number of menu items gets much, it might be useful to group related menu items. To achieve this, render the
`Menu.ItemGroup` component around the `Menu.Item` components. The `Menu.ItemGroupLabel` component can be used to add a
label to the group.
```tsx
import { Menu } from '@ark-ui/solid/menu'
export const Group = () => (
Open menuJS FrameworksReactSolidVueCSS FrameworksPandaTailwind
)
```
### Separating menu items
To separate menu items, render the `Menu.Separator` component.
```tsx
import { Menu } from '@ark-ui/solid/menu'
export const Separator = () => (
Open menuReactSolidVue
)
```
### Context menu
To show the menu when a trigger element is right-clicked, use the `Menu.ContextTrigger` component.
Context menus are also opened during a long-press of roughly `700ms` when the pointer is pen or touch.
```tsx
import { Menu } from '@ark-ui/solid/menu'
export const Context = () => (
Right click meReactSolidVue
)
```
### Nested menu
To show a nested menu, render another `Menu` component and use the `Menu.TriggerItem` component to open the submenu.
```tsx
import { Menu } from '@ark-ui/solid/menu'
import { Portal } from 'solid-js/web'
export const Nested = () => (
Open menuJS FrameworksReactSolidVueCSS FrameworksPandaTailwind
)
```
### Checkbox
To add a checkbox to a menu item, use the `Menu.Checkbox` component.
```tsx
import { Menu } from '@ark-ui/solid/menu'
import { createSignal } from 'solid-js'
export const Checkbox = () => {
const [checked, setChecked] = createSignal(true)
return (
Open menu✅Check me
)
}
```
### Radio Group
To group radio option items, use the `Menu.RadioGroup` component.
```tsx
import { Menu } from '@ark-ui/solid/menu'
import { Index, createSignal } from 'solid-js'
export const RadioGroup = () => {
const [value, setValue] = createSignal('React')
return (
Open menu setValue(e.value)}>
JS Frameworks
{(framework) => (
✅{framework()}
)}
)
}
```
### Using the Root Provider
The `RootProvider` component provides a context for the menu. It accepts the value of the `useMenu` hook. You can
leverage it to access the component state and methods from outside the menu.
```tsx
import { Menu, useMenu } from '@ark-ui/solid/menu'
export const RootProvider = () => {
const menu = useMenu()
return (
<>
Open menu ➡️ReactSolidVue
>
)
}
```
> If you're using the `RootProvider` component, you don't need to use the `Root` component.
## API Reference
### Root
#### Props
**`anchorPoint`**
Type: `Point`
Required: false
Default Value: `undefined`
Description: The positioning point for the menu. Can be set by the context menu trigger or the button trigger.
**`aria-label`**
Type: `string`
Required: false
Default Value: `undefined`
Description: The accessibility label for the menu
**`closeOnSelect`**
Type: `boolean`
Required: false
Default Value: `true`
Description: Whether to close the menu when an option is selected
**`composite`**
Type: `boolean`
Required: false
Default Value: `true`
Description: Whether the menu is a composed with other composite widgets like a combobox or tabs
**`defaultHighlightedValue`**
Type: `string`
Required: false
Default Value: `undefined`
Description: The initial highlighted value of the menu item when rendered.
Use when you don't need to control the highlighted value of the menu item.
**`defaultOpen`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: The initial open state of the menu when rendered.
Use when you don't need to control the open state of the menu.
**`highlightedValue`**
Type: `string`
Required: false
Default Value: `undefined`
Description: The controlled highlighted value of the menu item.
**`id`**
Type: `string`
Required: false
Default Value: `undefined`
Description: The unique identifier of the machine.
**`ids`**
Type: `Partial<{
trigger: string
contextTrigger: string
content: string
groupLabel(id: string): string
group(id: string): string
positioner: string
arrow: string
}>`
Required: false
Default Value: `undefined`
Description: The ids of the elements in the menu. Useful for composition.
**`immediate`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Whether to synchronize the present change immediately or defer it to the next frame
**`lazyMount`**
Type: `boolean`
Required: false
Default Value: `false`
Description: Whether to enable lazy mounting
**`loopFocus`**
Type: `boolean`
Required: false
Default Value: `false`
Description: Whether to loop the keyboard navigation.
**`navigate`**
Type: `(details: NavigateDetails) => void`
Required: false
Default Value: `undefined`
Description: Function to navigate to the selected item if it's an anchor element
**`onEscapeKeyDown`**
Type: `(event: KeyboardEvent) => void`
Required: false
Default Value: `undefined`
Description: Function called when the escape key is pressed
**`onExitComplete`**
Type: `VoidFunction`
Required: false
Default Value: `undefined`
Description: Function called when the animation ends in the closed state
**`onFocusOutside`**
Type: `(event: FocusOutsideEvent) => void`
Required: false
Default Value: `undefined`
Description: Function called when the focus is moved outside the component
**`onHighlightChange`**
Type: `(details: HighlightChangeDetails) => void`
Required: false
Default Value: `undefined`
Description: Function called when the highlighted menu item changes.
**`onInteractOutside`**
Type: `(event: InteractOutsideEvent) => void`
Required: false
Default Value: `undefined`
Description: Function called when an interaction happens outside the component
**`onOpenChange`**
Type: `(details: OpenChangeDetails) => void`
Required: false
Default Value: `undefined`
Description: Function called when the menu opens or closes
**`onPointerDownOutside`**
Type: `(event: PointerDownOutsideEvent) => void`
Required: false
Default Value: `undefined`
Description: Function called when the pointer is pressed down outside the component
**`onSelect`**
Type: `(details: SelectionDetails) => void`
Required: false
Default Value: `undefined`
Description: Function called when a menu item is selected.
**`open`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: The controlled open state of the menu
**`positioning`**
Type: `PositioningOptions`
Required: false
Default Value: `undefined`
Description: The options used to dynamically position the menu
**`present`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Whether the node is present (controlled by the user)
**`typeahead`**
Type: `boolean`
Required: false
Default Value: `true`
Description: Whether the pressing printable characters should trigger typeahead navigation
**`unmountOnExit`**
Type: `boolean`
Required: false
Default Value: `false`
Description: Whether to unmount on exit.
### Arrow
#### Props
**`asChild`**
Type: `(props: ParentProps<'div'>) => Element`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
### ArrowTip
#### Props
**`asChild`**
Type: `(props: ParentProps<'div'>) => Element`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
### CheckboxItem
#### Props
**`checked`**
Type: `boolean`
Required: true
Default Value: `undefined`
Description: Whether the option is checked
**`value`**
Type: `string`
Required: true
Default Value: `undefined`
Description: The value of the option
**`asChild`**
Type: `(props: ParentProps<'div'>) => Element`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
**`closeOnSelect`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Whether the menu should be closed when the option is selected.
**`disabled`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Whether the menu item is disabled
**`onCheckedChange`**
Type: `(checked: boolean) => void`
Required: false
Default Value: `undefined`
Description: Function called when the option state is changed
**`valueText`**
Type: `string`
Required: false
Default Value: `undefined`
Description: The textual value of the option. Used in typeahead navigation of the menu.
If not provided, the text content of the menu item will be used.
### Content
#### Props
**`asChild`**
Type: `(props: ParentProps<'div'>) => Element`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
#### Data Attributes
**`data-scope`**: menu
**`data-part`**: content
**`data-state`**: "open" | "closed"
**`data-placement`**: The placement of the content
### ContextTrigger
#### Props
**`asChild`**
Type: `(props: ParentProps<'button'>) => Element`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
### Indicator
#### Props
**`asChild`**
Type: `(props: ParentProps<'div'>) => Element`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
#### Data Attributes
**`data-scope`**: menu
**`data-part`**: indicator
**`data-state`**: "open" | "closed"
### ItemGroupLabel
#### Props
**`asChild`**
Type: `(props: ParentProps<'div'>) => Element`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
### ItemGroup
#### Props
**`asChild`**
Type: `(props: ParentProps<'div'>) => Element`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
### ItemIndicator
#### Props
**`asChild`**
Type: `(props: ParentProps<'div'>) => Element`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
#### Data Attributes
**`data-scope`**: menu
**`data-part`**: item-indicator
**`data-disabled`**: Present when disabled
**`data-highlighted`**: Present when highlighted
**`data-state`**: "checked" | "unchecked"
### Item
#### Props
**`value`**
Type: `string`
Required: true
Default Value: `undefined`
Description: The unique value of the menu item option.
**`asChild`**
Type: `(props: ParentProps<'div'>) => Element`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
**`closeOnSelect`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Whether the menu should be closed when the option is selected.
**`disabled`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Whether the menu item is disabled
**`valueText`**
Type: `string`
Required: false
Default Value: `undefined`
Description: The textual value of the option. Used in typeahead navigation of the menu.
If not provided, the text content of the menu item will be used.
#### Data Attributes
**`data-scope`**: menu
**`data-part`**: item
**`data-disabled`**: Present when disabled
**`data-highlighted`**: Present when highlighted
**`data-valuetext`**: The human-readable value
### ItemText
#### Props
**`asChild`**
Type: `(props: ParentProps<'div'>) => Element`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
#### Data Attributes
**`data-scope`**: menu
**`data-part`**: item-text
**`data-disabled`**: Present when disabled
**`data-highlighted`**: Present when highlighted
**`data-state`**: "checked" | "unchecked"
### Positioner
#### Props
**`asChild`**
Type: `(props: ParentProps<'div'>) => Element`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
### RadioItemGroup
#### Props
**`asChild`**
Type: `(props: ParentProps<'div'>) => Element`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
**`onValueChange`**
Type: `(e: ValueChangeDetails) => void`
Required: false
Default Value: `undefined`
Description: undefined
**`value`**
Type: `string`
Required: false
Default Value: `undefined`
Description: undefined
### RadioItem
#### Props
**`value`**
Type: `string`
Required: true
Default Value: `undefined`
Description: The value of the option
**`asChild`**
Type: `(props: ParentProps<'div'>) => Element`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
**`closeOnSelect`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Whether the menu should be closed when the option is selected.
**`disabled`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Whether the menu item is disabled
**`valueText`**
Type: `string`
Required: false
Default Value: `undefined`
Description: The textual value of the option. Used in typeahead navigation of the menu.
If not provided, the text content of the menu item will be used.
### RootProvider
#### Props
**`value`**
Type: `UseMenuReturn`
Required: true
Default Value: `undefined`
Description: undefined
**`immediate`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Whether to synchronize the present change immediately or defer it to the next frame
**`lazyMount`**
Type: `boolean`
Required: false
Default Value: `false`
Description: Whether to enable lazy mounting
**`onExitComplete`**
Type: `VoidFunction`
Required: false
Default Value: `undefined`
Description: Function called when the animation ends in the closed state
**`present`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Whether the node is present (controlled by the user)
**`unmountOnExit`**
Type: `boolean`
Required: false
Default Value: `false`
Description: Whether to unmount on exit.
### Separator
#### Props
**`asChild`**
Type: `(props: ParentProps<'hr'>) => Element`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
### TriggerItem
#### Props
**`asChild`**
Type: `(props: ParentProps<'div'>) => Element`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
### Trigger
#### Props
**`asChild`**
Type: `(props: ParentProps<'button'>) => Element`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
#### Data Attributes
**`data-scope`**: menu
**`data-part`**: trigger
**`data-placement`**: The placement of the trigger
**`data-state`**: "open" | "closed"
## Accessibility
Complies with the [Menu WAI-ARIA design pattern](https://www.w3.org/WAI/ARIA/apg/patterns/menubar/).
### Keyboard Support
**`Space`**
Description: Activates/Selects the highlighted item
**`Enter`**
Description: Activates/Selects the highlighted item
**`ArrowDown`**
Description: Highlights the next item in the menu
**`ArrowUp`**
Description: Highlights the previous item in the menu
**`ArrowRight + ArrowLeft`**
Description: When focus is on trigger, opens or closes the submenu depending on reading direction.
**`Esc`**
Description: Closes the menu and moves focus to the trigger
# Menu (VUE)
## Anatomy
To set up the menu correctly, you'll need to understand its anatomy and how we name its parts.
> Each part includes a `data-part` attribute to help identify them in the DOM.
## Examples
Learn how to use the `Menu` component in your project. Let's take a look at the most basic example:
```vue
Open menu
➡️ReactSolidVue
```
### Listening to item selection
Pass the `onSelect` prop to the Menu component to perform some custom logic when an item is selected. The callback is
invoked with the `id` of the item.
```vue
Open menuReactSolidVue
```
### Grouping menu items
When the number of menu items gets much, it might be useful to group related menu items. To achieve this, render the
`Menu.ItemGroup` component around the `Menu.Item` components. The `Menu.ItemGroupLabel` component can be used to add a
label to the group.
```vue
Open menuJS FrameworksReactSolidVueCSS FrameworksPandaTailwind
```
### Separating menu items
To separate menu items, render the `Menu.Separator` component.
```vue
Open menuReactSolidVue
```
### Context menu
To show the menu when a trigger element is right-clicked, use the `Menu.ContextTrigger` component.
Context menus are also opened during a long-press of roughly `700ms` when the pointer is pen or touch.
```vue
Right click meReactSolidVue
```
### Nested menu
To show a nested menu, render another `Menu` component and use the `Menu.TriggerItem` component to open the submenu.
```vue
Open menuJS FrameworksReactSolidVueCSS FrameworksPandaTailwind
```
### Checkbox
To add a checkbox to a menu item, use the `Menu.Checkbox` component.
```vue
Open menu✅Check me
```
### Radio Group
To group radio option items, use the `Menu.RadioGroup` component.
```vue
Open menuJS Frameworks✅{{ item }}
```
### Using the Root Provider
The `RootProvider` component provides a context for the menu. It accepts the value of the `useMenu` hook. You can
leverage it to access the component state and methods from outside the menu.
```vue
Open menu
➡️ReactSolidVue
```
> If you're using the `RootProvider` component, you don't need to use the `Root` component.
## API Reference
### Root
#### Props
**`anchorPoint`**
Type: `Point`
Required: false
Default Value: `undefined`
Description: The positioning point for the menu. Can be set by the context menu trigger or the button trigger.
**`aria-label`**
Type: `string`
Required: false
Default Value: `undefined`
Description: The accessibility label for the menu
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
**`closeOnSelect`**
Type: `boolean`
Required: false
Default Value: `true`
Description: Whether to close the menu when an option is selected
**`composite`**
Type: `boolean`
Required: false
Default Value: `true`
Description: Whether the menu is a composed with other composite widgets like a combobox or tabs
**`defaultHighlightedValue`**
Type: `string`
Required: false
Default Value: `undefined`
Description: The initial highlighted value of the menu item when rendered.
Use when you don't need to control the highlighted value of the menu item.
**`defaultOpen`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: The initial open state of the menu when rendered.
Use when you don't need to control the open state of the menu.
**`highlightedValue`**
Type: `string`
Required: false
Default Value: `undefined`
Description: The controlled highlighted value of the menu item.
**`id`**
Type: `string`
Required: false
Default Value: `undefined`
Description: The unique identifier of the machine.
**`ids`**
Type: `Partial<{
trigger: string
contextTrigger: string
content: string
groupLabel(id: string): string
group(id: string): string
positioner: string
arrow: string
}>`
Required: false
Default Value: `undefined`
Description: The ids of the elements in the menu. Useful for composition.
**`lazyMount`**
Type: `boolean`
Required: false
Default Value: `false`
Description: Whether to enable lazy mounting
**`loopFocus`**
Type: `boolean`
Required: false
Default Value: `false`
Description: Whether to loop the keyboard navigation.
**`navigate`**
Type: `(details: NavigateDetails) => void`
Required: false
Default Value: `undefined`
Description: Function to navigate to the selected item if it's an anchor element
**`open`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: The controlled open state of the menu
**`positioning`**
Type: `PositioningOptions`
Required: false
Default Value: `undefined`
Description: The options used to dynamically position the menu
**`typeahead`**
Type: `boolean`
Required: false
Default Value: `true`
Description: Whether the pressing printable characters should trigger typeahead navigation
**`unmountOnExit`**
Type: `boolean`
Required: false
Default Value: `false`
Description: Whether to unmount on exit.
#### Emits
**`escapeKeyDown`**
Type: `[event: KeyboardEvent]`
Description: Function called when the escape key is pressed
**`focusOutside`**
Type: `[event: FocusOutsideEvent]`
Description: Function called when the focus is moved outside the component
**`highlightChange`**
Type: `[details: HighlightChangeDetails]`
Description: Function called when the highlighted menu item changes.
**`interactOutside`**
Type: `[event: InteractOutsideEvent]`
Description: Function called when an interaction happens outside the component
**`openChange`**
Type: `[details: OpenChangeDetails]`
Description: Function called when the menu opens or closes
**`pointerDownOutside`**
Type: `[event: PointerDownOutsideEvent]`
Description: Function called when the pointer is pressed down outside the component
**`select`**
Type: `[details: SelectionDetails]`
Description: Function called when a menu item is selected.
**`update:highlightedValue`**
Type: `[highlightedValue: string | null]`
Description: Function called when the highlighted menu item changes.
**`update:open`**
Type: `[open: boolean]`
Description: Function called when the menu is opened or closed.
### Arrow
#### Props
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
### ArrowTip
#### Props
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
### CheckboxItem
#### Props
**`checked`**
Type: `boolean`
Required: true
Default Value: `undefined`
Description: Whether the option is checked
**`value`**
Type: `string`
Required: true
Default Value: `undefined`
Description: The value of the option
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
**`closeOnSelect`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Whether the menu should be closed when the option is selected.
**`disabled`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Whether the menu item is disabled
**`valueText`**
Type: `string`
Required: false
Default Value: `undefined`
Description: The textual value of the option. Used in typeahead navigation of the menu.
If not provided, the text content of the menu item will be used.
#### Emits
**`update:checked`**
Type: `[value: boolean]`
Description: undefined
### Content
#### Props
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
#### Data Attributes
**`data-scope`**: menu
**`data-part`**: content
**`data-state`**: "open" | "closed"
**`data-placement`**: The placement of the content
### ContextTrigger
#### Props
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
### Indicator
#### Props
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
#### Data Attributes
**`data-scope`**: menu
**`data-part`**: indicator
**`data-state`**: "open" | "closed"
### ItemGroupLabel
#### Props
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
### ItemGroup
#### Props
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
**`id`**
Type: `string`
Required: false
Default Value: `undefined`
Description: The `id` of the element that provides accessibility label to the option group
### ItemIndicator
#### Props
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
#### Data Attributes
**`data-scope`**: menu
**`data-part`**: item-indicator
**`data-disabled`**: Present when disabled
**`data-highlighted`**: Present when highlighted
**`data-state`**: "checked" | "unchecked"
### Item
#### Props
**`value`**
Type: `string`
Required: true
Default Value: `undefined`
Description: The unique value of the menu item option.
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
**`closeOnSelect`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Whether the menu should be closed when the option is selected.
**`disabled`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Whether the menu item is disabled
**`valueText`**
Type: `string`
Required: false
Default Value: `undefined`
Description: The textual value of the option. Used in typeahead navigation of the menu.
If not provided, the text content of the menu item will be used.
#### Data Attributes
**`data-scope`**: menu
**`data-part`**: item
**`data-disabled`**: Present when disabled
**`data-highlighted`**: Present when highlighted
**`data-valuetext`**: The human-readable value
### ItemText
#### Props
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
#### Data Attributes
**`data-scope`**: menu
**`data-part`**: item-text
**`data-disabled`**: Present when disabled
**`data-highlighted`**: Present when highlighted
**`data-state`**: "checked" | "unchecked"
### Positioner
#### Props
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
### RadioItemGroup
#### Props
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
**`id`**
Type: `string`
Required: false
Default Value: `undefined`
Description: undefined
**`modelValue`**
Type: `string`
Required: false
Default Value: `undefined`
Description: undefined
#### Emits
**`update:modelValue`**
Type: `[value: string]`
Description: undefined
### RadioItem
#### Props
**`value`**
Type: `string`
Required: true
Default Value: `undefined`
Description: The value of the option
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
**`closeOnSelect`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Whether the menu should be closed when the option is selected.
**`disabled`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Whether the menu item is disabled
**`valueText`**
Type: `string`
Required: false
Default Value: `undefined`
Description: The textual value of the option. Used in typeahead navigation of the menu.
If not provided, the text content of the menu item will be used.
### RootProvider
#### Props
**`value`**
Type: `UseMenuReturn`
Required: true
Default Value: `undefined`
Description: undefined
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
**`lazyMount`**
Type: `boolean`
Required: false
Default Value: `false`
Description: Whether to enable lazy mounting
**`unmountOnExit`**
Type: `boolean`
Required: false
Default Value: `false`
Description: Whether to unmount on exit.
### Separator
#### Props
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
### TriggerItem
#### Props
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
### Trigger
#### Props
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
#### Data Attributes
**`data-scope`**: menu
**`data-part`**: trigger
**`data-placement`**: The placement of the trigger
**`data-state`**: "open" | "closed"
## Accessibility
Complies with the [Menu WAI-ARIA design pattern](https://www.w3.org/WAI/ARIA/apg/patterns/menubar/).
### Keyboard Support
**`Space`**
Description: Activates/Selects the highlighted item
**`Enter`**
Description: Activates/Selects the highlighted item
**`ArrowDown`**
Description: Highlights the next item in the menu
**`ArrowUp`**
Description: Highlights the previous item in the menu
**`ArrowRight + ArrowLeft`**
Description: When focus is on trigger, opens or closes the submenu depending on reading direction.
**`Esc`**
Description: Closes the menu and moves focus to the trigger
# Number Input (REACT)
## Anatomy
To set up the number input correctly, you'll need to understand its anatomy and how we name its parts.
> Each part includes a `data-part` attribute to help identify them in the DOM.
## Examples
Learn how to use the `NumberInput` component in your project. Let's take a look at the most basic example:
```tsx
import { NumberInput } from '@ark-ui/react/number-input'
export const Basic = () => (
Label-1+1
)
```
### Setting a minimum and maximum value
Pass the `min` prop or `max` prop to set an upper and lower limit for the input. By default, the input will restrict the
value to stay within the specified range.
```tsx
import { NumberInput } from '@ark-ui/react/number-input'
export const MinMax = () => (
Label-1+1
)
```
### Adjusting the precision of the value
In some cases, you might need the value to be rounded to specific decimal points. Set the `formatOptions` and provide
`Intl.NumberFormatOptions` such as `maximumFractionDigits` or `minimumFractionDigits`.
```tsx
import { NumberInput } from '@ark-ui/react/number-input'
export const FractionDigits = () => (
Label-1+1
)
```
### Scrubbing the input value
The NumberInput supports the scrubber interaction pattern. To use this pattern, render the `NumberInput.Scrubber`
component. It uses the Pointer lock API and tracks the pointer movement. It also renders a virtual cursor which mimics
the real cursor's pointer.
```tsx
import { NumberInput } from '@ark-ui/react/number-input'
export const Scrubber = () => (
Label-1+1
)
```
### Using the mouse wheel to change value
The NumberInput exposes a way to increment/decrement the value using the mouse wheel event. To activate this, set the
`allowMouseWheel` prop to `true`.
```tsx
import { NumberInput } from '@ark-ui/react/number-input'
export const MouseWheel = () => (
Label-1+1
)
```
### Clamp value when user blurs the input
In most cases, users can type custom values in the input field. If the typed value is greater than the max, the value is
reset to max when the user blur out of the input.
To disable this behavior, pass `clampValueOnBlur` and set to `false`.
```tsx
import { NumberInput } from '@ark-ui/react/number-input'
export const NoClamp = () => (
Label-1+1
)
```
### Usage within forms
To use the number input within forms, set the `name` prop.
```tsx
import { NumberInput } from '@ark-ui/react/number-input'
export const FormUsage = () => (
Label-1+1
)
```
### Format and parse value
To apply custom formatting to the input's value, set the `formatOptions` and provide `Intl.NumberFormatOptions` such as
`style` and `currency`.
```tsx
import { NumberInput } from '@ark-ui/react/number-input'
export const Formatted = () => (
Label-1+1
)
```
### Using the Field Component
The `Field` component helps manage form-related state and accessibility attributes of a number input. It includes
handling ARIA labels, helper text, and error text to ensure proper accessibility.
```tsx
import { Field } from '@ark-ui/react/field'
import { NumberInput } from '@ark-ui/react/number-input'
export const WithField = (props: Field.RootProps) => (
Label-1+1Additional InfoError Info
)
```
### Using the Root Provider
The `RootProvider` component provides a context for the number-input. It accepts the value of the `useNumber-input`
hook. You can leverage it to access the component state and methods from outside the number-input.
```tsx
import { NumberInput, useNumberInput } from '@ark-ui/react/number-input'
export const RootProvider = () => {
const numberInput = useNumberInput()
return (
<>
Label-1+1
>
)
}
```
> If you're using the `RootProvider` component, you don't need to use the `Root` component.
## API Reference
### Root
#### Props
**`allowMouseWheel`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Whether to allow mouse wheel to change the value
**`allowOverflow`**
Type: `boolean`
Required: false
Default Value: `true`
Description: Whether to allow the value overflow the min/max range
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
**`clampValueOnBlur`**
Type: `boolean`
Required: false
Default Value: `true`
Description: Whether to clamp the value when the input loses focus (blur)
**`defaultValue`**
Type: `string`
Required: false
Default Value: `undefined`
Description: The initial value of the input when rendered.
Use when you don't need to control the value of the input.
**`disabled`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Whether the number input is disabled.
**`focusInputOnChange`**
Type: `boolean`
Required: false
Default Value: `true`
Description: Whether to focus input when the value changes
**`form`**
Type: `string`
Required: false
Default Value: `undefined`
Description: The associate form of the input element.
**`formatOptions`**
Type: `NumberFormatOptions`
Required: false
Default Value: `undefined`
Description: The options to pass to the `Intl.NumberFormat` constructor
**`id`**
Type: `string`
Required: false
Default Value: `undefined`
Description: The unique identifier of the machine.
**`ids`**
Type: `Partial<{
root: string
label: string
input: string
incrementTrigger: string
decrementTrigger: string
scrubber: string
}>`
Required: false
Default Value: `undefined`
Description: The ids of the elements in the number input. Useful for composition.
**`inputMode`**
Type: `InputMode`
Required: false
Default Value: `"decimal"`
Description: Hints at the type of data that might be entered by the user. It also determines
the type of keyboard shown to the user on mobile devices
**`invalid`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Whether the number input value is invalid.
**`locale`**
Type: `string`
Required: false
Default Value: `"en-US"`
Description: The current locale. Based on the BCP 47 definition.
**`max`**
Type: `number`
Required: false
Default Value: `Number.MAX_SAFE_INTEGER`
Description: The maximum value of the number input
**`min`**
Type: `number`
Required: false
Default Value: `Number.MIN_SAFE_INTEGER`
Description: The minimum value of the number input
**`name`**
Type: `string`
Required: false
Default Value: `undefined`
Description: The name attribute of the number input. Useful for form submission.
**`onFocusChange`**
Type: `(details: FocusChangeDetails) => void`
Required: false
Default Value: `undefined`
Description: Function invoked when the number input is focused
**`onValueChange`**
Type: `(details: ValueChangeDetails) => void`
Required: false
Default Value: `undefined`
Description: Function invoked when the value changes
**`onValueInvalid`**
Type: `(details: ValueInvalidDetails) => void`
Required: false
Default Value: `undefined`
Description: Function invoked when the value overflows or underflows the min/max range
**`pattern`**
Type: `string`
Required: false
Default Value: `"[0-9]*(.[0-9]+)?"`
Description: The pattern used to check the element's value against
**`readOnly`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Whether the number input is readonly
**`required`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Whether the number input is required
**`spinOnPress`**
Type: `boolean`
Required: false
Default Value: `true`
Description: Whether to spin the value when the increment/decrement button is pressed
**`step`**
Type: `number`
Required: false
Default Value: `1`
Description: The amount to increment or decrement the value by
**`translations`**
Type: `IntlTranslations`
Required: false
Default Value: `undefined`
Description: Specifies the localized strings that identifies the accessibility elements and their states
**`value`**
Type: `string`
Required: false
Default Value: `undefined`
Description: The controlled value of the input
#### Data Attributes
**`data-scope`**: number-input
**`data-part`**: root
**`data-disabled`**: Present when disabled
**`data-focus`**: Present when focused
**`data-invalid`**: Present when invalid
### Control
#### Props
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
#### Data Attributes
**`data-scope`**: number-input
**`data-part`**: control
**`data-focus`**: Present when focused
**`data-disabled`**: Present when disabled
**`data-invalid`**: Present when invalid
### DecrementTrigger
#### Props
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
#### Data Attributes
**`data-scope`**: number-input
**`data-part`**: decrement-trigger
**`data-disabled`**: Present when disabled
### IncrementTrigger
#### Props
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
#### Data Attributes
**`data-scope`**: number-input
**`data-part`**: increment-trigger
**`data-disabled`**: Present when disabled
### Input
#### Props
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
#### Data Attributes
**`data-scope`**: number-input
**`data-part`**: input
**`data-invalid`**: Present when invalid
**`data-disabled`**: Present when disabled
### Label
#### Props
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
#### Data Attributes
**`data-scope`**: number-input
**`data-part`**: label
**`data-disabled`**: Present when disabled
**`data-focus`**: Present when focused
**`data-invalid`**: Present when invalid
### RootProvider
#### Props
**`value`**
Type: `UseNumberInputReturn`
Required: true
Default Value: `undefined`
Description: undefined
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
### Scrubber
#### Props
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
#### Data Attributes
**`data-scope`**: number-input
**`data-part`**: scrubber
**`data-disabled`**: Present when disabled
### ValueText
#### Props
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
#### Data Attributes
**`data-scope`**: number-input
**`data-part`**: value-text
**`data-disabled`**: Present when disabled
**`data-invalid`**: Present when invalid
**`data-focus`**: Present when focused
## Accessibility
Complies with the [Spinbutton WAI-ARIA design pattern](https://www.w3.org/WAI/ARIA/apg/patterns/spinbutton/).
### Keyboard Support
**`ArrowUp`**
Description: Increments the value of the number input by a predefined step.
**`ArrowDown`**
Description: Decrements the value of the number input by a predefined step.
**`PageUp`**
Description: Increments the value of the number input by a larger predefined step.
**`PageDown`**
Description: Decrements the value of the number input by a larger predefined step.
**`Home`**
Description: Sets the value of the number input to its minimum allowed value.
**`End`**
Description: Sets the value of the number input to its maximum allowed value.
**`Enter`**
Description: Submits the value entered in the number input.
# Number Input (SOLID)
## Anatomy
To set up the number input correctly, you'll need to understand its anatomy and how we name its parts.
> Each part includes a `data-part` attribute to help identify them in the DOM.
## Examples
Learn how to use the `NumberInput` component in your project. Let's take a look at the most basic example:
```tsx
import { NumberInput } from '@ark-ui/solid/number-input'
export const Basic = () => (
Label-1+1
)
```
### Setting a minimum and maximum value
Pass the `min` prop or `max` prop to set an upper and lower limit for the input. By default, the input will restrict the
value to stay within the specified range.
```tsx
import { NumberInput } from '@ark-ui/solid/number-input'
export const MinMax = () => (
Label-1+1
)
```
### Adjusting the precision of the value
In some cases, you might need the value to be rounded to specific decimal points. Set the `formatOptions` and provide
`Intl.NumberFormatOptions` such as `maximumFractionDigits` or `minimumFractionDigits`.
```tsx
import { NumberInput } from '@ark-ui/solid/number-input'
export const FractionDigits = () => (
Label-1+1
)
```
### Scrubbing the input value
The NumberInput supports the scrubber interaction pattern. To use this pattern, render the `NumberInput.Scrubber`
component. It uses the Pointer lock API and tracks the pointer movement. It also renders a virtual cursor which mimics
the real cursor's pointer.
```tsx
import { NumberInput } from '@ark-ui/solid/number-input'
export const Scrubber = () => (
Label-1+1
)
```
### Using the mouse wheel to change value
The NumberInput exposes a way to increment/decrement the value using the mouse wheel event. To activate this, set the
`allowMouseWheel` prop to `true`.
```tsx
import { NumberInput } from '@ark-ui/solid/number-input'
export const MouseWheel = () => (
Label-1+1
)
```
### Clamp value when user blurs the input
In most cases, users can type custom values in the input field. If the typed value is greater than the max, the value is
reset to max when the user blur out of the input.
To disable this behavior, pass `clampValueOnBlur` and set to `false`.
```tsx
import { NumberInput } from '@ark-ui/solid/number-input'
export const NoClamp = () => (
Label-1+1
)
```
### Usage within forms
To use the number input within forms, set the `name` prop.
```tsx
import { NumberInput } from '@ark-ui/solid/number-input'
export const FormUsage = () => (
Label-1+1
)
```
### Format and parse value
To apply custom formatting to the input's value, set the `formatOptions` and provide `Intl.NumberFormatOptions` such as
`style` and `currency`.
```tsx
import { NumberInput } from '@ark-ui/solid/number-input'
export const Formatted = () => (
Label-1+1
)
```
### Using the Field Component
The `Field` component helps manage form-related state and accessibility attributes of a number input. It includes
handling ARIA labels, helper text, and error text to ensure proper accessibility.
```tsx
import { Field } from '@ark-ui/solid/field'
import { NumberInput } from '@ark-ui/solid/number-input'
export const WithField = (props: Field.RootProps) => (
Label-1+1Additional InfoError Info
)
```
### Using the Root Provider
The `RootProvider` component provides a context for the number-input. It accepts the value of the `useNumber-input`
hook. You can leverage it to access the component state and methods from outside the number-input.
```tsx
import { NumberInput, useNumberInput } from '@ark-ui/solid/number-input'
export const RootProvider = () => {
const numberInput = useNumberInput()
return (
<>
Label-1+1
>
)
}
```
> If you're using the `RootProvider` component, you don't need to use the `Root` component.
## API Reference
### Root
#### Props
**`allowMouseWheel`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Whether to allow mouse wheel to change the value
**`allowOverflow`**
Type: `boolean`
Required: false
Default Value: `true`
Description: Whether to allow the value overflow the min/max range
**`asChild`**
Type: `(props: ParentProps<'div'>) => Element`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
**`clampValueOnBlur`**
Type: `boolean`
Required: false
Default Value: `true`
Description: Whether to clamp the value when the input loses focus (blur)
**`defaultValue`**
Type: `string`
Required: false
Default Value: `undefined`
Description: The initial value of the input when rendered.
Use when you don't need to control the value of the input.
**`disabled`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Whether the number input is disabled.
**`focusInputOnChange`**
Type: `boolean`
Required: false
Default Value: `true`
Description: Whether to focus input when the value changes
**`form`**
Type: `string`
Required: false
Default Value: `undefined`
Description: The associate form of the input element.
**`formatOptions`**
Type: `NumberFormatOptions`
Required: false
Default Value: `undefined`
Description: The options to pass to the `Intl.NumberFormat` constructor
**`id`**
Type: `string`
Required: false
Default Value: `undefined`
Description: The unique identifier of the machine.
**`ids`**
Type: `Partial<{
root: string
label: string
input: string
incrementTrigger: string
decrementTrigger: string
scrubber: string
}>`
Required: false
Default Value: `undefined`
Description: The ids of the elements in the number input. Useful for composition.
**`inputMode`**
Type: `InputMode`
Required: false
Default Value: `"decimal"`
Description: Hints at the type of data that might be entered by the user. It also determines
the type of keyboard shown to the user on mobile devices
**`invalid`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Whether the number input value is invalid.
**`locale`**
Type: `string`
Required: false
Default Value: `"en-US"`
Description: The current locale. Based on the BCP 47 definition.
**`max`**
Type: `number`
Required: false
Default Value: `Number.MAX_SAFE_INTEGER`
Description: The maximum value of the number input
**`min`**
Type: `number`
Required: false
Default Value: `Number.MIN_SAFE_INTEGER`
Description: The minimum value of the number input
**`name`**
Type: `string`
Required: false
Default Value: `undefined`
Description: The name attribute of the number input. Useful for form submission.
**`onFocusChange`**
Type: `(details: FocusChangeDetails) => void`
Required: false
Default Value: `undefined`
Description: Function invoked when the number input is focused
**`onValueChange`**
Type: `(details: ValueChangeDetails) => void`
Required: false
Default Value: `undefined`
Description: Function invoked when the value changes
**`onValueInvalid`**
Type: `(details: ValueInvalidDetails) => void`
Required: false
Default Value: `undefined`
Description: Function invoked when the value overflows or underflows the min/max range
**`pattern`**
Type: `string`
Required: false
Default Value: `"[0-9]*(.[0-9]+)?"`
Description: The pattern used to check the element's value against
**`readOnly`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Whether the number input is readonly
**`required`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Whether the number input is required
**`spinOnPress`**
Type: `boolean`
Required: false
Default Value: `true`
Description: Whether to spin the value when the increment/decrement button is pressed
**`step`**
Type: `number`
Required: false
Default Value: `1`
Description: The amount to increment or decrement the value by
**`translations`**
Type: `IntlTranslations`
Required: false
Default Value: `undefined`
Description: Specifies the localized strings that identifies the accessibility elements and their states
**`value`**
Type: `string`
Required: false
Default Value: `undefined`
Description: The controlled value of the input
#### Data Attributes
**`data-scope`**: number-input
**`data-part`**: root
**`data-disabled`**: Present when disabled
**`data-focus`**: Present when focused
**`data-invalid`**: Present when invalid
### Control
#### Props
**`asChild`**
Type: `(props: ParentProps<'div'>) => Element`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
#### Data Attributes
**`data-scope`**: number-input
**`data-part`**: control
**`data-focus`**: Present when focused
**`data-disabled`**: Present when disabled
**`data-invalid`**: Present when invalid
### DecrementTrigger
#### Props
**`asChild`**
Type: `(props: ParentProps<'button'>) => Element`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
#### Data Attributes
**`data-scope`**: number-input
**`data-part`**: decrement-trigger
**`data-disabled`**: Present when disabled
### IncrementTrigger
#### Props
**`asChild`**
Type: `(props: ParentProps<'button'>) => Element`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
#### Data Attributes
**`data-scope`**: number-input
**`data-part`**: increment-trigger
**`data-disabled`**: Present when disabled
### Input
#### Props
**`asChild`**
Type: `(props: ParentProps<'input'>) => Element`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
#### Data Attributes
**`data-scope`**: number-input
**`data-part`**: input
**`data-invalid`**: Present when invalid
**`data-disabled`**: Present when disabled
### Label
#### Props
**`asChild`**
Type: `(props: ParentProps<'label'>) => Element`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
#### Data Attributes
**`data-scope`**: number-input
**`data-part`**: label
**`data-disabled`**: Present when disabled
**`data-focus`**: Present when focused
**`data-invalid`**: Present when invalid
### RootProvider
#### Props
**`value`**
Type: `UseNumberInputReturn`
Required: true
Default Value: `undefined`
Description: undefined
**`asChild`**
Type: `(props: ParentProps<'div'>) => Element`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
### Scrubber
#### Props
**`asChild`**
Type: `(props: ParentProps<'div'>) => Element`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
#### Data Attributes
**`data-scope`**: number-input
**`data-part`**: scrubber
**`data-disabled`**: Present when disabled
### ValueText
#### Props
**`asChild`**
Type: `(props: ParentProps<'span'>) => Element`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
#### Data Attributes
**`data-scope`**: number-input
**`data-part`**: value-text
**`data-disabled`**: Present when disabled
**`data-invalid`**: Present when invalid
**`data-focus`**: Present when focused
## Accessibility
Complies with the [Spinbutton WAI-ARIA design pattern](https://www.w3.org/WAI/ARIA/apg/patterns/spinbutton/).
### Keyboard Support
**`ArrowUp`**
Description: Increments the value of the number input by a predefined step.
**`ArrowDown`**
Description: Decrements the value of the number input by a predefined step.
**`PageUp`**
Description: Increments the value of the number input by a larger predefined step.
**`PageDown`**
Description: Decrements the value of the number input by a larger predefined step.
**`Home`**
Description: Sets the value of the number input to its minimum allowed value.
**`End`**
Description: Sets the value of the number input to its maximum allowed value.
**`Enter`**
Description: Submits the value entered in the number input.
# Number Input (VUE)
## Anatomy
To set up the number input correctly, you'll need to understand its anatomy and how we name its parts.
> Each part includes a `data-part` attribute to help identify them in the DOM.
## Examples
Learn how to use the `NumberInput` component in your project. Let's take a look at the most basic example:
```vue
Label-1+1
```
### Setting a minimum and maximum value
Pass the `min` prop or `max` prop to set an upper and lower limit for the input. By default, the input will restrict the
value to stay within the specified range.
```vue
Label-1+1
```
### Adjusting the precision of the value
In some cases, you might need the value to be rounded to specific decimal points. Set the `formatOptions` and provide
`Intl.NumberFormatOptions` such as `maximumFractionDigits` or `minimumFractionDigits`.
```vue
Label-1+1
```
### Scrubbing the input value
The NumberInput supports the scrubber interaction pattern. To use this pattern, render the `NumberInput.Scrubber`
component. It uses the Pointer lock API and tracks the pointer movement. It also renders a virtual cursor which mimics
the real cursor's pointer.
```vue
Label-1+1
```
### Using the mouse wheel to change value
The NumberInput exposes a way to increment/decrement the value using the mouse wheel event. To activate this, set the
`allowMouseWheel` prop to `true`.
```vue
Label-1+1
```
### Clamp value when user blurs the input
In most cases, users can type custom values in the input field. If the typed value is greater than the max, the value is
reset to max when the user blur out of the input.
To disable this behavior, pass `clampValueOnBlur` and set to `false`.
```vue
Label-1+1
```
### Usage within forms
To use the number input within forms, set the `name` prop.
```vue
Label-1+1
```
### Format and parse value
To apply custom formatting to the input's value, set the `formatOptions` and provide `Intl.NumberFormatOptions` such as
`style` and `currency`.
```vue
Label-1+1
```
### Using the Field Component
The `Field` component helps manage form-related state and accessibility attributes of a number input. It includes
handling ARIA labels, helper text, and error text to ensure proper accessibility.
```vue
Label-1+1Additional InfoError Info
```
### Using the Root Provider
The `RootProvider` component provides a context for the number-input. It accepts the value of the `useNumber-input`
hook. You can leverage it to access the component state and methods from outside the number-input.
```vue
Label-1+1
```
> If you're using the `RootProvider` component, you don't need to use the `Root` component.
## API Reference
### Root
#### Props
**`allowMouseWheel`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Whether to allow mouse wheel to change the value
**`allowOverflow`**
Type: `boolean`
Required: false
Default Value: `true`
Description: Whether to allow the value overflow the min/max range
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
**`clampValueOnBlur`**
Type: `boolean`
Required: false
Default Value: `true`
Description: Whether to clamp the value when the input loses focus (blur)
**`defaultValue`**
Type: `string`
Required: false
Default Value: `undefined`
Description: The initial value of the input when rendered.
Use when you don't need to control the value of the input.
**`disabled`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Whether the number input is disabled.
**`focusInputOnChange`**
Type: `boolean`
Required: false
Default Value: `true`
Description: Whether to focus input when the value changes
**`form`**
Type: `string`
Required: false
Default Value: `undefined`
Description: The associate form of the input element.
**`formatOptions`**
Type: `NumberFormatOptions`
Required: false
Default Value: `undefined`
Description: The options to pass to the `Intl.NumberFormat` constructor
**`id`**
Type: `string`
Required: false
Default Value: `undefined`
Description: The unique identifier of the machine.
**`ids`**
Type: `Partial<{
root: string
label: string
input: string
incrementTrigger: string
decrementTrigger: string
scrubber: string
}>`
Required: false
Default Value: `undefined`
Description: The ids of the elements in the number input. Useful for composition.
**`inputMode`**
Type: `'text' | 'tel' | 'numeric' | 'decimal'`
Required: false
Default Value: `"decimal"`
Description: Hints at the type of data that might be entered by the user. It also determines
the type of keyboard shown to the user on mobile devices
**`invalid`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Whether the number input value is invalid.
**`locale`**
Type: `string`
Required: false
Default Value: `"en-US"`
Description: The current locale. Based on the BCP 47 definition.
**`max`**
Type: `number`
Required: false
Default Value: `Number.MAX_SAFE_INTEGER`
Description: The maximum value of the number input
**`min`**
Type: `number`
Required: false
Default Value: `Number.MIN_SAFE_INTEGER`
Description: The minimum value of the number input
**`modelValue`**
Type: `string`
Required: false
Default Value: `undefined`
Description: The v-model value of the number input
**`name`**
Type: `string`
Required: false
Default Value: `undefined`
Description: The name attribute of the number input. Useful for form submission.
**`pattern`**
Type: `string`
Required: false
Default Value: `"[0-9]*(.[0-9]+)?"`
Description: The pattern used to check the element's value against
**`readOnly`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Whether the number input is readonly
**`required`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Whether the number input is required
**`spinOnPress`**
Type: `boolean`
Required: false
Default Value: `true`
Description: Whether to spin the value when the increment/decrement button is pressed
**`step`**
Type: `number`
Required: false
Default Value: `1`
Description: The amount to increment or decrement the value by
**`translations`**
Type: `IntlTranslations`
Required: false
Default Value: `undefined`
Description: Specifies the localized strings that identifies the accessibility elements and their states
#### Emits
**`focusChange`**
Type: `[details: FocusChangeDetails]`
Description: Function invoked when the number input is focused
**`update:modelValue`**
Type: `[value: string]`
Description: The callback fired when the model value changes.
**`valueChange`**
Type: `[details: ValueChangeDetails]`
Description: Function invoked when the value changes
**`valueInvalid`**
Type: `[details: ValueInvalidDetails]`
Description: Function invoked when the value overflows or underflows the min/max range
#### Data Attributes
**`data-scope`**: number-input
**`data-part`**: root
**`data-disabled`**: Present when disabled
**`data-focus`**: Present when focused
**`data-invalid`**: Present when invalid
### Control
#### Props
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
#### Data Attributes
**`data-scope`**: number-input
**`data-part`**: control
**`data-focus`**: Present when focused
**`data-disabled`**: Present when disabled
**`data-invalid`**: Present when invalid
### DecrementTrigger
#### Props
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
#### Data Attributes
**`data-scope`**: number-input
**`data-part`**: decrement-trigger
**`data-disabled`**: Present when disabled
### IncrementTrigger
#### Props
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
#### Data Attributes
**`data-scope`**: number-input
**`data-part`**: increment-trigger
**`data-disabled`**: Present when disabled
### Input
#### Props
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
#### Data Attributes
**`data-scope`**: number-input
**`data-part`**: input
**`data-invalid`**: Present when invalid
**`data-disabled`**: Present when disabled
### Label
#### Props
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
#### Data Attributes
**`data-scope`**: number-input
**`data-part`**: label
**`data-disabled`**: Present when disabled
**`data-focus`**: Present when focused
**`data-invalid`**: Present when invalid
### RootProvider
#### Props
**`value`**
Type: `NumberInputApi`
Required: true
Default Value: `undefined`
Description: undefined
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
### Scrubber
#### Props
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
#### Data Attributes
**`data-scope`**: number-input
**`data-part`**: scrubber
**`data-disabled`**: Present when disabled
### ValueText
#### Props
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
#### Data Attributes
**`data-scope`**: number-input
**`data-part`**: value-text
**`data-disabled`**: Present when disabled
**`data-invalid`**: Present when invalid
**`data-focus`**: Present when focused
## Accessibility
Complies with the [Spinbutton WAI-ARIA design pattern](https://www.w3.org/WAI/ARIA/apg/patterns/spinbutton/).
### Keyboard Support
**`ArrowUp`**
Description: Increments the value of the number input by a predefined step.
**`ArrowDown`**
Description: Decrements the value of the number input by a predefined step.
**`PageUp`**
Description: Increments the value of the number input by a larger predefined step.
**`PageDown`**
Description: Decrements the value of the number input by a larger predefined step.
**`Home`**
Description: Sets the value of the number input to its minimum allowed value.
**`End`**
Description: Sets the value of the number input to its maximum allowed value.
**`Enter`**
Description: Submits the value entered in the number input.
# Pagination (REACT)
## Anatomy
To set up the pagination correctly, you'll need to understand its anatomy and how we name its parts.
> Each part includes a `data-part` attribute to help identify them in the DOM.
## Examples
Learn how to use the `Pagination` component in your project. Let's take a look at the most basic example:
```tsx
import { Pagination } from '@ark-ui/react/pagination'
export const Basic = () => (
Previous Page
{(pagination) =>
pagination.pages.map((page, index) =>
page.type === 'page' ? (
{page.value}
) : (
…
),
)
}
Next Page
)
```
### Controlled Pagination
To create a controlled Pagination component, manage the state of the current page using the `page` prop and update it
when the `onPageChange` event handler is called:
```tsx
import { Pagination } from '@ark-ui/react/pagination'
import { useState } from 'react'
export const Controlled = () => {
const [currentPage, setCurrentPage] = useState(1)
return (
setCurrentPage(details.page)}
>
Previous
{(pagination) =>
pagination.pages.map((page, index) =>
page.type === 'page' ? (
{page.value}
) : (
…
),
)
}
Next Page
)
}
```
### Customizing Pagination
You can customize the Pagination component by setting various props such as `dir`, `pageSize`, `siblingCount`, and
`translations`. Here's an example of a customized Pagination:
```tsx
import { Pagination } from '@ark-ui/react/pagination'
export const Customized = () => (
`Page ${details.page}`,
}}
>
Previous
{(pagination) =>
pagination.pages.map((page, index) =>
page.type === 'page' ? (
{page.value}
) : (
…
),
)
}
Next Page
)
```
### Using the Root Provider
The `RootProvider` component provides a context for the pagination. It accepts the value of the `usePagination` hook.
You can leverage it to access the component state and methods from outside the pagination.
```tsx
import { Pagination, usePagination } from '@ark-ui/react/pagination'
export const RootProvider = () => {
const pagination = usePagination({ count: 5000, pageSize: 10, siblingCount: 2 })
return (
<>
Previous Page
{(pagination) =>
pagination.pages.map((page, index) =>
page.type === 'page' ? (
{page.value}
) : (
…
),
)
}
Next Page
>
)
}
```
> If you're using the `RootProvider` component, you don't need to use the `Root` component.
## API Reference
### Root
#### Props
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
**`count`**
Type: `number`
Required: false
Default Value: `undefined`
Description: Total number of data items
**`defaultPage`**
Type: `number`
Required: false
Default Value: `1`
Description: The initial active page when rendered.
Use when you don't need to control the active page of the pagination.
**`defaultPageSize`**
Type: `number`
Required: false
Default Value: `10`
Description: The initial number of data items per page when rendered.
Use when you don't need to control the page size of the pagination.
**`ids`**
Type: `Partial<{
root: string
ellipsis(index: number): string
prevTrigger: string
nextTrigger: string
item(page: number): string
}>`
Required: false
Default Value: `undefined`
Description: The ids of the elements in the accordion. Useful for composition.
**`onPageChange`**
Type: `(details: PageChangeDetails) => void`
Required: false
Default Value: `undefined`
Description: Called when the page number is changed
**`onPageSizeChange`**
Type: `(details: PageSizeChangeDetails) => void`
Required: false
Default Value: `undefined`
Description: Called when the page size is changed
**`page`**
Type: `number`
Required: false
Default Value: `undefined`
Description: The controlled active page
**`pageSize`**
Type: `number`
Required: false
Default Value: `undefined`
Description: The controlled number of data items per page
**`siblingCount`**
Type: `number`
Required: false
Default Value: `1`
Description: Number of pages to show beside active page
**`translations`**
Type: `IntlTranslations`
Required: false
Default Value: `undefined`
Description: Specifies the localized strings that identifies the accessibility elements and their states
**`type`**
Type: `'button' | 'link'`
Required: false
Default Value: `"button"`
Description: The type of the trigger element
### Ellipsis
#### Props
**`index`**
Type: `number`
Required: true
Default Value: `undefined`
Description: undefined
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
### Item
#### Props
**`type`**
Type: `'page'`
Required: true
Default Value: `undefined`
Description: undefined
**`value`**
Type: `number`
Required: true
Default Value: `undefined`
Description: undefined
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
#### Data Attributes
**`data-scope`**: pagination
**`data-part`**: item
**`data-index`**: The index of the item
**`data-selected`**: Present when selected
### NextTrigger
#### Props
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
#### Data Attributes
**`data-scope`**: pagination
**`data-part`**: next-trigger
**`data-disabled`**: Present when disabled
### PrevTrigger
#### Props
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
#### Data Attributes
**`data-scope`**: pagination
**`data-part`**: prev-trigger
**`data-disabled`**: Present when disabled
### RootProvider
#### Props
**`value`**
Type: `UsePaginationReturn`
Required: true
Default Value: `undefined`
Description: undefined
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
# Pagination (SOLID)
## Anatomy
To set up the pagination correctly, you'll need to understand its anatomy and how we name its parts.
> Each part includes a `data-part` attribute to help identify them in the DOM.
## Examples
Learn how to use the `Pagination` component in your project. Let's take a look at the most basic example:
```tsx
import { Pagination } from '@ark-ui/solid/pagination'
import { For } from 'solid-js'
export const Basic = () => (
Previous Page
{(api) => (
{(page, index) =>
page.type === 'page' ? (
{page.value}
) : (
…
)
}
)}
Next Page
)
```
### Controlled Pagination
To create a controlled Pagination component, manage the state of the current page using the `page` prop and update it
when the `onPageChange` event handler is called:
```tsx
import { Pagination } from '@ark-ui/solid/pagination'
import { For, createSignal } from 'solid-js'
export const Controlled = () => {
const [currentPage, setCurrentPage] = createSignal(1)
return (
setCurrentPage(details.page)}
>
Previous Page
{(api) => (
{(page, index) =>
page.type === 'page' ? (
{page.value}
) : (
…
)
}
)}
Next Page
)
}
```
### Customizing Pagination
You can customize the Pagination component by setting various props such as `dir`, `pageSize`, `siblingCount`, and
`translations`. Here's an example of a customized Pagination:
```tsx
import { Pagination } from '@ark-ui/solid/pagination'
import { For } from 'solid-js'
export const Customized = () => {
return (
`Page ${details.page}`,
}}
>
Previous Page
{(api) => (
{(page, index) =>
page.type === 'page' ? (
{page.value}
) : (
…
)
}
)}
Next Page
)
}
```
### Using the Root Provider
The `RootProvider` component provides a context for the pagination. It accepts the value of the `usePagination` hook.
You can leverage it to access the component state and methods from outside the pagination.
```tsx
import { Pagination, usePagination } from '@ark-ui/solid/pagination'
import { For } from 'solid-js'
export const RootProvider = () => {
const pagination = usePagination({ count: 5000, pageSize: 10, siblingCount: 2 })
return (
<>
Previous Page
{(api) => (
{(page, index) =>
page.type === 'page' ? (
{page.value}
) : (
…
)
}
)}
Next Page
>
)
}
```
> If you're using the `RootProvider` component, you don't need to use the `Root` component.
## API Reference
### Root
#### Props
**`asChild`**
Type: `(props: ParentProps<'nav'>) => Element`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
**`count`**
Type: `number`
Required: false
Default Value: `undefined`
Description: Total number of data items
**`defaultPage`**
Type: `number`
Required: false
Default Value: `1`
Description: The initial active page when rendered.
Use when you don't need to control the active page of the pagination.
**`defaultPageSize`**
Type: `number`
Required: false
Default Value: `10`
Description: The initial number of data items per page when rendered.
Use when you don't need to control the page size of the pagination.
**`ids`**
Type: `Partial<{
root: string
ellipsis(index: number): string
prevTrigger: string
nextTrigger: string
item(page: number): string
}>`
Required: false
Default Value: `undefined`
Description: The ids of the elements in the accordion. Useful for composition.
**`onPageChange`**
Type: `(details: PageChangeDetails) => void`
Required: false
Default Value: `undefined`
Description: Called when the page number is changed
**`onPageSizeChange`**
Type: `(details: PageSizeChangeDetails) => void`
Required: false
Default Value: `undefined`
Description: Called when the page size is changed
**`page`**
Type: `number`
Required: false
Default Value: `undefined`
Description: The controlled active page
**`pageSize`**
Type: `number`
Required: false
Default Value: `undefined`
Description: The controlled number of data items per page
**`siblingCount`**
Type: `number`
Required: false
Default Value: `1`
Description: Number of pages to show beside active page
**`translations`**
Type: `IntlTranslations`
Required: false
Default Value: `undefined`
Description: Specifies the localized strings that identifies the accessibility elements and their states
**`type`**
Type: `'link' | 'button'`
Required: false
Default Value: `"button"`
Description: The type of the trigger element
### Ellipsis
#### Props
**`index`**
Type: `number`
Required: true
Default Value: `undefined`
Description: undefined
**`asChild`**
Type: `(props: ParentProps<'div'>) => Element`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
### Item
#### Props
**`type`**
Type: `'page'`
Required: true
Default Value: `undefined`
Description: undefined
**`value`**
Type: `number`
Required: true
Default Value: `undefined`
Description: undefined
**`asChild`**
Type: `(props: ParentProps<'button'>) => Element`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
#### Data Attributes
**`data-scope`**: pagination
**`data-part`**: item
**`data-index`**: The index of the item
**`data-selected`**: Present when selected
### NextTrigger
#### Props
**`asChild`**
Type: `(props: ParentProps<'button'>) => Element`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
#### Data Attributes
**`data-scope`**: pagination
**`data-part`**: next-trigger
**`data-disabled`**: Present when disabled
### PrevTrigger
#### Props
**`asChild`**
Type: `(props: ParentProps<'button'>) => Element`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
#### Data Attributes
**`data-scope`**: pagination
**`data-part`**: prev-trigger
**`data-disabled`**: Present when disabled
### RootProvider
#### Props
**`value`**
Type: `UsePaginationReturn`
Required: true
Default Value: `undefined`
Description: undefined
**`asChild`**
Type: `(props: ParentProps<'nav'>) => Element`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
# Pagination (VUE)
## Anatomy
To set up the pagination correctly, you'll need to understand its anatomy and how we name its parts.
> Each part includes a `data-part` attribute to help identify them in the DOM.
## Examples
Learn how to use the `Pagination` component in your project. Let's take a look at the most basic example:
```vue
Previous
Page
{{ page.value }}
…
Next
Page
```
### Controlled Pagination
To create a controlled Pagination component, manage the state of the current page using the `page` prop and update it
when the `onPageChange` event handler is called:
```vue
Example not found```
### Customizing Pagination
You can customize the Pagination component by setting various props such as `dir`, `pageSize`, `siblingCount`, and
`translations`. Here's an example of a customized Pagination:
```vue
Previous
Page
{{ page.value }}
…
Next
Page
```
### Using the Root Provider
The `RootProvider` component provides a context for the pagination. It accepts the value of the `usePagination` hook.
You can leverage it to access the component state and methods from outside the pagination.
```vue
Previous
Page
{{ page.value }}
…
Next
Page
```
> If you're using the `RootProvider` component, you don't need to use the `Root` component.
## API Reference
### Root
#### Props
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
**`count`**
Type: `number`
Required: false
Default Value: `undefined`
Description: Total number of data items
**`defaultPage`**
Type: `number`
Required: false
Default Value: `1`
Description: The initial active page when rendered.
Use when you don't need to control the active page of the pagination.
**`defaultPageSize`**
Type: `number`
Required: false
Default Value: `10`
Description: The initial number of data items per page when rendered.
Use when you don't need to control the page size of the pagination.
**`id`**
Type: `string`
Required: false
Default Value: `undefined`
Description: The unique identifier of the machine.
**`ids`**
Type: `Partial<{
root: string
ellipsis(index: number): string
prevTrigger: string
nextTrigger: string
item(page: number): string
}>`
Required: false
Default Value: `undefined`
Description: The ids of the elements in the accordion. Useful for composition.
**`page`**
Type: `number`
Required: false
Default Value: `undefined`
Description: The controlled active page
**`pageSize`**
Type: `number`
Required: false
Default Value: `undefined`
Description: The controlled number of data items per page
**`siblingCount`**
Type: `number`
Required: false
Default Value: `1`
Description: Number of pages to show beside active page
**`translations`**
Type: `IntlTranslations`
Required: false
Default Value: `undefined`
Description: Specifies the localized strings that identifies the accessibility elements and their states
**`type`**
Type: `'button' | 'link'`
Required: false
Default Value: `"button"`
Description: The type of the trigger element
#### Emits
**`pageChange`**
Type: `[details: PageChangeDetails]`
Description: Called when the page number is changed
**`pageSizeChange`**
Type: `[details: PageSizeChangeDetails]`
Description: Called when the page size is changed
**`update:page`**
Type: `[page: number]`
Description: The callback fired when the model value changes.
**`update:pageSize`**
Type: `[pageSize: number]`
Description: The callback fired when the model value changes.
### Ellipsis
#### Props
**`index`**
Type: `number`
Required: true
Default Value: `undefined`
Description: undefined
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
### Item
#### Props
**`type`**
Type: `'page'`
Required: true
Default Value: `undefined`
Description: undefined
**`value`**
Type: `number`
Required: true
Default Value: `undefined`
Description: undefined
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
#### Data Attributes
**`data-scope`**: pagination
**`data-part`**: item
**`data-index`**: The index of the item
**`data-selected`**: Present when selected
### NextTrigger
#### Props
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
#### Data Attributes
**`data-scope`**: pagination
**`data-part`**: next-trigger
**`data-disabled`**: Present when disabled
### PrevTrigger
#### Props
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
#### Data Attributes
**`data-scope`**: pagination
**`data-part`**: prev-trigger
**`data-disabled`**: Present when disabled
### RootProvider
#### Props
**`value`**
Type: `PaginationApi`
Required: true
Default Value: `undefined`
Description: undefined
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
# Pin Input (REACT)
## Anatomy
To set up the pin input correctly, you'll need to understand its anatomy and how we name its parts.
> Each part includes a `data-part` attribute to help identify them in the DOM.
## Examples
Learn how to use the `PinInput` component in your project. Let's take a look at the most basic example:
```tsx
import { PinInput } from '@ark-ui/react/pin-input'
export const Basic = () => (
alert(e.valueAsString)}>
Label
{[0, 1, 2].map((id, index) => (
))}
)
```
### Setting a default value
To set the initial value of the pin input, set the `defaultValue` prop.
```tsx
import { PinInput } from '@ark-ui/react/pin-input'
export const InitialValue = () => (
Label
{[0, 1, 2].map((id, index) => (
))}
)
```
### Changing the placeholder
To customize the default pin input placeholder `○` for each input, pass the placeholder prop and set it to your desired
value.
```tsx
import { PinInput } from '@ark-ui/react/pin-input'
export const Customized = () => (
Label
{[0, 1, 2].map((id, index) => (
))}
)
```
### Blur on complete
By default, the last input maintains focus when filled, and we invoke the `onValueComplete` callback. To blur the last
input when the user completes the input, set the prop `blurOnComplete` to `true`.
```tsx
import { PinInput } from '@ark-ui/react/pin-input'
export const Blurred = () => (
Label
{[0, 1, 2].map((id, index) => (
))}
)
```
### Using OTP mode
To trigger smartphone OTP auto-suggestion, it is recommended to set the `autocomplete` attribute to "one-time-code". The
pin input component provides support for this automatically when you set the `otp` prop to true.
```tsx
import { PinInput } from '@ark-ui/react/pin-input'
export const OTPMode = () => (
Label
{[0, 1, 2].map((id, index) => (
))}
)
```
### Securing the text input
When collecting private or sensitive information using the pin input, you might need to mask the value entered, similar
to ``. Pass the `mask` prop to `true`.
```tsx
import { PinInput } from '@ark-ui/react/pin-input'
export const WithMask = () => (
Label
{[0, 1, 2].map((id, index) => (
))}
)
```
### Listening for changes
The pin input component invokes several callback functions when the user enters:
- `onValueChange` — Callback invoked when the value is changed.
- `onValueComplete` — Callback invoked when all fields have been completed (by typing or pasting).
- `onValueInvalid` — Callback invoked when an invalid value is entered into the input. An invalid value is any value
that doesn't match the specified "type".
### Using the Field Component
The `Field` component helps manage form-related state and accessibility attributes of a pin input. It includes handling
ARIA labels, helper text, and error text to ensure proper accessibility.
```tsx
import { Field } from '@ark-ui/react/field'
import { PinInput } from '@ark-ui/react/pin-input'
export const WithField = (props: Field.RootProps) => (
Label
{[0, 1, 2].map((id, index) => (
))}
Additional InfoError Info
)
```
### Using the Root Provider
The `RootProvider` component provides a context for the pin-input. It accepts the value of the `usePin-input` hook. You
can leverage it to access the component state and methods from outside the pin-input.
```tsx
import { PinInput, usePinInput } from '@ark-ui/react/pin-input'
export const RootProvider = () => {
const pinInput = usePinInput({ onValueComplete: (e) => alert(e.valueAsString) })
return (
<>
Label
{[0, 1, 2].map((id, index) => (
))}
>
)
}
```
> If you're using the `RootProvider` component, you don't need to use the `Root` component.
## API Reference
### Root
#### Props
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
**`autoFocus`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Whether to auto-focus the first input.
**`blurOnComplete`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Whether to blur the input when the value is complete
**`count`**
Type: `number`
Required: false
Default Value: `undefined`
Description: The number of inputs to render to improve SSR aria attributes.
This will be required in next major version.
**`defaultValue`**
Type: `string[]`
Required: false
Default Value: `undefined`
Description: The initial value of the the pin input when rendered.
Use when you don't need to control the value of the pin input.
**`disabled`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Whether the inputs are disabled
**`form`**
Type: `string`
Required: false
Default Value: `undefined`
Description: The associate form of the underlying input element.
**`id`**
Type: `string`
Required: false
Default Value: `undefined`
Description: The unique identifier of the machine.
**`ids`**
Type: `Partial<{
root: string
hiddenInput: string
label: string
control: string
input(id: string): string
}>`
Required: false
Default Value: `undefined`
Description: The ids of the elements in the pin input. Useful for composition.
**`invalid`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Whether the pin input is in the invalid state
**`mask`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: If `true`, the input's value will be masked just like `type=password`
**`name`**
Type: `string`
Required: false
Default Value: `undefined`
Description: The name of the input element. Useful for form submission.
**`onValueChange`**
Type: `(details: ValueChangeDetails) => void`
Required: false
Default Value: `undefined`
Description: Function called on input change
**`onValueComplete`**
Type: `(details: ValueChangeDetails) => void`
Required: false
Default Value: `undefined`
Description: Function called when all inputs have valid values
**`onValueInvalid`**
Type: `(details: ValueInvalidDetails) => void`
Required: false
Default Value: `undefined`
Description: Function called when an invalid value is entered
**`otp`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: If `true`, the pin input component signals to its fields that they should
use `autocomplete="one-time-code"`.
**`pattern`**
Type: `string`
Required: false
Default Value: `undefined`
Description: The regular expression that the user-entered input value is checked against.
**`placeholder`**
Type: `string`
Required: false
Default Value: `"○"`
Description: The placeholder text for the input
**`readOnly`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Whether the pin input is in the valid state
**`required`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Whether the pin input is required
**`selectOnFocus`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Whether to select input value when input is focused
**`translations`**
Type: `IntlTranslations`
Required: false
Default Value: `undefined`
Description: Specifies the localized strings that identifies the accessibility elements and their states
**`type`**
Type: `'numeric' | 'alphabetic' | 'alphanumeric'`
Required: false
Default Value: `"numeric"`
Description: The type of value the pin-input should allow
**`value`**
Type: `string[]`
Required: false
Default Value: `undefined`
Description: The controlled value of the the pin input.
#### Data Attributes
**`data-scope`**: pin-input
**`data-part`**: root
**`data-invalid`**: Present when invalid
**`data-disabled`**: Present when disabled
**`data-complete`**: Present when the pin-input value is complete
**`data-readonly`**: Present when read-only
### Control
#### Props
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
### HiddenInput
#### Props
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
### Input
#### Props
**`index`**
Type: `number`
Required: true
Default Value: `undefined`
Description: undefined
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
#### Data Attributes
**`data-scope`**: pin-input
**`data-part`**: input
**`data-disabled`**: Present when disabled
**`data-complete`**: Present when the input value is complete
**`data-index`**: The index of the item
**`data-invalid`**: Present when invalid
### Label
#### Props
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
#### Data Attributes
**`data-scope`**: pin-input
**`data-part`**: label
**`data-invalid`**: Present when invalid
**`data-disabled`**: Present when disabled
**`data-complete`**: Present when the label value is complete
**`data-readonly`**: Present when read-only
### RootProvider
#### Props
**`value`**
Type: `UsePinInputReturn`
Required: true
Default Value: `undefined`
Description: undefined
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
## Accessibility
### Keyboard Support
**`ArrowLeft`**
Description: Moves focus to the previous input
**`ArrowRight`**
Description: Moves focus to the next input
**`Backspace`**
Description: Deletes the value in the current input and moves focus to the previous input
**`Delete`**
Description: Deletes the value in the current input
**`Control + V`**
Description: Pastes the value into the input fields
# Pin Input (SOLID)
## Anatomy
To set up the pin input correctly, you'll need to understand its anatomy and how we name its parts.
> Each part includes a `data-part` attribute to help identify them in the DOM.
## Examples
Learn how to use the `PinInput` component in your project. Let's take a look at the most basic example:
```tsx
import { PinInput } from '@ark-ui/solid/pin-input'
import { Index } from 'solid-js'
export const Basic = () => (
alert(e.valueAsString)}>
Label{(id) => }
)
```
### Setting a default value
To set the initial value of the pin input, set the `defaultValue` prop.
```tsx
import { PinInput } from '@ark-ui/solid/pin-input'
import { Index } from 'solid-js'
export const InitialValue = () => (
Label{(id) => }
)
```
### Changing the placeholder
To customize the default pin input placeholder `○` for each input, pass the placeholder prop and set it to your desired
value.
```tsx
import { PinInput } from '@ark-ui/solid/pin-input'
import { Index } from 'solid-js'
export const Customized = () => (
Label{(id) => }
)
```
### Blur on complete
By default, the last input maintains focus when filled, and we invoke the `onValueComplete` callback. To blur the last
input when the user completes the input, set the prop `blurOnComplete` to `true`.
```tsx
import { PinInput } from '@ark-ui/solid/pin-input'
import { Index } from 'solid-js'
export const Blurred = () => (
Label{(id) => }
)
```
### Using OTP mode
To trigger smartphone OTP auto-suggestion, it is recommended to set the `autocomplete` attribute to "one-time-code". The
pin input component provides support for this automatically when you set the `otp` prop to true.
```tsx
import { PinInput } from '@ark-ui/solid/pin-input'
import { Index } from 'solid-js'
export const OTPMode = () => (
Label{(id) => }
)
```
### Securing the text input
When collecting private or sensitive information using the pin input, you might need to mask the value entered, similar
to ``. Pass the `mask` prop to `true`.
```tsx
import { PinInput } from '@ark-ui/solid/pin-input'
import { Index } from 'solid-js'
export const WithMask = () => (
Label{(id) => }
)
```
### Listening for changes
The pin input component invokes several callback functions when the user enters:
- `onValueChange` — Callback invoked when the value is changed.
- `onValueComplete` — Callback invoked when all fields have been completed (by typing or pasting).
- `onValueInvalid` — Callback invoked when an invalid value is entered into the input. An invalid value is any value
that doesn't match the specified "type".
### Using the Field Component
The `Field` component helps manage form-related state and accessibility attributes of a pin input. It includes handling
ARIA labels, helper text, and error text to ensure proper accessibility.
```tsx
import { Field } from '@ark-ui/solid/field'
import { PinInput } from '@ark-ui/solid/pin-input'
import { Index } from 'solid-js'
export const WithField = (props: Field.RootProps) => (
Label{(id) => }Additional InfoError Info
)
```
### Using the Root Provider
The `RootProvider` component provides a context for the pin-input. It accepts the value of the `usePin-input` hook. You
can leverage it to access the component state and methods from outside the pin-input.
```tsx
import { PinInput, usePinInput } from '@ark-ui/solid/pin-input'
import { Index } from 'solid-js'
export const RootProvider = () => {
const pinInput = usePinInput({ onValueComplete: (e) => alert(e.valueAsString) })
return (
<>
Label{(id) => }
>
)
}
```
> If you're using the `RootProvider` component, you don't need to use the `Root` component.
## API Reference
### Root
#### Props
**`asChild`**
Type: `(props: ParentProps<'div'>) => Element`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
**`autoFocus`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Whether to auto-focus the first input.
**`blurOnComplete`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Whether to blur the input when the value is complete
**`count`**
Type: `number`
Required: false
Default Value: `undefined`
Description: The number of inputs to render to improve SSR aria attributes.
This will be required in next major version.
**`defaultValue`**
Type: `string[]`
Required: false
Default Value: `undefined`
Description: The initial value of the the pin input when rendered.
Use when you don't need to control the value of the pin input.
**`disabled`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Whether the inputs are disabled
**`form`**
Type: `string`
Required: false
Default Value: `undefined`
Description: The associate form of the underlying input element.
**`ids`**
Type: `Partial<{
root: string
hiddenInput: string
label: string
control: string
input(id: string): string
}>`
Required: false
Default Value: `undefined`
Description: The ids of the elements in the pin input. Useful for composition.
**`invalid`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Whether the pin input is in the invalid state
**`mask`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: If `true`, the input's value will be masked just like `type=password`
**`name`**
Type: `string`
Required: false
Default Value: `undefined`
Description: The name of the input element. Useful for form submission.
**`onValueChange`**
Type: `(details: ValueChangeDetails) => void`
Required: false
Default Value: `undefined`
Description: Function called on input change
**`onValueComplete`**
Type: `(details: ValueChangeDetails) => void`
Required: false
Default Value: `undefined`
Description: Function called when all inputs have valid values
**`onValueInvalid`**
Type: `(details: ValueInvalidDetails) => void`
Required: false
Default Value: `undefined`
Description: Function called when an invalid value is entered
**`otp`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: If `true`, the pin input component signals to its fields that they should
use `autocomplete="one-time-code"`.
**`pattern`**
Type: `string`
Required: false
Default Value: `undefined`
Description: The regular expression that the user-entered input value is checked against.
**`placeholder`**
Type: `string`
Required: false
Default Value: `"○"`
Description: The placeholder text for the input
**`readOnly`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Whether the pin input is in the valid state
**`required`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Whether the pin input is required
**`selectOnFocus`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Whether to select input value when input is focused
**`translations`**
Type: `IntlTranslations`
Required: false
Default Value: `undefined`
Description: Specifies the localized strings that identifies the accessibility elements and their states
**`type`**
Type: `'numeric' | 'alphabetic' | 'alphanumeric'`
Required: false
Default Value: `"numeric"`
Description: The type of value the pin-input should allow
**`value`**
Type: `string[]`
Required: false
Default Value: `undefined`
Description: The controlled value of the the pin input.
#### Data Attributes
**`data-scope`**: pin-input
**`data-part`**: root
**`data-invalid`**: Present when invalid
**`data-disabled`**: Present when disabled
**`data-complete`**: Present when the pin-input value is complete
**`data-readonly`**: Present when read-only
### Control
#### Props
**`asChild`**
Type: `(props: ParentProps<'div'>) => Element`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
### HiddenInput
#### Props
**`asChild`**
Type: `(props: ParentProps<'input'>) => Element`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
### Input
#### Props
**`index`**
Type: `number`
Required: true
Default Value: `undefined`
Description: undefined
**`asChild`**
Type: `(props: ParentProps<'input'>) => Element`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
#### Data Attributes
**`data-scope`**: pin-input
**`data-part`**: input
**`data-disabled`**: Present when disabled
**`data-complete`**: Present when the input value is complete
**`data-index`**: The index of the item
**`data-invalid`**: Present when invalid
### Label
#### Props
**`asChild`**
Type: `(props: ParentProps<'label'>) => Element`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
#### Data Attributes
**`data-scope`**: pin-input
**`data-part`**: label
**`data-invalid`**: Present when invalid
**`data-disabled`**: Present when disabled
**`data-complete`**: Present when the label value is complete
**`data-readonly`**: Present when read-only
### RootProvider
#### Props
**`value`**
Type: `UsePinInputReturn`
Required: true
Default Value: `undefined`
Description: undefined
**`asChild`**
Type: `(props: ParentProps<'div'>) => Element`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
## Accessibility
### Keyboard Support
**`ArrowLeft`**
Description: Moves focus to the previous input
**`ArrowRight`**
Description: Moves focus to the next input
**`Backspace`**
Description: Deletes the value in the current input and moves focus to the previous input
**`Delete`**
Description: Deletes the value in the current input
**`Control + V`**
Description: Pastes the value into the input fields
# Pin Input (VUE)
## Anatomy
To set up the pin input correctly, you'll need to understand its anatomy and how we name its parts.
> Each part includes a `data-part` attribute to help identify them in the DOM.
## Examples
Learn how to use the `PinInput` component in your project. Let's take a look at the most basic example:
```vue
Label
```
### Setting a default value
To set the initial value of the pin input, set the `defaultValue` prop.
```vue
Label
```
### Changing the placeholder
To customize the default pin input placeholder `○` for each input, pass the placeholder prop and set it to your desired
value.
```vue
Label
```
### Blur on complete
By default, the last input maintains focus when filled, and we invoke the `onValueComplete` callback. To blur the last
input when the user completes the input, set the prop `blurOnComplete` to `true`.
```vue
Label
```
### Using OTP mode
To trigger smartphone OTP auto-suggestion, it is recommended to set the `autocomplete` attribute to "one-time-code". The
pin input component provides support for this automatically when you set the `otp` prop to true.
```vue
Label
```
### Securing the text input
When collecting private or sensitive information using the pin input, you might need to mask the value entered, similar
to ``. Pass the `mask` prop to `true`.
```vue
Label
```
### Listening for changes
The pin input component invokes several callback functions when the user enters:
- `onValueChange` — Callback invoked when the value is changed.
- `onValueComplete` — Callback invoked when all fields have been completed (by typing or pasting).
- `onValueInvalid` — Callback invoked when an invalid value is entered into the input. An invalid value is any value
that doesn't match the specified "type".
### Using the Field Component
The `Field` component helps manage form-related state and accessibility attributes of a pin input. It includes handling
ARIA labels, helper text, and error text to ensure proper accessibility.
```vue
LabelAdditional InfoError Info
```
### Using the Root Provider
The `RootProvider` component provides a context for the pin-input. It accepts the value of the `usePin-input` hook. You
can leverage it to access the component state and methods from outside the pin-input.
```vue
Label
```
> If you're using the `RootProvider` component, you don't need to use the `Root` component.
## API Reference
### Root
#### Props
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
**`autoFocus`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Whether to auto-focus the first input.
**`blurOnComplete`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Whether to blur the input when the value is complete
**`count`**
Type: `number`
Required: false
Default Value: `undefined`
Description: The number of inputs to render to improve SSR aria attributes.
This will be required in next major version.
**`defaultValue`**
Type: `string[]`
Required: false
Default Value: `undefined`
Description: The initial value of the the pin input when rendered.
Use when you don't need to control the value of the pin input.
**`disabled`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Whether the inputs are disabled
**`form`**
Type: `string`
Required: false
Default Value: `undefined`
Description: The associate form of the underlying input element.
**`id`**
Type: `string`
Required: false
Default Value: `undefined`
Description: The unique identifier of the machine.
**`ids`**
Type: `Partial<{
root: string
hiddenInput: string
label: string
control: string
input(id: string): string
}>`
Required: false
Default Value: `undefined`
Description: The ids of the elements in the pin input. Useful for composition.
**`invalid`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Whether the pin input is in the invalid state
**`mask`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: If `true`, the input's value will be masked just like `type=password`
**`modelValue`**
Type: `string[]`
Required: false
Default Value: `undefined`
Description: The v-model value of the pin input
**`name`**
Type: `string`
Required: false
Default Value: `undefined`
Description: The name of the input element. Useful for form submission.
**`otp`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: If `true`, the pin input component signals to its fields that they should
use `autocomplete="one-time-code"`.
**`pattern`**
Type: `string`
Required: false
Default Value: `undefined`
Description: The regular expression that the user-entered input value is checked against.
**`placeholder`**
Type: `string`
Required: false
Default Value: `"○"`
Description: The placeholder text for the input
**`readOnly`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Whether the pin input is in the valid state
**`required`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Whether the pin input is required
**`selectOnFocus`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Whether to select input value when input is focused
**`translations`**
Type: `IntlTranslations`
Required: false
Default Value: `undefined`
Description: Specifies the localized strings that identifies the accessibility elements and their states
**`type`**
Type: `'numeric' | 'alphabetic' | 'alphanumeric'`
Required: false
Default Value: `"numeric"`
Description: The type of value the pin-input should allow
#### Emits
**`update:modelValue`**
Type: `[value: string[]]`
Description: The callback fired when the model value changes.
**`valueChange`**
Type: `[details: ValueChangeDetails]`
Description: Function called on input change
**`valueComplete`**
Type: `[details: ValueChangeDetails]`
Description: Function called when all inputs have valid values
**`valueInvalid`**
Type: `[details: ValueInvalidDetails]`
Description: Function called when an invalid value is entered
#### Data Attributes
**`data-scope`**: pin-input
**`data-part`**: root
**`data-invalid`**: Present when invalid
**`data-disabled`**: Present when disabled
**`data-complete`**: Present when the pin-input value is complete
**`data-readonly`**: Present when read-only
### Control
#### Props
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
### HiddenInput
#### Props
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
### Input
#### Props
**`index`**
Type: `number`
Required: true
Default Value: `undefined`
Description: undefined
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
#### Data Attributes
**`data-scope`**: pin-input
**`data-part`**: input
**`data-disabled`**: Present when disabled
**`data-complete`**: Present when the input value is complete
**`data-index`**: The index of the item
**`data-invalid`**: Present when invalid
### Label
#### Props
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
#### Data Attributes
**`data-scope`**: pin-input
**`data-part`**: label
**`data-invalid`**: Present when invalid
**`data-disabled`**: Present when disabled
**`data-complete`**: Present when the label value is complete
**`data-readonly`**: Present when read-only
### RootProvider
#### Props
**`value`**
Type: `PinInputApi`
Required: true
Default Value: `undefined`
Description: undefined
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
## Accessibility
### Keyboard Support
**`ArrowLeft`**
Description: Moves focus to the previous input
**`ArrowRight`**
Description: Moves focus to the next input
**`Backspace`**
Description: Deletes the value in the current input and moves focus to the previous input
**`Delete`**
Description: Deletes the value in the current input
**`Control + V`**
Description: Pastes the value into the input fields
# Popover (REACT)
## Anatomy
To set up the popover correctly, you'll need to understand its anatomy and how we name its parts.
> Each part includes a `data-part` attribute to help identify them in the DOM.
## Examples
Learn how to use the `Popover` component in your project. Let's take a look at the most basic example:
```tsx
import { Popover } from '@ark-ui/react/popover'
import { ChevronRightIcon } from 'lucide-react'
export const Basic = () => (
Click Me
TitleDescription
)
```
### Using a Portal
By default, the popover is rendered in the same DOM hierarchy as the trigger. To render the popover within a portal, set
the `portalled` prop to `true`.
> Note: This requires that you render the component within a `Portal` based on the framework you use.
```tsx
import { Popover } from '@ark-ui/react/popover'
import { Portal } from '@ark-ui/react/portal'
import { ChevronRightIcon } from 'lucide-react'
export const Portalled = () => (
Click Me
TitleDescription
)
```
### Adding an arrow
To render an arrow within the popover, render the component `Popover.Arrow` and `Popover.ArrowTip` as children of
`Popover.Positioner`.
```tsx
import { Popover } from '@ark-ui/react/popover'
export const Arrow = () => (
Click MeTitleDescriptionClose
)
```
### Listening for open and close events
When the popover is opened or closed, we invoke the `onOpenChange` callback.
```tsx
import { Popover } from '@ark-ui/react/popover'
import { ChevronRightIcon } from 'lucide-react'
export const OnOpenChange = () => {
return (
alert(open ? 'opened' : 'closed')}>
Click Me
TitleDescription
)
}
```
### Control the open state
Use the `isOpen` prop to control the open state of the popover.
```tsx
import { Popover } from '@ark-ui/react/popover'
import { useState } from 'react'
export const Controlled = () => {
const [isOpen, setIsOpen] = useState(false)
return (
<>
AnchorTitleDescriptionClose
>
)
}
```
### Modifying the close behavior
The popover is designed to close on blur and when the esc key is pressed.
To prevent it from closing on blur (clicking or focusing outside), pass the `closeOnInteractOutside` prop and set it to
`false`.
To prevent it from closing when the esc key is pressed, pass the `closeOnEsc` prop and set it to `false`.
```tsx
import { Popover } from '@ark-ui/react/popover'
export const CloseBehavior = () => (
Click MeTitleDescriptionClose
)
```
### Changing the placement
To change the placement of the popover, set the `positioning` prop.
```tsx
import { Popover } from '@ark-ui/react/popover'
export const Positioning = () => (
Click MeTitleDescriptionClose
)
```
### Changing the modality
In some cases, you might want the popover to be modal. This means that it'll:
- trap focus within its content
- block scrolling on the body
- disable pointer interactions outside the popover
- hide content behind the popover from screen readers
To make the popover modal, set the `modal` prop to `true`. When `modal={true}`, we set the `portalled` attribute to
`true` as well.
```tsx
import { Popover } from '@ark-ui/react/popover'
export const Modal = () => (
Click MeTitleDescriptionClose
)
```
### Using the Root Provider
The `RootProvider` component provides a context for the popover. It accepts the value of the `usePopover` hook. You can
leverage it to access the component state and methods from outside the popover.
```tsx
import { Popover, usePopover } from '@ark-ui/react/popover'
export const RootProvider = () => {
const popover = usePopover({
positioning: {
placement: 'bottom-start',
},
})
return (
<>
TitleDescription
>
)
}
```
> If you're using the `RootProvider` component, you don't need to use the `Root` component.
## API Reference
### Root
#### Props
**`autoFocus`**
Type: `boolean`
Required: false
Default Value: `true`
Description: Whether to automatically set focus on the first focusable
content within the popover when opened.
**`closeOnEscape`**
Type: `boolean`
Required: false
Default Value: `true`
Description: Whether to close the popover when the escape key is pressed.
**`closeOnInteractOutside`**
Type: `boolean`
Required: false
Default Value: `true`
Description: Whether to close the popover when the user clicks outside of the popover.
**`defaultOpen`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: The initial open state of the popover when rendered.
Use when you don't need to control the open state of the popover.
**`id`**
Type: `string`
Required: false
Default Value: `undefined`
Description: The unique identifier of the machine.
**`ids`**
Type: `Partial<{
anchor: string
trigger: string
content: string
title: string
description: string
closeTrigger: string
positioner: string
arrow: string
}>`
Required: false
Default Value: `undefined`
Description: The ids of the elements in the popover. Useful for composition.
**`immediate`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Whether to synchronize the present change immediately or defer it to the next frame
**`initialFocusEl`**
Type: `() => HTMLElement | null`
Required: false
Default Value: `undefined`
Description: The element to focus on when the popover is opened.
**`lazyMount`**
Type: `boolean`
Required: false
Default Value: `false`
Description: Whether to enable lazy mounting
**`modal`**
Type: `boolean`
Required: false
Default Value: `false`
Description: Whether the popover should be modal. When set to `true`:
- interaction with outside elements will be disabled
- only popover content will be visible to screen readers
- scrolling is blocked
- focus is trapped within the popover
**`onEscapeKeyDown`**
Type: `(event: KeyboardEvent) => void`
Required: false
Default Value: `undefined`
Description: Function called when the escape key is pressed
**`onExitComplete`**
Type: `VoidFunction`
Required: false
Default Value: `undefined`
Description: Function called when the animation ends in the closed state
**`onFocusOutside`**
Type: `(event: FocusOutsideEvent) => void`
Required: false
Default Value: `undefined`
Description: Function called when the focus is moved outside the component
**`onInteractOutside`**
Type: `(event: InteractOutsideEvent) => void`
Required: false
Default Value: `undefined`
Description: Function called when an interaction happens outside the component
**`onOpenChange`**
Type: `(details: OpenChangeDetails) => void`
Required: false
Default Value: `undefined`
Description: Function invoked when the popover opens or closes
**`onPointerDownOutside`**
Type: `(event: PointerDownOutsideEvent) => void`
Required: false
Default Value: `undefined`
Description: Function called when the pointer is pressed down outside the component
**`open`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: The controlled open state of the popover
**`persistentElements`**
Type: `(() => Element | null)[]`
Required: false
Default Value: `undefined`
Description: Returns the persistent elements that:
- should not have pointer-events disabled
- should not trigger the dismiss event
**`portalled`**
Type: `boolean`
Required: false
Default Value: `true`
Description: Whether the popover is portalled. This will proxy the tabbing behavior regardless of the DOM position
of the popover content.
**`positioning`**
Type: `PositioningOptions`
Required: false
Default Value: `undefined`
Description: The user provided options used to position the popover content
**`present`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Whether the node is present (controlled by the user)
**`unmountOnExit`**
Type: `boolean`
Required: false
Default Value: `false`
Description: Whether to unmount on exit.
### Anchor
#### Props
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
### Arrow
#### Props
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
### ArrowTip
#### Props
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
### CloseTrigger
#### Props
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
### Content
#### Props
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
#### Data Attributes
**`data-scope`**: popover
**`data-part`**: content
**`data-state`**: "open" | "closed"
**`data-expanded`**: Present when expanded
**`data-placement`**: The placement of the content
### Description
#### Props
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
### Indicator
#### Props
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
#### Data Attributes
**`data-scope`**: popover
**`data-part`**: indicator
**`data-state`**: "open" | "closed"
### Positioner
#### Props
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
### RootProvider
#### Props
**`value`**
Type: `UsePopoverReturn`
Required: true
Default Value: `undefined`
Description: undefined
**`immediate`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Whether to synchronize the present change immediately or defer it to the next frame
**`lazyMount`**
Type: `boolean`
Required: false
Default Value: `false`
Description: Whether to enable lazy mounting
**`onExitComplete`**
Type: `VoidFunction`
Required: false
Default Value: `undefined`
Description: Function called when the animation ends in the closed state
**`present`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Whether the node is present (controlled by the user)
**`unmountOnExit`**
Type: `boolean`
Required: false
Default Value: `false`
Description: Whether to unmount on exit.
### Title
#### Props
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
### Trigger
#### Props
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
#### Data Attributes
**`data-scope`**: popover
**`data-part`**: trigger
**`data-placement`**: The placement of the trigger
**`data-state`**: "open" | "closed"
## Accessibility
### Keyboard Support
**`Space`**
Description: Opens/closes the popover.
**`Enter`**
Description: Opens/closes the popover.
**`Tab`**
Description: Moves focus to the next focusable element within the content. Note: If there are no focusable elements, focus is moved to the next focusable element after the trigger.
**`Shift + Tab`**
Description: Moves focus to the previous focusable element within the content Note: If there are no focusable elements, focus is moved to the trigger.
**`Esc`**
Description: Closes the popover and moves focus to the trigger.
# Popover (SOLID)
## Anatomy
To set up the popover correctly, you'll need to understand its anatomy and how we name its parts.
> Each part includes a `data-part` attribute to help identify them in the DOM.
## Examples
Learn how to use the `Popover` component in your project. Let's take a look at the most basic example:
```tsx
import { Popover } from '@ark-ui/solid/popover'
import { ChevronRightIcon } from 'lucide-solid'
export const Basic = () => (
Click Me
TitleDescription
)
```
### Using a Portal
By default, the popover is rendered in the same DOM hierarchy as the trigger. To render the popover within a portal, set
the `portalled` prop to `true`.
> Note: This requires that you render the component within a `Portal` based on the framework you use.
```tsx
import { Popover } from '@ark-ui/solid/popover'
import { ChevronRightIcon } from 'lucide-solid'
import { Portal } from 'solid-js/web'
export const Portalled = () => (
Click Me
TitleDescription
)
```
### Adding an arrow
To render an arrow within the popover, render the component `Popover.Arrow` and `Popover.ArrowTip` as children of
`Popover.Positioner`.
```tsx
import { Popover } from '@ark-ui/solid/popover'
export const Arrow = () => (
Click MeTitleDescriptionClose
)
```
### Listening for open and close events
When the popover is opened or closed, we invoke the `onOpenChange` callback.
```tsx
import { Popover } from '@ark-ui/solid/popover'
import { ChevronRightIcon } from 'lucide-solid'
export const OnOpenChange = () => {
return (
alert(open ? 'opened' : 'closed')}>
Click Me
TitleDescription
)
}
```
### Control the open state
Use the `isOpen` prop to control the open state of the popover.
```tsx
import { Popover } from '@ark-ui/solid/popover'
import { createSignal } from 'solid-js'
export const Controlled = () => {
const [isOpen, setIsOpen] = createSignal(false)
return (
<>
AnchorTitleDescriptionClose
>
)
}
```
### Modifying the close behavior
The popover is designed to close on blur and when the esc key is pressed.
To prevent it from closing on blur (clicking or focusing outside), pass the `closeOnInteractOutside` prop and set it to
`false`.
To prevent it from closing when the esc key is pressed, pass the `closeOnEsc` prop and set it to `false`.
```tsx
import { Popover } from '@ark-ui/solid/popover'
import { Portal } from 'solid-js/web'
export const CloseBehavior = () => (
Click MeTitleDescriptionClose
)
```
### Changing the placement
To change the placement of the popover, set the `positioning` prop.
```tsx
import { Popover } from '@ark-ui/solid/popover'
export const Positioning = () => (
Click MeTitleDescriptionClose
)
```
### Changing the modality
In some cases, you might want the popover to be modal. This means that it'll:
- trap focus within its content
- block scrolling on the body
- disable pointer interactions outside the popover
- hide content behind the popover from screen readers
To make the popover modal, set the `modal` prop to `true`. When `modal={true}`, we set the `portalled` attribute to
`true` as well.
```tsx
import { Popover } from '@ark-ui/solid/popover'
export const Modal = () => (
Click MeTitleDescriptionClose
)
```
### Using the Root Provider
The `RootProvider` component provides a context for the popover. It accepts the value of the `usePopover` hook. You can
leverage it to access the component state and methods from outside the popover.
```tsx
import { Popover, usePopover } from '@ark-ui/solid/popover'
import { ChevronRightIcon } from 'lucide-solid'
export const RootProvider = () => {
const popover = usePopover()
return (
<>
Click Me
TitleDescription
>
)
}
```
> If you're using the `RootProvider` component, you don't need to use the `Root` component.
## API Reference
### Root
#### Props
**`autoFocus`**
Type: `boolean`
Required: false
Default Value: `true`
Description: Whether to automatically set focus on the first focusable
content within the popover when opened.
**`closeOnEscape`**
Type: `boolean`
Required: false
Default Value: `true`
Description: Whether to close the popover when the escape key is pressed.
**`closeOnInteractOutside`**
Type: `boolean`
Required: false
Default Value: `true`
Description: Whether to close the popover when the user clicks outside of the popover.
**`defaultOpen`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: The initial open state of the popover when rendered.
Use when you don't need to control the open state of the popover.
**`id`**
Type: `string`
Required: false
Default Value: `undefined`
Description: The unique identifier of the machine.
**`ids`**
Type: `Partial<{
anchor: string
trigger: string
content: string
title: string
description: string
closeTrigger: string
positioner: string
arrow: string
}>`
Required: false
Default Value: `undefined`
Description: The ids of the elements in the popover. Useful for composition.
**`immediate`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Whether to synchronize the present change immediately or defer it to the next frame
**`initialFocusEl`**
Type: `() => HTMLElement | null`
Required: false
Default Value: `undefined`
Description: The element to focus on when the popover is opened.
**`lazyMount`**
Type: `boolean`
Required: false
Default Value: `false`
Description: Whether to enable lazy mounting
**`modal`**
Type: `boolean`
Required: false
Default Value: `false`
Description: Whether the popover should be modal. When set to `true`:
- interaction with outside elements will be disabled
- only popover content will be visible to screen readers
- scrolling is blocked
- focus is trapped within the popover
**`onEscapeKeyDown`**
Type: `(event: KeyboardEvent) => void`
Required: false
Default Value: `undefined`
Description: Function called when the escape key is pressed
**`onExitComplete`**
Type: `VoidFunction`
Required: false
Default Value: `undefined`
Description: Function called when the animation ends in the closed state
**`onFocusOutside`**
Type: `(event: FocusOutsideEvent) => void`
Required: false
Default Value: `undefined`
Description: Function called when the focus is moved outside the component
**`onInteractOutside`**
Type: `(event: InteractOutsideEvent) => void`
Required: false
Default Value: `undefined`
Description: Function called when an interaction happens outside the component
**`onOpenChange`**
Type: `(details: OpenChangeDetails) => void`
Required: false
Default Value: `undefined`
Description: Function invoked when the popover opens or closes
**`onPointerDownOutside`**
Type: `(event: PointerDownOutsideEvent) => void`
Required: false
Default Value: `undefined`
Description: Function called when the pointer is pressed down outside the component
**`open`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: The controlled open state of the popover
**`persistentElements`**
Type: `(() => Element | null)[]`
Required: false
Default Value: `undefined`
Description: Returns the persistent elements that:
- should not have pointer-events disabled
- should not trigger the dismiss event
**`portalled`**
Type: `boolean`
Required: false
Default Value: `true`
Description: Whether the popover is portalled. This will proxy the tabbing behavior regardless of the DOM position
of the popover content.
**`positioning`**
Type: `PositioningOptions`
Required: false
Default Value: `undefined`
Description: The user provided options used to position the popover content
**`present`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Whether the node is present (controlled by the user)
**`unmountOnExit`**
Type: `boolean`
Required: false
Default Value: `false`
Description: Whether to unmount on exit.
### Anchor
#### Props
**`asChild`**
Type: `(props: ParentProps<'div'>) => Element`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
### Arrow
#### Props
**`asChild`**
Type: `(props: ParentProps<'div'>) => Element`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
### ArrowTip
#### Props
**`asChild`**
Type: `(props: ParentProps<'div'>) => Element`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
### CloseTrigger
#### Props
**`asChild`**
Type: `(props: ParentProps<'button'>) => Element`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
### Content
#### Props
**`asChild`**
Type: `(props: ParentProps<'div'>) => Element`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
#### Data Attributes
**`data-scope`**: popover
**`data-part`**: content
**`data-state`**: "open" | "closed"
**`data-expanded`**: Present when expanded
**`data-placement`**: The placement of the content
### Description
#### Props
**`asChild`**
Type: `(props: ParentProps<'div'>) => Element`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
### Indicator
#### Props
**`asChild`**
Type: `(props: ParentProps<'div'>) => Element`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
#### Data Attributes
**`data-scope`**: popover
**`data-part`**: indicator
**`data-state`**: "open" | "closed"
### Positioner
#### Props
**`asChild`**
Type: `(props: ParentProps<'div'>) => Element`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
### RootProvider
#### Props
**`value`**
Type: `UsePopoverReturn`
Required: true
Default Value: `undefined`
Description: undefined
**`immediate`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Whether to synchronize the present change immediately or defer it to the next frame
**`lazyMount`**
Type: `boolean`
Required: false
Default Value: `false`
Description: Whether to enable lazy mounting
**`onExitComplete`**
Type: `VoidFunction`
Required: false
Default Value: `undefined`
Description: Function called when the animation ends in the closed state
**`present`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Whether the node is present (controlled by the user)
**`unmountOnExit`**
Type: `boolean`
Required: false
Default Value: `false`
Description: Whether to unmount on exit.
### Title
#### Props
**`asChild`**
Type: `(props: ParentProps<'div'>) => Element`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
### Trigger
#### Props
**`asChild`**
Type: `(props: ParentProps<'button'>) => Element`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
#### Data Attributes
**`data-scope`**: popover
**`data-part`**: trigger
**`data-placement`**: The placement of the trigger
**`data-state`**: "open" | "closed"
## Accessibility
### Keyboard Support
**`Space`**
Description: Opens/closes the popover.
**`Enter`**
Description: Opens/closes the popover.
**`Tab`**
Description: Moves focus to the next focusable element within the content. Note: If there are no focusable elements, focus is moved to the next focusable element after the trigger.
**`Shift + Tab`**
Description: Moves focus to the previous focusable element within the content Note: If there are no focusable elements, focus is moved to the trigger.
**`Esc`**
Description: Closes the popover and moves focus to the trigger.
# Popover (VUE)
## Anatomy
To set up the popover correctly, you'll need to understand its anatomy and how we name its parts.
> Each part includes a `data-part` attribute to help identify them in the DOM.
## Examples
Learn how to use the `Popover` component in your project. Let's take a look at the most basic example:
```vue
Click Me
{{ '>' }}TitleDescription
```
### Using a Portal
By default, the popover is rendered in the same DOM hierarchy as the trigger. To render the popover within a portal, set
the `portalled` prop to `true`.
> Note: This requires that you render the component within a `Portal` based on the framework you use.
```vue
Click Me
{{ '>' }}TitleDescription
```
### Adding an arrow
To render an arrow within the popover, render the component `Popover.Arrow` and `Popover.ArrowTip` as children of
`Popover.Positioner`.
```vue
Click MeTitleDescriptionClose
```
### Listening for open and close events
When the popover is opened or closed, we invoke the `onOpenChange` callback.
```vue
console.log(open ? 'opened' : 'closed')">
Click Me
{{ '>' }}TitleDescription
```
### Control the open state
Use the `isOpen` prop to control the open state of the popover.
```vue
AnchorTitleDescriptionClose
```
### Modifying the close behavior
The popover is designed to close on blur and when the esc key is pressed.
To prevent it from closing on blur (clicking or focusing outside), pass the `closeOnInteractOutside` prop and set it to
`false`.
To prevent it from closing when the esc key is pressed, pass the `closeOnEsc` prop and set it to `false`.
```vue
Click MeTitleDescriptionClose
```
### Changing the placement
To change the placement of the popover, set the `positioning` prop.
```vue
Click MeTitleDescriptionClose
```
### Changing the modality
In some cases, you might want the popover to be modal. This means that it'll:
- trap focus within its content
- block scrolling on the body
- disable pointer interactions outside the popover
- hide content behind the popover from screen readers
To make the popover modal, set the `modal` prop to `true`. When `modal={true}`, we set the `portalled` attribute to
`true` as well.
```vue
Click MeTitleDescriptionClose
```
### Using the Root Provider
The `RootProvider` component provides a context for the popover. It accepts the value of the `usePopover` hook. You can
leverage it to access the component state and methods from outside the popover.
```vue
Click Me
{{ '>' }}TitleDescription
```
> If you're using the `RootProvider` component, you don't need to use the `Root` component.
## API Reference
### Root
#### Props
**`autoFocus`**
Type: `boolean`
Required: false
Default Value: `true`
Description: Whether to automatically set focus on the first focusable
content within the popover when opened.
**`closeOnEscape`**
Type: `boolean`
Required: false
Default Value: `true`
Description: Whether to close the popover when the escape key is pressed.
**`closeOnInteractOutside`**
Type: `boolean`
Required: false
Default Value: `true`
Description: Whether to close the popover when the user clicks outside of the popover.
**`defaultOpen`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: The initial open state of the popover when rendered.
Use when you don't need to control the open state of the popover.
**`id`**
Type: `string`
Required: false
Default Value: `undefined`
Description: The unique identifier of the machine.
**`ids`**
Type: `Partial<{
anchor: string
trigger: string
content: string
title: string
description: string
closeTrigger: string
positioner: string
arrow: string
}>`
Required: false
Default Value: `undefined`
Description: The ids of the elements in the popover. Useful for composition.
**`initialFocusEl`**
Type: `() => HTMLElement | null`
Required: false
Default Value: `undefined`
Description: The element to focus on when the popover is opened.
**`lazyMount`**
Type: `boolean`
Required: false
Default Value: `false`
Description: Whether to enable lazy mounting
**`modal`**
Type: `boolean`
Required: false
Default Value: `false`
Description: Whether the popover should be modal. When set to `true`:
- interaction with outside elements will be disabled
- only popover content will be visible to screen readers
- scrolling is blocked
- focus is trapped within the popover
**`open`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: The controlled open state of the popover
**`persistentElements`**
Type: `(() => Element | null)[]`
Required: false
Default Value: `undefined`
Description: Returns the persistent elements that:
- should not have pointer-events disabled
- should not trigger the dismiss event
**`portalled`**
Type: `boolean`
Required: false
Default Value: `true`
Description: Whether the popover is portalled. This will proxy the tabbing behavior regardless of the DOM position
of the popover content.
**`positioning`**
Type: `PositioningOptions`
Required: false
Default Value: `undefined`
Description: The user provided options used to position the popover content
**`unmountOnExit`**
Type: `boolean`
Required: false
Default Value: `false`
Description: Whether to unmount on exit.
#### Emits
**`escapeKeyDown`**
Type: `[event: KeyboardEvent]`
Description: Function called when the escape key is pressed
**`focusOutside`**
Type: `[event: FocusOutsideEvent]`
Description: Function called when the focus is moved outside the component
**`interactOutside`**
Type: `[event: InteractOutsideEvent]`
Description: Function called when an interaction happens outside the component
**`openChange`**
Type: `[details: OpenChangeDetails]`
Description: Function invoked when the popover opens or closes
**`pointerDownOutside`**
Type: `[event: PointerDownOutsideEvent]`
Description: Function called when the pointer is pressed down outside the component
**`update:open`**
Type: `[open: boolean]`
Description: The callback fired when the open state changes.
### Anchor
#### Props
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
### Arrow
#### Props
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
### ArrowTip
#### Props
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
### CloseTrigger
#### Props
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
### Content
#### Props
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
#### Data Attributes
**`data-scope`**: popover
**`data-part`**: content
**`data-state`**: "open" | "closed"
**`data-expanded`**: Present when expanded
**`data-placement`**: The placement of the content
### Description
#### Props
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
### Indicator
#### Props
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
#### Data Attributes
**`data-scope`**: popover
**`data-part`**: indicator
**`data-state`**: "open" | "closed"
### Positioner
#### Props
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
### RootProvider
#### Props
**`value`**
Type: `PopoverApi`
Required: true
Default Value: `undefined`
Description: undefined
**`lazyMount`**
Type: `boolean`
Required: false
Default Value: `false`
Description: Whether to enable lazy mounting
**`unmountOnExit`**
Type: `boolean`
Required: false
Default Value: `false`
Description: Whether to unmount on exit.
### Title
#### Props
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
### Trigger
#### Props
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
#### Data Attributes
**`data-scope`**: popover
**`data-part`**: trigger
**`data-placement`**: The placement of the trigger
**`data-state`**: "open" | "closed"
## Accessibility
### Keyboard Support
**`Space`**
Description: Opens/closes the popover.
**`Enter`**
Description: Opens/closes the popover.
**`Tab`**
Description: Moves focus to the next focusable element within the content. Note: If there are no focusable elements, focus is moved to the next focusable element after the trigger.
**`Shift + Tab`**
Description: Moves focus to the previous focusable element within the content Note: If there are no focusable elements, focus is moved to the trigger.
**`Esc`**
Description: Closes the popover and moves focus to the trigger.
# Progress - Circular (REACT)
## Anatomy
To set up the progress correctly, you'll need to understand its anatomy and how we name its parts.
> Each part includes a `data-part` attribute to help identify them in the DOM.
## Examples
Learn how to use the `Progress` component in your project. Let's take a look at the most basic example:
```tsx
import { Progress } from '@ark-ui/react/progress'
export const Basic = () => (
Label
)
```
### Set a min and max value
By default, the maximum is `100`. If that's not what you want, you can easily specify a different bound by changing the
value of the `max` prop. You can do the same with the minimum value by setting the `min` prop.
For example, to show the user a progress from `10` to `30`, you can use:
```tsx
import { Progress } from '@ark-ui/react/progress'
export const MinMax = () => (
Label
)
```
### Indeterminate value
The progress component is determinate by default, with the value and max set to 50 and 100 respectively. To render an
indeterminate progress, you will have to set the `value` to `null`.
```tsx
import { Progress } from '@ark-ui/react/progress'
export const Indeterminate = () => (
Label
)
```
### Showing a value text
Progress bars can only be interpreted by sighted users. To include a text description to support assistive technologies
like screen readers, use the `value` part in `translations`.
```tsx
import { Progress } from '@ark-ui/react/progress'
export const ValueText = () => (
Label
)
```
### Using the Root Provider
The `RootProvider` component provides a context for the progress. It accepts the value of the `useProgress` hook. You
can leverage it to access the component state and methods from outside the progress.
```tsx
import { Progress, useProgress } from '@ark-ui/react/progress'
export const RootProvider = () => {
const progress = useProgress()
return (
<>
Label
>
)
}
```
> If you're using the `RootProvider` component, you don't need to use the `Root` component.
## API Reference
### Root
#### Props
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
**`defaultValue`**
Type: `number`
Required: false
Default Value: `50`
Description: The initial value of the progress bar when rendered.
Use when you don't need to control the value of the progress bar.
**`formatOptions`**
Type: `NumberFormatOptions`
Required: false
Default Value: `{ style: "percent" }`
Description: The options to use for formatting the value.
**`id`**
Type: `string`
Required: false
Default Value: `undefined`
Description: The unique identifier of the machine.
**`ids`**
Type: `Partial<{ root: string; track: string; label: string; circle: string }>`
Required: false
Default Value: `undefined`
Description: The ids of the elements in the progress bar. Useful for composition.
**`locale`**
Type: `string`
Required: false
Default Value: `"en-US"`
Description: The locale to use for formatting the value.
**`max`**
Type: `number`
Required: false
Default Value: `100`
Description: The maximum allowed value of the progress bar.
**`min`**
Type: `number`
Required: false
Default Value: `0`
Description: The minimum allowed value of the progress bar.
**`onValueChange`**
Type: `(details: ValueChangeDetails) => void`
Required: false
Default Value: `undefined`
Description: Callback fired when the value changes.
**`orientation`**
Type: `'horizontal' | 'vertical'`
Required: false
Default Value: `"horizontal"`
Description: The orientation of the element.
**`translations`**
Type: `IntlTranslations`
Required: false
Default Value: `undefined`
Description: The localized messages to use.
**`value`**
Type: `number`
Required: false
Default Value: `undefined`
Description: The controlled value of the progress bar.
#### Data Attributes
**`data-scope`**: progress
**`data-part`**: root
**`data-max`**:
**`data-value`**: The value of the item
**`data-state`**:
**`data-orientation`**: The orientation of the progress
### Circle
#### Props
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
### CircleRange
#### Props
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
#### Data Attributes
**`data-scope`**: progress
**`data-part`**: circle-range
**`data-state`**:
### CircleTrack
#### Props
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
#### Data Attributes
**`data-scope`**: progress
**`data-part`**: circle-track
**`data-orientation`**: The orientation of the circletrack
### Label
#### Props
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
#### Data Attributes
**`data-scope`**: progress
**`data-part`**: label
**`data-orientation`**: The orientation of the label
### Range
#### Props
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
#### Data Attributes
**`data-scope`**: progress
**`data-part`**: range
**`data-orientation`**: The orientation of the range
**`data-state`**:
### RootProvider
#### Props
**`value`**
Type: `UseProgressReturn`
Required: true
Default Value: `undefined`
Description: undefined
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
### Track
#### Props
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
### ValueText
#### Props
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
### View
#### Props
**`state`**
Type: `ProgressState`
Required: true
Default Value: `undefined`
Description: undefined
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
#### Data Attributes
**`data-scope`**: progress
**`data-part`**: view
**`data-state`**:
## Accessibility
Complies with the [the progressbar role requirements.](https://w3c.github.io/aria/#progressbar).
# Progress - Circular (SOLID)
## Anatomy
To set up the progress correctly, you'll need to understand its anatomy and how we name its parts.
> Each part includes a `data-part` attribute to help identify them in the DOM.
## Examples
Learn how to use the `Progress` component in your project. Let's take a look at the most basic example:
```tsx
import { Progress } from '@ark-ui/solid/progress'
export const Basic = () => (
Label
)
```
### Set a min and max value
By default, the maximum is `100`. If that's not what you want, you can easily specify a different bound by changing the
value of the `max` prop. You can do the same with the minimum value by setting the `min` prop.
For example, to show the user a progress from `10` to `30`, you can use:
```tsx
import { Progress } from '@ark-ui/solid/progress'
export const MinMax = () => (
Label
)
```
### Indeterminate value
The progress component is determinate by default, with the value and max set to 50 and 100 respectively. To render an
indeterminate progress, you will have to set the `value` to `null`.
```tsx
import { Progress } from '@ark-ui/solid/progress'
export const Indeterminate = () => (
Label
)
```
### Showing a value text
Progress bars can only be interpreted by sighted users. To include a text description to support assistive technologies
like screen readers, use the `value` part in `translations`.
```tsx
import { Progress } from '@ark-ui/solid/progress'
export const ValueText = () => (
Label
)
```
### Using the Root Provider
The `RootProvider` component provides a context for the progress. It accepts the value of the `useProgress` hook. You
can leverage it to access the component state and methods from outside the progress.
```tsx
import { Progress, useProgress } from '@ark-ui/solid/progress'
export const RootProvider = () => {
const progress = useProgress()
return (
<>
Label
>
)
}
```
> If you're using the `RootProvider` component, you don't need to use the `Root` component.
## API Reference
### Root
#### Props
**`asChild`**
Type: `(props: ParentProps<'div'>) => Element`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
**`defaultValue`**
Type: `number`
Required: false
Default Value: `50`
Description: The initial value of the progress bar when rendered.
Use when you don't need to control the value of the progress bar.
**`formatOptions`**
Type: `NumberFormatOptions`
Required: false
Default Value: `{ style: "percent" }`
Description: The options to use for formatting the value.
**`ids`**
Type: `Partial<{ root: string; track: string; label: string; circle: string }>`
Required: false
Default Value: `undefined`
Description: The ids of the elements in the progress bar. Useful for composition.
**`locale`**
Type: `string`
Required: false
Default Value: `"en-US"`
Description: The locale to use for formatting the value.
**`max`**
Type: `number`
Required: false
Default Value: `100`
Description: The maximum allowed value of the progress bar.
**`min`**
Type: `number`
Required: false
Default Value: `0`
Description: The minimum allowed value of the progress bar.
**`onValueChange`**
Type: `(details: ValueChangeDetails) => void`
Required: false
Default Value: `undefined`
Description: Callback fired when the value changes.
**`orientation`**
Type: `'horizontal' | 'vertical'`
Required: false
Default Value: `"horizontal"`
Description: The orientation of the element.
**`translations`**
Type: `IntlTranslations`
Required: false
Default Value: `undefined`
Description: The localized messages to use.
**`value`**
Type: `number`
Required: false
Default Value: `undefined`
Description: The controlled value of the progress bar.
#### Data Attributes
**`data-scope`**: progress
**`data-part`**: root
**`data-max`**:
**`data-value`**: The value of the item
**`data-state`**:
**`data-orientation`**: The orientation of the progress
### Circle
#### Props
**`asChild`**
Type: `(props: ParentProps<'svg'>) => Element`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
### CircleRange
#### Props
**`asChild`**
Type: `(props: ParentProps<'circle'>) => Element`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
#### Data Attributes
**`data-scope`**: progress
**`data-part`**: circle-range
**`data-state`**:
### CircleTrack
#### Props
**`asChild`**
Type: `(props: ParentProps<'circle'>) => Element`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
#### Data Attributes
**`data-scope`**: progress
**`data-part`**: circle-track
**`data-orientation`**: The orientation of the circletrack
### Label
#### Props
**`asChild`**
Type: `(props: ParentProps<'label'>) => Element`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
#### Data Attributes
**`data-scope`**: progress
**`data-part`**: label
**`data-orientation`**: The orientation of the label
### Range
#### Props
**`asChild`**
Type: `(props: ParentProps<'div'>) => Element`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
#### Data Attributes
**`data-scope`**: progress
**`data-part`**: range
**`data-orientation`**: The orientation of the range
**`data-state`**:
### RootProvider
#### Props
**`value`**
Type: `UseProgressReturn`
Required: true
Default Value: `undefined`
Description: undefined
**`asChild`**
Type: `(props: ParentProps<'div'>) => Element`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
### Track
#### Props
**`asChild`**
Type: `(props: ParentProps<'div'>) => Element`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
### ValueText
#### Props
**`asChild`**
Type: `(props: ParentProps<'span'>) => Element`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
### View
#### Props
**`state`**
Type: `ProgressState`
Required: true
Default Value: `undefined`
Description: undefined
**`asChild`**
Type: `(props: ParentProps<'span'>) => Element`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
#### Data Attributes
**`data-scope`**: progress
**`data-part`**: view
**`data-state`**:
## Accessibility
Complies with the [the progressbar role requirements.](https://w3c.github.io/aria/#progressbar).
# Progress - Circular (VUE)
## Anatomy
To set up the progress correctly, you'll need to understand its anatomy and how we name its parts.
> Each part includes a `data-part` attribute to help identify them in the DOM.
## Examples
Learn how to use the `Progress` component in your project. Let's take a look at the most basic example:
```vue
Label
```
### Set a min and max value
By default, the maximum is `100`. If that's not what you want, you can easily specify a different bound by changing the
value of the `max` prop. You can do the same with the minimum value by setting the `min` prop.
For example, to show the user a progress from `10` to `30`, you can use:
```vue
Label
```
### Indeterminate value
The progress component is determinate by default, with the value and max set to 50 and 100 respectively. To render an
indeterminate progress, you will have to set the `value` to `null`.
```vue
Label
```
### Showing a value text
Progress bars can only be interpreted by sighted users. To include a text description to support assistive technologies
like screen readers, use the `value` part in `translations`.
```vue
Label
```
### Using the Root Provider
The `RootProvider` component provides a context for the progress. It accepts the value of the `useProgress` hook. You
can leverage it to access the component state and methods from outside the progress.
```vue
Label
```
> If you're using the `RootProvider` component, you don't need to use the `Root` component.
## API Reference
### Root
#### Props
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
**`defaultValue`**
Type: `number`
Required: false
Default Value: `50`
Description: The initial value of the progress bar when rendered.
Use when you don't need to control the value of the progress bar.
**`formatOptions`**
Type: `NumberFormatOptions`
Required: false
Default Value: `{ style: "percent" }`
Description: The options to use for formatting the value.
**`id`**
Type: `string`
Required: false
Default Value: `undefined`
Description: The unique identifier of the machine.
**`ids`**
Type: `Partial<{ root: string; track: string; label: string; circle: string }>`
Required: false
Default Value: `undefined`
Description: The ids of the elements in the progress bar. Useful for composition.
**`locale`**
Type: `string`
Required: false
Default Value: `"en-US"`
Description: The locale to use for formatting the value.
**`max`**
Type: `number`
Required: false
Default Value: `100`
Description: The maximum allowed value of the progress bar.
**`min`**
Type: `number`
Required: false
Default Value: `0`
Description: The minimum allowed value of the progress bar.
**`modelValue`**
Type: `number`
Required: false
Default Value: `undefined`
Description: The v-model value of the progress
**`orientation`**
Type: `'horizontal' | 'vertical'`
Required: false
Default Value: `"horizontal"`
Description: The orientation of the element.
**`translations`**
Type: `IntlTranslations`
Required: false
Default Value: `undefined`
Description: The localized messages to use.
#### Emits
**`update:modelValue`**
Type: `[value: number | null]`
Description: The callback fired when the model value changes.
**`valueChange`**
Type: `[details: ValueChangeDetails]`
Description: Callback fired when the value changes.
#### Data Attributes
**`data-scope`**: progress
**`data-part`**: root
**`data-max`**:
**`data-value`**: The value of the item
**`data-state`**:
**`data-orientation`**: The orientation of the progress
### Circle
#### Props
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
### CircleRange
#### Props
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
#### Data Attributes
**`data-scope`**: progress
**`data-part`**: circle-range
**`data-state`**:
### CircleTrack
#### Props
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
#### Data Attributes
**`data-scope`**: progress
**`data-part`**: circle-track
**`data-orientation`**: The orientation of the circletrack
### Label
#### Props
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
#### Data Attributes
**`data-scope`**: progress
**`data-part`**: label
**`data-orientation`**: The orientation of the label
### Range
#### Props
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
#### Data Attributes
**`data-scope`**: progress
**`data-part`**: range
**`data-orientation`**: The orientation of the range
**`data-state`**:
### RootProvider
#### Props
**`value`**
Type: `ProgressApi`
Required: true
Default Value: `undefined`
Description: undefined
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
### Track
#### Props
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
### ValueText
#### Props
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
### View
#### Props
**`state`**
Type: `ProgressState`
Required: true
Default Value: `undefined`
Description: undefined
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
#### Data Attributes
**`data-scope`**: progress
**`data-part`**: view
**`data-state`**:
## Accessibility
Complies with the [the progressbar role requirements.](https://w3c.github.io/aria/#progressbar).
# Progress - Linear (REACT)
## Anatomy
To set up the progress correctly, you'll need to understand its anatomy and how we name its parts.
> Each part includes a `data-part` attribute to help identify them in the DOM.
## Examples
Learn how to use the `Progress` component in your project. Let's take a look at the most basic example:
```tsx
import { Progress } from '@ark-ui/react/progress'
export const Basic = () => (
Label
)
```
### Set a min and max value
By default, the maximum is `100`. If that's not what you want, you can easily specify a different bound by changing the
value of the `max` prop. You can do the same with the minimum value by setting the `min` prop.
For example, to show the user a progress from `10` to `30`, you can use:
```tsx
import { Progress } from '@ark-ui/react/progress'
export const MinMax = () => (
Label
)
```
### Indeterminate progress
The progress component is determinate by default, with the value and max set to 50 and 100 respectively. To render an
indeterminate progress, you will have to set the `value` to `null`.
```tsx
import { Progress } from '@ark-ui/react/progress'
export const Indeterminate = () => (
Label
)
```
### Showing a value text
Progress bars can only be interpreted by sighted users. To include a text description to support assistive technologies
like screen readers, use the `value` part in `translations`.
```tsx
import { Progress } from '@ark-ui/react/progress'
export const ValueText = () => (
Label
)
```
### Changing the orientation
By default, the progress is assumed to be horizontal. To change the orientation to vertical, set the orientation
property in the machine's context to vertical.
> Don't forget to change the styles of the vertical progress by specifying its height
```tsx
import { Progress } from '@ark-ui/react/progress'
export const Vertical = () => (
Label
)
```
### Using the Root Provider
The `RootProvider` component provides a context for the progress. It accepts the value of the `useProgress` hook. You
can leverage it to access the component state and methods from outside the progress.
```tsx
import { Progress, useProgress } from '@ark-ui/react/progress'
export const RootProvider = () => {
const progress = useProgress()
return (
<>
Label
>
)
}
```
> If you're using the `RootProvider` component, you don't need to use the `Root` component.
## API Reference
### Root
#### Props
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
**`defaultValue`**
Type: `number`
Required: false
Default Value: `50`
Description: The initial value of the progress bar when rendered.
Use when you don't need to control the value of the progress bar.
**`formatOptions`**
Type: `NumberFormatOptions`
Required: false
Default Value: `{ style: "percent" }`
Description: The options to use for formatting the value.
**`id`**
Type: `string`
Required: false
Default Value: `undefined`
Description: The unique identifier of the machine.
**`ids`**
Type: `Partial<{ root: string; track: string; label: string; circle: string }>`
Required: false
Default Value: `undefined`
Description: The ids of the elements in the progress bar. Useful for composition.
**`locale`**
Type: `string`
Required: false
Default Value: `"en-US"`
Description: The locale to use for formatting the value.
**`max`**
Type: `number`
Required: false
Default Value: `100`
Description: The maximum allowed value of the progress bar.
**`min`**
Type: `number`
Required: false
Default Value: `0`
Description: The minimum allowed value of the progress bar.
**`onValueChange`**
Type: `(details: ValueChangeDetails) => void`
Required: false
Default Value: `undefined`
Description: Callback fired when the value changes.
**`orientation`**
Type: `'horizontal' | 'vertical'`
Required: false
Default Value: `"horizontal"`
Description: The orientation of the element.
**`translations`**
Type: `IntlTranslations`
Required: false
Default Value: `undefined`
Description: The localized messages to use.
**`value`**
Type: `number`
Required: false
Default Value: `undefined`
Description: The controlled value of the progress bar.
#### Data Attributes
**`data-scope`**: progress
**`data-part`**: root
**`data-max`**:
**`data-value`**: The value of the item
**`data-state`**:
**`data-orientation`**: The orientation of the progress
### Circle
#### Props
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
### CircleRange
#### Props
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
#### Data Attributes
**`data-scope`**: progress
**`data-part`**: circle-range
**`data-state`**:
### CircleTrack
#### Props
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
#### Data Attributes
**`data-scope`**: progress
**`data-part`**: circle-track
**`data-orientation`**: The orientation of the circletrack
### Label
#### Props
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
#### Data Attributes
**`data-scope`**: progress
**`data-part`**: label
**`data-orientation`**: The orientation of the label
### Range
#### Props
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
#### Data Attributes
**`data-scope`**: progress
**`data-part`**: range
**`data-orientation`**: The orientation of the range
**`data-state`**:
### RootProvider
#### Props
**`value`**
Type: `UseProgressReturn`
Required: true
Default Value: `undefined`
Description: undefined
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
### Track
#### Props
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
### ValueText
#### Props
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
### View
#### Props
**`state`**
Type: `ProgressState`
Required: true
Default Value: `undefined`
Description: undefined
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
#### Data Attributes
**`data-scope`**: progress
**`data-part`**: view
**`data-state`**:
## Accessibility
Complies with the [the progressbar role requirements.](https://w3c.github.io/aria/#progressbar).
# Progress - Linear (SOLID)
## Anatomy
To set up the progress correctly, you'll need to understand its anatomy and how we name its parts.
> Each part includes a `data-part` attribute to help identify them in the DOM.
## Examples
Learn how to use the `Progress` component in your project. Let's take a look at the most basic example:
```tsx
import { Progress } from '@ark-ui/solid/progress'
export const Basic = () => (
Label
)
```
### Set a min and max value
By default, the maximum is `100`. If that's not what you want, you can easily specify a different bound by changing the
value of the `max` prop. You can do the same with the minimum value by setting the `min` prop.
For example, to show the user a progress from `10` to `30`, you can use:
```tsx
import { Progress } from '@ark-ui/solid/progress'
export const MinMax = () => (
Label
)
```
### Indeterminate progress
The progress component is determinate by default, with the value and max set to 50 and 100 respectively. To render an
indeterminate progress, you will have to set the `value` to `null`.
```tsx
import { Progress } from '@ark-ui/solid/progress'
export const Indeterminate = () => (
Label
)
```
### Showing a value text
Progress bars can only be interpreted by sighted users. To include a text description to support assistive technologies
like screen readers, use the `value` part in `translations`.
```tsx
import { Progress } from '@ark-ui/solid/progress'
export const ValueText = () => (
Label
)
```
### Changing the orientation
By default, the progress is assumed to be horizontal. To change the orientation to vertical, set the orientation
property in the machine's context to vertical.
> Don't forget to change the styles of the vertical progress by specifying its height
```tsx
import { Progress } from '@ark-ui/solid/progress'
export const Vertical = () => (
Label
)
```
### Using the Root Provider
The `RootProvider` component provides a context for the progress. It accepts the value of the `useProgress` hook. You
can leverage it to access the component state and methods from outside the progress.
```tsx
import { Progress, useProgress } from '@ark-ui/solid/progress'
export const Basic = () => {
const progress = useProgress()
return (
<>
Label
>
)
}
```
> If you're using the `RootProvider` component, you don't need to use the `Root` component.
## API Reference
### Root
#### Props
**`asChild`**
Type: `(props: ParentProps<'div'>) => Element`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
**`defaultValue`**
Type: `number`
Required: false
Default Value: `50`
Description: The initial value of the progress bar when rendered.
Use when you don't need to control the value of the progress bar.
**`formatOptions`**
Type: `NumberFormatOptions`
Required: false
Default Value: `{ style: "percent" }`
Description: The options to use for formatting the value.
**`ids`**
Type: `Partial<{ root: string; track: string; label: string; circle: string }>`
Required: false
Default Value: `undefined`
Description: The ids of the elements in the progress bar. Useful for composition.
**`locale`**
Type: `string`
Required: false
Default Value: `"en-US"`
Description: The locale to use for formatting the value.
**`max`**
Type: `number`
Required: false
Default Value: `100`
Description: The maximum allowed value of the progress bar.
**`min`**
Type: `number`
Required: false
Default Value: `0`
Description: The minimum allowed value of the progress bar.
**`onValueChange`**
Type: `(details: ValueChangeDetails) => void`
Required: false
Default Value: `undefined`
Description: Callback fired when the value changes.
**`orientation`**
Type: `'horizontal' | 'vertical'`
Required: false
Default Value: `"horizontal"`
Description: The orientation of the element.
**`translations`**
Type: `IntlTranslations`
Required: false
Default Value: `undefined`
Description: The localized messages to use.
**`value`**
Type: `number`
Required: false
Default Value: `undefined`
Description: The controlled value of the progress bar.
#### Data Attributes
**`data-scope`**: progress
**`data-part`**: root
**`data-max`**:
**`data-value`**: The value of the item
**`data-state`**:
**`data-orientation`**: The orientation of the progress
### Circle
#### Props
**`asChild`**
Type: `(props: ParentProps<'svg'>) => Element`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
### CircleRange
#### Props
**`asChild`**
Type: `(props: ParentProps<'circle'>) => Element`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
#### Data Attributes
**`data-scope`**: progress
**`data-part`**: circle-range
**`data-state`**:
### CircleTrack
#### Props
**`asChild`**
Type: `(props: ParentProps<'circle'>) => Element`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
#### Data Attributes
**`data-scope`**: progress
**`data-part`**: circle-track
**`data-orientation`**: The orientation of the circletrack
### Label
#### Props
**`asChild`**
Type: `(props: ParentProps<'label'>) => Element`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
#### Data Attributes
**`data-scope`**: progress
**`data-part`**: label
**`data-orientation`**: The orientation of the label
### Range
#### Props
**`asChild`**
Type: `(props: ParentProps<'div'>) => Element`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
#### Data Attributes
**`data-scope`**: progress
**`data-part`**: range
**`data-orientation`**: The orientation of the range
**`data-state`**:
### RootProvider
#### Props
**`value`**
Type: `UseProgressReturn`
Required: true
Default Value: `undefined`
Description: undefined
**`asChild`**
Type: `(props: ParentProps<'div'>) => Element`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
### Track
#### Props
**`asChild`**
Type: `(props: ParentProps<'div'>) => Element`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
### ValueText
#### Props
**`asChild`**
Type: `(props: ParentProps<'span'>) => Element`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
### View
#### Props
**`state`**
Type: `ProgressState`
Required: true
Default Value: `undefined`
Description: undefined
**`asChild`**
Type: `(props: ParentProps<'span'>) => Element`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
#### Data Attributes
**`data-scope`**: progress
**`data-part`**: view
**`data-state`**:
## Accessibility
Complies with the [the progressbar role requirements.](https://w3c.github.io/aria/#progressbar).
# Progress - Linear (VUE)
## Anatomy
To set up the progress correctly, you'll need to understand its anatomy and how we name its parts.
> Each part includes a `data-part` attribute to help identify them in the DOM.
## Examples
Learn how to use the `Progress` component in your project. Let's take a look at the most basic example:
```vue
Label
```
### Set a min and max value
By default, the maximum is `100`. If that's not what you want, you can easily specify a different bound by changing the
value of the `max` prop. You can do the same with the minimum value by setting the `min` prop.
For example, to show the user a progress from `10` to `30`, you can use:
```vue
Label
```
### Indeterminate progress
The progress component is determinate by default, with the value and max set to 50 and 100 respectively. To render an
indeterminate progress, you will have to set the `value` to `null`.
```vue
Label
```
### Showing a value text
Progress bars can only be interpreted by sighted users. To include a text description to support assistive technologies
like screen readers, use the `value` part in `translations`.
```vue
Label
```
### Changing the orientation
By default, the progress is assumed to be horizontal. To change the orientation to vertical, set the orientation
property in the machine's context to vertical.
> Don't forget to change the styles of the vertical progress by specifying its height
```vue
Example not found```
### Using the Root Provider
The `RootProvider` component provides a context for the progress. It accepts the value of the `useProgress` hook. You
can leverage it to access the component state and methods from outside the progress.
```vue
Label
```
> If you're using the `RootProvider` component, you don't need to use the `Root` component.
## API Reference
### Root
#### Props
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
**`defaultValue`**
Type: `number`
Required: false
Default Value: `50`
Description: The initial value of the progress bar when rendered.
Use when you don't need to control the value of the progress bar.
**`formatOptions`**
Type: `NumberFormatOptions`
Required: false
Default Value: `{ style: "percent" }`
Description: The options to use for formatting the value.
**`id`**
Type: `string`
Required: false
Default Value: `undefined`
Description: The unique identifier of the machine.
**`ids`**
Type: `Partial<{ root: string; track: string; label: string; circle: string }>`
Required: false
Default Value: `undefined`
Description: The ids of the elements in the progress bar. Useful for composition.
**`locale`**
Type: `string`
Required: false
Default Value: `"en-US"`
Description: The locale to use for formatting the value.
**`max`**
Type: `number`
Required: false
Default Value: `100`
Description: The maximum allowed value of the progress bar.
**`min`**
Type: `number`
Required: false
Default Value: `0`
Description: The minimum allowed value of the progress bar.
**`modelValue`**
Type: `number`
Required: false
Default Value: `undefined`
Description: The v-model value of the progress
**`orientation`**
Type: `'horizontal' | 'vertical'`
Required: false
Default Value: `"horizontal"`
Description: The orientation of the element.
**`translations`**
Type: `IntlTranslations`
Required: false
Default Value: `undefined`
Description: The localized messages to use.
#### Emits
**`update:modelValue`**
Type: `[value: number | null]`
Description: The callback fired when the model value changes.
**`valueChange`**
Type: `[details: ValueChangeDetails]`
Description: Callback fired when the value changes.
#### Data Attributes
**`data-scope`**: progress
**`data-part`**: root
**`data-max`**:
**`data-value`**: The value of the item
**`data-state`**:
**`data-orientation`**: The orientation of the progress
### Circle
#### Props
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
### CircleRange
#### Props
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
#### Data Attributes
**`data-scope`**: progress
**`data-part`**: circle-range
**`data-state`**:
### CircleTrack
#### Props
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
#### Data Attributes
**`data-scope`**: progress
**`data-part`**: circle-track
**`data-orientation`**: The orientation of the circletrack
### Label
#### Props
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
#### Data Attributes
**`data-scope`**: progress
**`data-part`**: label
**`data-orientation`**: The orientation of the label
### Range
#### Props
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
#### Data Attributes
**`data-scope`**: progress
**`data-part`**: range
**`data-orientation`**: The orientation of the range
**`data-state`**:
### RootProvider
#### Props
**`value`**
Type: `ProgressApi`
Required: true
Default Value: `undefined`
Description: undefined
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
### Track
#### Props
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
### ValueText
#### Props
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
### View
#### Props
**`state`**
Type: `ProgressState`
Required: true
Default Value: `undefined`
Description: undefined
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
#### Data Attributes
**`data-scope`**: progress
**`data-part`**: view
**`data-state`**:
## Accessibility
Complies with the [the progressbar role requirements.](https://w3c.github.io/aria/#progressbar).
# QR Code (REACT)
## Anatomy
To set up the QR code correctly, you'll need to understand its anatomy and how we name its parts.
> Each part includes a `data-part` attribute to help identify them in the DOM.
## Examples
Learn how to use the `QR Code` component in your project. Let's take a look at the most basic example:
```tsx
import { QrCode } from '@ark-ui/react/qr-code'
export const Basic = () => {
return (
Download
)
}
```
### Download a QR Code
You can download the QR code by using the `QrCode.DownloadTrigger`. You will have to provide the `fileName` and the
`mimeType` of the image.
```tsx
Download
```
### With Overlay
You can also add a logo or overlay to the QR code. This is useful when you want to brand the QR code.
```tsx
import { QrCode } from '@ark-ui/react/qr-code'
export const WithOverlay = () => {
return (
)
}
```
### Error Correction
In cases where the link is too long or the logo overlay covers a significant area, the error correction level can be
increased.
Use the `encoding.ecc` or `encoding.boostEcc` property to set the error correction level:
- `L`: Allows recovery of up to 7% data loss (default)
- `M`: Allows recovery of up to 15% data loss
- `Q`: Allows recovery of up to 25% data loss
- `H`: Allows recovery of up to 30% data loss
```tsx
import { QrCode } from '@ark-ui/react/qr-code'
export const ErrorCorrection = () => {
return (
)
}
```
### Using the Root Provider
The `RootProvider` component provides a context for the QR code. It accepts the value of the `useQrCode` hook. You can
leverage it to access the component state and methods from outside the QR code.
```tsx
import { QrCode, useQrCode } from '@ark-ui/react/qr-code'
import { useState } from 'react'
export const RootProvider = () => {
const [value, setValue] = useState('http://ark-ui.com')
const qrCode = useQrCode({ value })
return (
<>
>
)
}
```
> If you're using the `RootProvider` component, you don't need to use the `Root` component.
## API Reference
### Root
#### Props
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
**`defaultValue`**
Type: `string`
Required: false
Default Value: `undefined`
Description: The initial value to encode when rendered.
Use when you don't need to control the value of the qr code.
**`encoding`**
Type: `QrCodeGenerateOptions`
Required: false
Default Value: `undefined`
Description: The qr code encoding options.
**`id`**
Type: `string`
Required: false
Default Value: `undefined`
Description: The unique identifier of the machine.
**`ids`**
Type: `Partial<{ root: string; frame: string }>`
Required: false
Default Value: `undefined`
Description: The element ids.
**`onValueChange`**
Type: `(details: ValueChangeDetails) => void`
Required: false
Default Value: `undefined`
Description: Callback fired when the value changes.
**`pixelSize`**
Type: `number`
Required: false
Default Value: `undefined`
Description: The pixel size of the qr code.
**`value`**
Type: `string`
Required: false
Default Value: `undefined`
Description: The controlled value to encode.
### DownloadTrigger
#### Props
**`fileName`**
Type: `string`
Required: true
Default Value: `undefined`
Description: The name of the file.
**`mimeType`**
Type: `DataUrlType`
Required: true
Default Value: `undefined`
Description: The mime type of the image.
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
**`quality`**
Type: `number`
Required: false
Default Value: `undefined`
Description: The quality of the image.
### Frame
#### Props
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
### Overlay
#### Props
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
### Pattern
#### Props
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
### RootProvider
#### Props
**`value`**
Type: `UseQrCodeReturn`
Required: true
Default Value: `undefined`
Description: undefined
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
# QR Code (SOLID)
## Anatomy
To set up the QR code correctly, you'll need to understand its anatomy and how we name its parts.
> Each part includes a `data-part` attribute to help identify them in the DOM.
## Examples
Learn how to use the `QR Code` component in your project. Let's take a look at the most basic example:
```tsx
import { QrCode } from '@ark-ui/solid/qr-code'
export const Basic = () => {
return (
Download
)
}
```
### Download a QR Code
You can download the QR code by using the `QrCode.DownloadTrigger`. You will have to provide the `fileName` and the
`mimeType` of the image.
```tsx
Download
```
### With Overlay
You can also add a logo or overlay to the QR code. This is useful when you want to brand the QR code.
```tsx
import { QrCode } from '@ark-ui/solid/qr-code'
export const WithOverlay = () => {
return (
)
}
```
### Error Correction
In cases where the link is too long or the logo overlay covers a significant area, the error correction level can be
increased.
Use the `encoding.ecc` or `encoding.boostEcc` property to set the error correction level:
- `L`: Allows recovery of up to 7% data loss (default)
- `M`: Allows recovery of up to 15% data loss
- `Q`: Allows recovery of up to 25% data loss
- `H`: Allows recovery of up to 30% data loss
```tsx
import { QrCode } from '@ark-ui/solid/qr-code'
export const ErrorCorrection = () => {
return (
)
}
```
### Using the Root Provider
The `RootProvider` component provides a context for the QR code. It accepts the value of the `useQrCode` hook. You can
leverage it to access the component state and methods from outside the QR code.
```tsx
import { QrCode, useQrCode } from '@ark-ui/solid/qr-code'
export const RootProvider = () => {
const qrCode = useQrCode({ defaultValue: 'http://ark-ui.com' })
return (
<>
>
)
}
```
> If you're using the `RootProvider` component, you don't need to use the `Root` component.
## API Reference
### Root
#### Props
**`asChild`**
Type: `(props: ParentProps<'div'>) => Element`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
**`defaultValue`**
Type: `string`
Required: false
Default Value: `undefined`
Description: The initial value to encode when rendered.
Use when you don't need to control the value of the qr code.
**`encoding`**
Type: `QrCodeGenerateOptions`
Required: false
Default Value: `undefined`
Description: The qr code encoding options.
**`ids`**
Type: `Partial<{ root: string; frame: string }>`
Required: false
Default Value: `undefined`
Description: The element ids.
**`onValueChange`**
Type: `(details: ValueChangeDetails) => void`
Required: false
Default Value: `undefined`
Description: Callback fired when the value changes.
**`pixelSize`**
Type: `number`
Required: false
Default Value: `undefined`
Description: The pixel size of the qr code.
**`value`**
Type: `string`
Required: false
Default Value: `undefined`
Description: The controlled value to encode.
### DownloadTrigger
#### Props
**`fileName`**
Type: `string`
Required: true
Default Value: `undefined`
Description: The name of the file.
**`mimeType`**
Type: `DataUrlType`
Required: true
Default Value: `undefined`
Description: The mime type of the image.
**`asChild`**
Type: `(props: ParentProps<'button'>) => Element`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
**`quality`**
Type: `number`
Required: false
Default Value: `undefined`
Description: The quality of the image.
### Frame
#### Props
**`asChild`**
Type: `(props: ParentProps<'svg'>) => Element`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
### Overlay
#### Props
**`asChild`**
Type: `(props: ParentProps<'div'>) => Element`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
### Pattern
#### Props
**`asChild`**
Type: `(props: ParentProps<'path'>) => Element`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
### RootProvider
#### Props
**`value`**
Type: `UseQrCodeReturn`
Required: true
Default Value: `undefined`
Description: undefined
**`asChild`**
Type: `(props: ParentProps<'div'>) => Element`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
# QR Code (VUE)
## Anatomy
To set up the QR code correctly, you'll need to understand its anatomy and how we name its parts.
> Each part includes a `data-part` attribute to help identify them in the DOM.
## Examples
Learn how to use the `QR Code` component in your project. Let's take a look at the most basic example:
```vue
Download
```
### Download a QR Code
You can download the QR code by using the `QrCode.DownloadTrigger`. You will have to provide the `fileName` and the
`mimeType` of the image.
```tsx
Download
```
### With Overlay
You can also add a logo or overlay to the QR code. This is useful when you want to brand the QR code.
```vue
```
### Error Correction
In cases where the link is too long or the logo overlay covers a significant area, the error correction level can be
increased.
Use the `encoding.ecc` or `encoding.boostEcc` property to set the error correction level:
- `L`: Allows recovery of up to 7% data loss (default)
- `M`: Allows recovery of up to 15% data loss
- `Q`: Allows recovery of up to 25% data loss
- `H`: Allows recovery of up to 30% data loss
```vue
```
### Using the Root Provider
The `RootProvider` component provides a context for the QR code. It accepts the value of the `useQrCode` hook. You can
leverage it to access the component state and methods from outside the QR code.
```vue
```
> If you're using the `RootProvider` component, you don't need to use the `Root` component.
## API Reference
### Root
#### Props
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
**`defaultValue`**
Type: `string`
Required: false
Default Value: `undefined`
Description: The initial value to encode when rendered.
Use when you don't need to control the value of the qr code.
**`encoding`**
Type: `QrCodeGenerateOptions`
Required: false
Default Value: `undefined`
Description: The qr code encoding options.
**`id`**
Type: `string`
Required: false
Default Value: `undefined`
Description: The unique identifier of the machine.
**`ids`**
Type: `Partial<{ root: string; frame: string }>`
Required: false
Default Value: `undefined`
Description: The element ids.
**`modelValue`**
Type: `string`
Required: false
Default Value: `undefined`
Description: The v-model value of the qr code
**`pixelSize`**
Type: `number`
Required: false
Default Value: `undefined`
Description: The pixel size of the qr code.
#### Emits
**`update:modelValue`**
Type: `[value: string]`
Description: The callback fired when the model value changes.
**`valueChange`**
Type: `[details: ValueChangeDetails]`
Description: Callback fired when the value changes.
### DownloadTrigger
#### Props
**`fileName`**
Type: `string`
Required: true
Default Value: `undefined`
Description: The name of the file.
**`mimeType`**
Type: `DataUrlType`
Required: true
Default Value: `undefined`
Description: The mime type of the image.
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
**`quality`**
Type: `number`
Required: false
Default Value: `undefined`
Description: The quality of the image.
### Frame
#### Props
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
### Overlay
#### Props
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
### Pattern
#### Props
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
### RootProvider
#### Props
**`value`**
Type: `QrCodeApi`
Required: true
Default Value: `undefined`
Description: undefined
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
# Radio Group (REACT)
## Anatomy
To set up the radio group correctly, you'll need to understand its anatomy and how we name its parts.
> Each part includes a `data-part` attribute to help identify them in the DOM.
### Design impact on the asChild property
The `RadioGroup.Item` element of the radio group is a `label` element. This is because the radio group is a form control
and should be associated with a label to provide context and meaning to the user. Otherwise, the HTML and accessibility
structure will be invalid.
> If you need to use the `asChild` property, make sure that the `label` element is the direct child of the
> `RadioGroup.Item` component.
## Examples
Learn how to use the `RadioGroup` component in your project. Let's take a look at the most basic example:
```tsx
import { RadioGroup } from '@ark-ui/react/radio-group'
export const Basic = () => {
const frameworks = ['React', 'Solid', 'Vue']
return (
Framework
{frameworks.map((framework) => (
{framework}
))}
)
}
```
### Disabling the radio group
To make a radio group disabled, set the `disabled` prop to `true`.
```tsx
import { RadioGroup } from '@ark-ui/react/radio-group'
export const Disabled = () => {
const frameworks = ['React', 'Solid', 'Vue']
return (
Framework
{frameworks.map((framework) => (
{framework}
))}
)
}
```
### Setting the initial value
To set the radio group's initial value, set the `defaultValue` prop to the value of the radio item to be selected by
default.
```tsx
import { RadioGroup } from '@ark-ui/react/radio-group'
export const InitialValue = () => {
const frameworks = ['React', 'Solid', 'Vue']
return (
Framework
{frameworks.map((framework) => (
{framework}
))}
)
}
```
### Listening for changes
When the radio group value changes, the `onValueChange` callback is invoked.
```tsx
import { RadioGroup } from '@ark-ui/react/radio-group'
export const OnEvent = () => {
const frameworks = ['React', 'Solid', 'Vue']
return (
console.log(details.value)}>
Framework
{frameworks.map((framework) => (
{framework}
))}
)
}
```
### Using the Root Provider
The `RootProvider` component provides a context for the radio-group. It accepts the value of the `useRadio-group` hook.
You can leverage it to access the component state and methods from outside the radio-group.
```tsx
import { RadioGroup, useRadioGroup } from '@ark-ui/react/radio-group'
export const RootProvider = () => {
const frameworks = ['React', 'Solid', 'Vue']
const radioGroup = useRadioGroup()
return (
<>
Framework
{frameworks.map((framework) => (
{framework}
))}
>
)
}
```
> If you're using the `RootProvider` component, you don't need to use the `Root` component.
## API Reference
### Root
#### Props
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
**`defaultValue`**
Type: `string`
Required: false
Default Value: `undefined`
Description: The initial value of the checked radio when rendered.
Use when you don't need to control the value of the radio group.
**`disabled`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: If `true`, the radio group will be disabled
**`form`**
Type: `string`
Required: false
Default Value: `undefined`
Description: The associate form of the underlying input.
**`id`**
Type: `string`
Required: false
Default Value: `undefined`
Description: The unique identifier of the machine.
**`ids`**
Type: `Partial<{
root: string
label: string
indicator: string
item(value: string): string
itemLabel(value: string): string
itemControl(value: string): string
itemHiddenInput(value: string): string
}>`
Required: false
Default Value: `undefined`
Description: The ids of the elements in the radio. Useful for composition.
**`name`**
Type: `string`
Required: false
Default Value: `undefined`
Description: The name of the input fields in the radio
(Useful for form submission).
**`onValueChange`**
Type: `(details: ValueChangeDetails) => void`
Required: false
Default Value: `undefined`
Description: Function called once a radio is checked
**`orientation`**
Type: `'horizontal' | 'vertical'`
Required: false
Default Value: `undefined`
Description: Orientation of the radio group
**`readOnly`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Whether the checkbox is read-only
**`value`**
Type: `string`
Required: false
Default Value: `undefined`
Description: The controlled value of the radio group
#### Data Attributes
**`data-scope`**: radio-group
**`data-part`**: root
**`data-orientation`**: The orientation of the radio-group
**`data-disabled`**: Present when disabled
### Indicator
#### Props
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
#### Data Attributes
**`data-scope`**: radio-group
**`data-part`**: indicator
**`data-disabled`**: Present when disabled
**`data-orientation`**: The orientation of the indicator
### ItemControl
#### Props
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
#### Data Attributes
**`data-scope`**: radio-group
**`data-part`**: item-control
**`data-active`**: Present when active or pressed
### ItemHiddenInput
#### Props
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
### Item
#### Props
**`value`**
Type: `string`
Required: true
Default Value: `undefined`
Description: undefined
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
**`disabled`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: undefined
**`invalid`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: undefined
### ItemText
#### Props
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
### Label
#### Props
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
#### Data Attributes
**`data-scope`**: radio-group
**`data-part`**: label
**`data-orientation`**: The orientation of the label
**`data-disabled`**: Present when disabled
### RootProvider
#### Props
**`value`**
Type: `UseRadioGroupReturn`
Required: true
Default Value: `undefined`
Description: undefined
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
## Accessibility
Complies with the [Radio WAI-ARIA design pattern](https://www.w3.org/WAI/ARIA/apg/patterns/radio/).
### Keyboard Support
**`Tab`**
Description: Moves focus to either the checked radio item or the first radio item in the group.
**`Space`**
Description: When focus is on an unchecked radio item, checks it.
**`ArrowDown`**
Description: Moves focus and checks the next radio item in the group.
**`ArrowRight`**
Description: Moves focus and checks the next radio item in the group.
**`ArrowUp`**
Description: Moves focus to the previous radio item in the group.
**`ArrowLeft`**
Description: Moves focus to the previous radio item in the group.
# Radio Group (SOLID)
## Anatomy
To set up the radio group correctly, you'll need to understand its anatomy and how we name its parts.
> Each part includes a `data-part` attribute to help identify them in the DOM.
### Design impact on the asChild property
The `RadioGroup.Item` element of the radio group is a `label` element. This is because the radio group is a form control
and should be associated with a label to provide context and meaning to the user. Otherwise, the HTML and accessibility
structure will be invalid.
> If you need to use the `asChild` property, make sure that the `label` element is the direct child of the
> `RadioGroup.Item` component.
## Examples
Learn how to use the `RadioGroup` component in your project. Let's take a look at the most basic example:
```tsx
import { RadioGroup } from '@ark-ui/solid/radio-group'
import { Index } from 'solid-js'
export const Basic = () => {
const frameworks = ['React', 'Solid', 'Vue']
return (
Framework
{(framework) => (
{framework()}
)}
)
}
```
### Disabling the radio group
To make a radio group disabled, set the `disabled` prop to `true`.
```tsx
import { RadioGroup } from '@ark-ui/solid/radio-group'
import { Index } from 'solid-js'
export const Disabled = () => {
const frameworks = ['React', 'Solid', 'Vue']
return (
Framework
{(framework) => (
{framework()}
)}
)
}
```
### Setting the initial value
To set the radio group's initial value, set the `defaultValue` prop to the value of the radio item to be selected by
default.
```tsx
import { RadioGroup } from '@ark-ui/solid/radio-group'
import { Index } from 'solid-js'
export const InitialValue = () => {
const frameworks = ['React', 'Solid', 'Vue']
return (
Framework
{(framework) => (
{framework()}
)}
)
}
```
### Listening for changes
When the radio group value changes, the `onValueChange` callback is invoked.
```tsx
import { RadioGroup } from '@ark-ui/solid/radio-group'
import { Index } from 'solid-js'
export const OnEvent = () => {
const frameworks = ['React', 'Solid', 'Vue']
return (
console.log(details.value)}>
Framework
{(framework) => (
{framework()}
)}
)
}
```
### Using the Root Provider
The `RootProvider` component provides a context for the radio-group. It accepts the value of the `useRadio-group` hook.
You can leverage it to access the component state and methods from outside the radio-group.
```tsx
import { RadioGroup, useRadioGroup } from '@ark-ui/solid/radio-group'
import { Index } from 'solid-js'
export const RootProvider = () => {
const frameworks = ['React', 'Solid', 'Vue']
const radioGroup = useRadioGroup()
return (
<>
Framework
{(framework) => (
{framework()}
)}
>
)
}
```
> If you're using the `RootProvider` component, you don't need to use the `Root` component.
## API Reference
### Root
#### Props
**`asChild`**
Type: `(props: ParentProps<'div'>) => Element`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
**`defaultValue`**
Type: `string`
Required: false
Default Value: `undefined`
Description: The initial value of the checked radio when rendered.
Use when you don't need to control the value of the radio group.
**`disabled`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: If `true`, the radio group will be disabled
**`form`**
Type: `string`
Required: false
Default Value: `undefined`
Description: The associate form of the underlying input.
**`ids`**
Type: `Partial<{
root: string
label: string
indicator: string
item(value: string): string
itemLabel(value: string): string
itemControl(value: string): string
itemHiddenInput(value: string): string
}>`
Required: false
Default Value: `undefined`
Description: The ids of the elements in the radio. Useful for composition.
**`name`**
Type: `string`
Required: false
Default Value: `undefined`
Description: The name of the input fields in the radio
(Useful for form submission).
**`onValueChange`**
Type: `(details: ValueChangeDetails) => void`
Required: false
Default Value: `undefined`
Description: Function called once a radio is checked
**`orientation`**
Type: `'horizontal' | 'vertical'`
Required: false
Default Value: `undefined`
Description: Orientation of the radio group
**`readOnly`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Whether the checkbox is read-only
**`value`**
Type: `string`
Required: false
Default Value: `undefined`
Description: The controlled value of the radio group
#### Data Attributes
**`data-scope`**: radio-group
**`data-part`**: root
**`data-orientation`**: The orientation of the radio-group
**`data-disabled`**: Present when disabled
### Indicator
#### Props
**`asChild`**
Type: `(props: ParentProps<'div'>) => Element`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
#### Data Attributes
**`data-scope`**: radio-group
**`data-part`**: indicator
**`data-disabled`**: Present when disabled
**`data-orientation`**: The orientation of the indicator
### ItemControl
#### Props
**`asChild`**
Type: `(props: ParentProps<'div'>) => Element`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
#### Data Attributes
**`data-scope`**: radio-group
**`data-part`**: item-control
**`data-active`**: Present when active or pressed
### ItemHiddenInput
#### Props
**`asChild`**
Type: `(props: ParentProps<'input'>) => Element`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
### Item
#### Props
**`value`**
Type: `string`
Required: true
Default Value: `undefined`
Description: undefined
**`asChild`**
Type: `(props: ParentProps<'label'>) => Element`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
**`disabled`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: undefined
**`invalid`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: undefined
### ItemText
#### Props
**`asChild`**
Type: `(props: ParentProps<'span'>) => Element`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
### Label
#### Props
**`asChild`**
Type: `(props: ParentProps<'label'>) => Element`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
#### Data Attributes
**`data-scope`**: radio-group
**`data-part`**: label
**`data-orientation`**: The orientation of the label
**`data-disabled`**: Present when disabled
### RootProvider
#### Props
**`value`**
Type: `UseRadioGroupReturn`
Required: true
Default Value: `undefined`
Description: undefined
**`asChild`**
Type: `(props: ParentProps<'div'>) => Element`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
## Accessibility
Complies with the [Radio WAI-ARIA design pattern](https://www.w3.org/WAI/ARIA/apg/patterns/radio/).
### Keyboard Support
**`Tab`**
Description: Moves focus to either the checked radio item or the first radio item in the group.
**`Space`**
Description: When focus is on an unchecked radio item, checks it.
**`ArrowDown`**
Description: Moves focus and checks the next radio item in the group.
**`ArrowRight`**
Description: Moves focus and checks the next radio item in the group.
**`ArrowUp`**
Description: Moves focus to the previous radio item in the group.
**`ArrowLeft`**
Description: Moves focus to the previous radio item in the group.
# Radio Group (VUE)
## Anatomy
To set up the radio group correctly, you'll need to understand its anatomy and how we name its parts.
> Each part includes a `data-part` attribute to help identify them in the DOM.
### Design impact on the asChild property
The `RadioGroup.Item` element of the radio group is a `label` element. This is because the radio group is a form control
and should be associated with a label to provide context and meaning to the user. Otherwise, the HTML and accessibility
structure will be invalid.
> If you need to use the `asChild` property, make sure that the `label` element is the direct child of the
> `RadioGroup.Item` component.
## Examples
Learn how to use the `RadioGroup` component in your project. Let's take a look at the most basic example:
```vue
Framework{{ framework }}
```
### Disabling the radio group
To make a radio group disabled, set the `disabled` prop to `true`.
```vue
Framework{{ framework }}
```
### Setting the initial value
To set the radio group's initial value, set the `defaultValue` prop to the value of the radio item to be selected by
default.
```vue
Framework{{ framework }}
```
### Listening for changes
When the radio group value changes, the `onValueChange` callback is invoked.
```vue
console.log(details.value)">
Framework{{ framework }}
```
### Using the Root Provider
The `RootProvider` component provides a context for the radio-group. It accepts the value of the `useRadio-group` hook.
You can leverage it to access the component state and methods from outside the radio-group.
```vue
Framework{{ framework }}
```
> If you're using the `RootProvider` component, you don't need to use the `Root` component.
## API Reference
### Root
#### Props
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
**`defaultValue`**
Type: `string`
Required: false
Default Value: `undefined`
Description: The initial value of the checked radio when rendered.
Use when you don't need to control the value of the radio group.
**`disabled`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: If `true`, the radio group will be disabled
**`form`**
Type: `string`
Required: false
Default Value: `undefined`
Description: The associate form of the underlying input.
**`id`**
Type: `string`
Required: false
Default Value: `undefined`
Description: The unique identifier of the machine.
**`ids`**
Type: `Partial<{
root: string
label: string
indicator: string
item(value: string): string
itemLabel(value: string): string
itemControl(value: string): string
itemHiddenInput(value: string): string
}>`
Required: false
Default Value: `undefined`
Description: The ids of the elements in the radio. Useful for composition.
**`modelValue`**
Type: `string`
Required: false
Default Value: `undefined`
Description: The v-model value of the radio group
**`name`**
Type: `string`
Required: false
Default Value: `undefined`
Description: The name of the input fields in the radio
(Useful for form submission).
**`orientation`**
Type: `'horizontal' | 'vertical'`
Required: false
Default Value: `undefined`
Description: Orientation of the radio group
**`readOnly`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Whether the checkbox is read-only
#### Emits
**`update:modelValue`**
Type: `[value: string | null]`
Description: The callback fired when the model value changes.
**`valueChange`**
Type: `[details: ValueChangeDetails]`
Description: Function called once a radio is checked
#### Data Attributes
**`data-scope`**: radio-group
**`data-part`**: root
**`data-orientation`**: The orientation of the radio-group
**`data-disabled`**: Present when disabled
### Indicator
#### Props
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
#### Data Attributes
**`data-scope`**: radio-group
**`data-part`**: indicator
**`data-disabled`**: Present when disabled
**`data-orientation`**: The orientation of the indicator
### ItemControl
#### Props
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
#### Data Attributes
**`data-scope`**: radio-group
**`data-part`**: item-control
**`data-active`**: Present when active or pressed
### ItemHiddenInput
#### Props
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
### Item
#### Props
**`value`**
Type: `string`
Required: true
Default Value: `undefined`
Description: undefined
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
**`disabled`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: undefined
**`invalid`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: undefined
### ItemText
#### Props
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
### Label
#### Props
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
#### Data Attributes
**`data-scope`**: radio-group
**`data-part`**: label
**`data-orientation`**: The orientation of the label
**`data-disabled`**: Present when disabled
### RootProvider
#### Props
**`value`**
Type: `RadioGroupApi`
Required: true
Default Value: `undefined`
Description: undefined
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
## Accessibility
Complies with the [Radio WAI-ARIA design pattern](https://www.w3.org/WAI/ARIA/apg/patterns/radio/).
### Keyboard Support
**`Tab`**
Description: Moves focus to either the checked radio item or the first radio item in the group.
**`Space`**
Description: When focus is on an unchecked radio item, checks it.
**`ArrowDown`**
Description: Moves focus and checks the next radio item in the group.
**`ArrowRight`**
Description: Moves focus and checks the next radio item in the group.
**`ArrowUp`**
Description: Moves focus to the previous radio item in the group.
**`ArrowLeft`**
Description: Moves focus to the previous radio item in the group.
# Rating Group (REACT)
## Anatomy
To set up the rating correctly, you'll need to understand its anatomy and how we name its parts.
> Each part includes a `data-part` attribute to help identify them in the DOM.
## Examples
Learn how to use the `RatingGroup` component in your project. Let's take a look at the most basic example:
```tsx
import { RatingGroup } from '@ark-ui/react/rating-group'
import { StarIcon } from 'lucide-react'
export const Basic = () => (
Label
{({ items }) =>
items.map((item) => (
{({ highlighted }) => (highlighted ? : )}
))
}
)
```
### Using half ratings
Allow `0.5` value steps by setting the `allowHalf` prop to `true`. Ensure to render the correct icon if the `isHalf`
value is set in the Rating components render callback.
```tsx
import { RatingGroup } from '@ark-ui/react/rating-group'
import { StarHalfIcon, StarIcon } from 'lucide-react'
export const HalfRatings = () => (
Label
{({ items }) =>
items.map((item) => (
{({ half, highlighted }) => {
if (half) return
if (highlighted) return
return
}}
))
}
)
```
### Using a default value
```tsx
import { RatingGroup } from '@ark-ui/react/rating-group'
import { StarIcon } from 'lucide-react'
export const InitialValue = () => (
Label
{({ items }) =>
items.map((item) => (
{({ highlighted }) => (highlighted ? : )}
))
}
)
```
### Controlled
When using the `RatingGroup` component, you can use the `value` and `onValueChange` props to control the state.
```tsx
import { RatingGroup } from '@ark-ui/react/rating-group'
import { StarIcon } from 'lucide-react'
import { useState } from 'react'
export const Controlled = () => {
const [value, setValue] = useState(0)
return (
setValue(details.value)} allowHalf>
Label
{({ items }) =>
items.map((item) => (
{({ highlighted }) => (highlighted ? : )}
))
}
)
}
```
### Disabling the rating group
To make the rating group disabled, set the `disabled` prop to `true`.
```tsx
import { RatingGroup } from '@ark-ui/react/rating-group'
import { StarIcon } from 'lucide-react'
export const Disabled = () => (
Label
{({ items }) =>
items.map((item) => (
{({ highlighted }) => (highlighted ? : )}
))
}
)
```
### Readonly rating group
To make the rating group readonly, set the `readOnly` prop to `true`.
```tsx
import { RatingGroup } from '@ark-ui/react/rating-group'
import { StarIcon } from 'lucide-react'
export const ReadOnly = () => (
Label
{({ items }) =>
items.map((item) => (
{({ highlighted }) => (highlighted ? : )}
))
}
)
```
### Usage within forms
To use the rating group within forms, pass the prop `name`. It will render a hidden input and ensure the value changes
get propagated to the form correctly.
```tsx
import { RatingGroup } from '@ark-ui/react/rating-group'
import { StarIcon } from 'lucide-react'
export const FormUsage = () => (
Label
{({ items }) =>
items.map((item) => (
{({ highlighted }) => (highlighted ? : )}
))
}
)
```
### Using the Field Component
The `Field` component helps manage form-related state and accessibility attributes of a rating group. It includes
handling ARIA labels, helper text, and error text to ensure proper accessibility.
```tsx
import { Field } from '@ark-ui/react/field'
import { RatingGroup } from '@ark-ui/react/rating-group'
import { StarIcon } from 'lucide-react'
export const WithField = (props: Field.RootProps) => {
return (
Label
{({ items }) =>
items.map((item) => (
{({ highlighted }) => (highlighted ? : )}
))
}
Additional InfoError Info
)
}
```
### Using the Root Provider
The `RootProvider` component provides a context for the rating-group. It accepts the value of the `useRating-group`
hook. You can leverage it to access the component state and methods from outside the rating-group.
```tsx
import { RatingGroup, useRatingGroup } from '@ark-ui/react/rating-group'
import { StarIcon } from 'lucide-react'
export const RootProvider = () => {
const ratingGroup = useRatingGroup({ count: 5, defaultValue: 3 })
return (
<>
Label
{({ items }) =>
items.map((item) => (
{({ highlighted }) => (highlighted ? : )}
))
}
>
)
}
```
> If you're using the `RootProvider` component, you don't need to use the `Root` component.
## API Reference
### Root
#### Props
**`allowHalf`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Whether to allow half stars.
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
**`autoFocus`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Whether to autofocus the rating.
**`count`**
Type: `number`
Required: false
Default Value: `5`
Description: The total number of ratings.
**`defaultValue`**
Type: `number`
Required: false
Default Value: `undefined`
Description: The initial value of the rating when rendered.
Use when you don't need to control the value of the rating.
**`disabled`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Whether the rating is disabled.
**`form`**
Type: `string`
Required: false
Default Value: `undefined`
Description: The associate form of the underlying input element.
**`id`**
Type: `string`
Required: false
Default Value: `undefined`
Description: The unique identifier of the machine.
**`ids`**
Type: `Partial<{
root: string
label: string
hiddenInput: string
control: string
item(id: string): string
}>`
Required: false
Default Value: `undefined`
Description: The ids of the elements in the rating. Useful for composition.
**`name`**
Type: `string`
Required: false
Default Value: `undefined`
Description: The name attribute of the rating element (used in forms).
**`onHoverChange`**
Type: `(details: HoverChangeDetails) => void`
Required: false
Default Value: `undefined`
Description: Function to be called when the rating value is hovered.
**`onValueChange`**
Type: `(details: ValueChangeDetails) => void`
Required: false
Default Value: `undefined`
Description: Function to be called when the rating value changes.
**`readOnly`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Whether the rating is readonly.
**`required`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Whether the rating is required.
**`translations`**
Type: `IntlTranslations`
Required: false
Default Value: `undefined`
Description: Specifies the localized strings that identifies the accessibility elements and their states
**`value`**
Type: `number`
Required: false
Default Value: `undefined`
Description: The controlled value of the rating
### Control
#### Props
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
#### Data Attributes
**`data-scope`**: rating-group
**`data-part`**: control
**`data-readonly`**: Present when read-only
**`data-disabled`**: Present when disabled
### HiddenInput
#### Props
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
### Item
#### Props
**`index`**
Type: `number`
Required: true
Default Value: `undefined`
Description: undefined
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
#### Data Attributes
**`data-scope`**: rating-group
**`data-part`**: item
**`data-disabled`**: Present when disabled
**`data-readonly`**: Present when read-only
**`data-checked`**: Present when checked
**`data-highlighted`**: Present when highlighted
**`data-half`**:
### Label
#### Props
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
#### Data Attributes
**`data-scope`**: rating-group
**`data-part`**: label
**`data-disabled`**: Present when disabled
### RootProvider
#### Props
**`value`**
Type: `UseRatingGroupReturn`
Required: true
Default Value: `undefined`
Description: undefined
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
## Accessibility
### Keyboard Support
**`ArrowRight`**
Description: Moves focus to the next star, increasing the rating value based on the `allowHalf` property.
**`ArrowLeft`**
Description: Moves focus to the previous star, decreasing the rating value based on the `allowHalf` property.
**`Enter`**
Description: Selects the focused star in the rating group.
# Rating Group (SOLID)
## Anatomy
To set up the rating correctly, you'll need to understand its anatomy and how we name its parts.
> Each part includes a `data-part` attribute to help identify them in the DOM.
## Examples
Learn how to use the `RatingGroup` component in your project. Let's take a look at the most basic example:
```tsx
import { RatingGroup } from '@ark-ui/solid/rating-group'
import { StarIcon } from 'lucide-solid'
import { Index, Show } from 'solid-js'
export const Basic = () => (
Label
{(context) => (
{(index) => (
{(context) => (
}>
)}
)}
)}
)
```
### Using half ratings
Allow `0.5` value steps by setting the `allowHalf` prop to `true`. Ensure to render the correct icon if the `isHalf`
value is set in the Rating components render callback.
```tsx
import { RatingGroup } from '@ark-ui/solid/rating-group'
import { StarHalfIcon, StarIcon } from 'lucide-solid'
import { Index } from 'solid-js'
export const HalfRatings = () => (
Label
{(context) => (
{(index) => (
{(context) =>
context().half ? (
) : context().highlighted ? (
) : (
)
}
)}
)}
)
```
### Using a default value
```tsx
import { RatingGroup } from '@ark-ui/solid/rating-group'
import { StarIcon } from 'lucide-solid'
import { Index, Show } from 'solid-js'
export const InitialValue = () => (
Label
{(context) => (
{(index) => (
{(context) => (
}>
)}
)}
)}
)
```
### Controlled
When using the `RatingGroup` component, you can use the `value` and `onValueChange` props to control the state.
```tsx
import { RatingGroup } from '@ark-ui/solid/rating-group'
import { StarIcon } from 'lucide-solid'
import { Index, Show, createSignal } from 'solid-js'
export const Controlled = () => {
const [value, setValue] = createSignal(0)
return (
setValue(details.value)}>
Label
{(context) => (
{(index) => (
{(context) => (
}>
)}
)}
)}
)
}
```
### Disabling the rating group
To make the rating group disabled, set the `disabled` prop to `true`.
```tsx
import { RatingGroup } from '@ark-ui/solid/rating-group'
import { StarIcon } from 'lucide-solid'
import { Index, Show } from 'solid-js'
export const Disabled = () => (
Label
{(context) => (
{(index) => (
{(context) => (
}>
)}
)}
)}
)
```
### Readonly rating group
To make the rating group readonly, set the `readOnly` prop to `true`.
```tsx
import { RatingGroup } from '@ark-ui/solid/rating-group'
import { StarIcon } from 'lucide-solid'
import { Index, Show } from 'solid-js'
export const ReadOnly = () => (
Label
{(context) => (
{(index) => (
{(context) => (
}>
)}
)}
)}
)
```
### Usage within forms
To use the rating group within forms, pass the prop `name`. It will render a hidden input and ensure the value changes
get propagated to the form correctly.
```tsx
import { RatingGroup } from '@ark-ui/solid/rating-group'
import { StarIcon } from 'lucide-solid'
import { Index, Show } from 'solid-js'
export const FormUsage = () => (
Label
{(context) => (
{(index) => (
{(context) => (
}>
)}
)}
)}
)
```
### Using the Field Component
The `Field` component helps manage form-related state and accessibility attributes of a rating group. It includes
handling ARIA labels, helper text, and error text to ensure proper accessibility.
```tsx
import { Field } from '@ark-ui/solid/field'
import { RatingGroup } from '@ark-ui/solid/rating-group'
import { StarIcon } from 'lucide-solid'
import { Index, Show } from 'solid-js'
export const WithField = (props: Field.RootProps) => {
return (
Label
{(context) => (
{(index) => (
{(context) => (
}>
)}
)}
)}
Additional InfoError Info
)
}
```
### Using the Root Provider
The `RootProvider` component provides a context for the rating-group. It accepts the value of the `useRating-group`
hook. You can leverage it to access the component state and methods from outside the rating-group.
```tsx
import { RatingGroup, useRatingGroup } from '@ark-ui/solid/rating-group'
import { StarIcon } from 'lucide-solid'
import { Index, Show } from 'solid-js'
export const RootProvider = () => {
const ratingGroup = useRatingGroup({ count: 5, value: 3 })
return (
<>
Label
{(context) => (
{(index) => (
{(context) => (
}>
)}
)}
)}
>
)
}
```
> If you're using the `RootProvider` component, you don't need to use the `Root` component.
## API Reference
### Root
#### Props
**`allowHalf`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Whether to allow half stars.
**`asChild`**
Type: `(props: ParentProps<'div'>) => Element`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
**`autoFocus`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Whether to autofocus the rating.
**`count`**
Type: `number`
Required: false
Default Value: `5`
Description: The total number of ratings.
**`defaultValue`**
Type: `number`
Required: false
Default Value: `undefined`
Description: The initial value of the rating when rendered.
Use when you don't need to control the value of the rating.
**`disabled`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Whether the rating is disabled.
**`form`**
Type: `string`
Required: false
Default Value: `undefined`
Description: The associate form of the underlying input element.
**`ids`**
Type: `Partial<{
root: string
label: string
hiddenInput: string
control: string
item(id: string): string
}>`
Required: false
Default Value: `undefined`
Description: The ids of the elements in the rating. Useful for composition.
**`name`**
Type: `string`
Required: false
Default Value: `undefined`
Description: The name attribute of the rating element (used in forms).
**`onHoverChange`**
Type: `(details: HoverChangeDetails) => void`
Required: false
Default Value: `undefined`
Description: Function to be called when the rating value is hovered.
**`onValueChange`**
Type: `(details: ValueChangeDetails) => void`
Required: false
Default Value: `undefined`
Description: Function to be called when the rating value changes.
**`readOnly`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Whether the rating is readonly.
**`required`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Whether the rating is required.
**`translations`**
Type: `IntlTranslations`
Required: false
Default Value: `undefined`
Description: Specifies the localized strings that identifies the accessibility elements and their states
**`value`**
Type: `number`
Required: false
Default Value: `undefined`
Description: The controlled value of the rating
### Control
#### Props
**`asChild`**
Type: `(props: ParentProps<'div'>) => Element`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
#### Data Attributes
**`data-scope`**: rating-group
**`data-part`**: control
**`data-readonly`**: Present when read-only
**`data-disabled`**: Present when disabled
### HiddenInput
#### Props
**`asChild`**
Type: `(props: ParentProps<'input'>) => Element`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
### Item
#### Props
**`index`**
Type: `number`
Required: true
Default Value: `undefined`
Description: undefined
**`asChild`**
Type: `(props: ParentProps<'span'>) => Element`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
#### Data Attributes
**`data-scope`**: rating-group
**`data-part`**: item
**`data-disabled`**: Present when disabled
**`data-readonly`**: Present when read-only
**`data-checked`**: Present when checked
**`data-highlighted`**: Present when highlighted
**`data-half`**:
### Label
#### Props
**`asChild`**
Type: `(props: ParentProps<'label'>) => Element`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
#### Data Attributes
**`data-scope`**: rating-group
**`data-part`**: label
**`data-disabled`**: Present when disabled
### RootProvider
#### Props
**`value`**
Type: `UseRatingGroupReturn`
Required: true
Default Value: `undefined`
Description: undefined
**`asChild`**
Type: `(props: ParentProps<'div'>) => Element`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
## Accessibility
### Keyboard Support
**`ArrowRight`**
Description: Moves focus to the next star, increasing the rating value based on the `allowHalf` property.
**`ArrowLeft`**
Description: Moves focus to the previous star, decreasing the rating value based on the `allowHalf` property.
**`Enter`**
Description: Selects the focused star in the rating group.
# Rating Group (VUE)
## Anatomy
To set up the rating correctly, you'll need to understand its anatomy and how we name its parts.
> Each part includes a `data-part` attribute to help identify them in the DOM.
## Examples
Learn how to use the `RatingGroup` component in your project. Let's take a look at the most basic example:
```vue
Label
```
### Using half ratings
Allow `0.5` value steps by setting the `allowHalf` prop to `true`. Ensure to render the correct icon if the `isHalf`
value is set in the Rating components render callback.
```vue
Label
```
### Using a default value
```vue
Label
```
### Controlled
When using the `RatingGroup` component, you can use the `value` and `onValueChange` props to control the state.
```vue
Label {{ value }}
```
### Disabling the rating group
To make the rating group disabled, set the `disabled` prop to `true`.
```vue
Label
```
### Readonly rating group
To make the rating group readonly, set the `readOnly` prop to `true`.
```vue
Label
```
### Usage within forms
To use the rating group within forms, pass the prop `name`. It will render a hidden input and ensure the value changes
get propagated to the form correctly.
```vue
Label
```
### Using the Field Component
The `Field` component helps manage form-related state and accessibility attributes of a rating group. It includes
handling ARIA labels, helper text, and error text to ensure proper accessibility.
```vue
LabelAdditional InfoError Info
```
### Using the Root Provider
The `RootProvider` component provides a context for the rating-group. It accepts the value of the `useRating-group`
hook. You can leverage it to access the component state and methods from outside the rating-group.
```vue
Label
```
> If you're using the `RootProvider` component, you don't need to use the `Root` component.
## API Reference
### Root
#### Props
**`allowHalf`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Whether to allow half stars.
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
**`autoFocus`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Whether to autofocus the rating.
**`count`**
Type: `number`
Required: false
Default Value: `5`
Description: The total number of ratings.
**`defaultValue`**
Type: `number`
Required: false
Default Value: `undefined`
Description: The initial value of the rating when rendered.
Use when you don't need to control the value of the rating.
**`disabled`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Whether the rating is disabled.
**`form`**
Type: `string`
Required: false
Default Value: `undefined`
Description: The associate form of the underlying input element.
**`id`**
Type: `string`
Required: false
Default Value: `undefined`
Description: The unique identifier of the machine.
**`ids`**
Type: `Partial<{
root: string
label: string
hiddenInput: string
control: string
item(id: string): string
}>`
Required: false
Default Value: `undefined`
Description: The ids of the elements in the rating. Useful for composition.
**`modelValue`**
Type: `number`
Required: false
Default Value: `undefined`
Description: The v-model value of the rating group
**`name`**
Type: `string`
Required: false
Default Value: `undefined`
Description: The name attribute of the rating element (used in forms).
**`readOnly`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Whether the rating is readonly.
**`required`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Whether the rating is required.
**`translations`**
Type: `IntlTranslations`
Required: false
Default Value: `undefined`
Description: Specifies the localized strings that identifies the accessibility elements and their states
#### Emits
**`hoverChange`**
Type: `[details: HoverChangeDetails]`
Description: Function to be called when the rating value is hovered.
**`update:modelValue`**
Type: `[value: number]`
Description: The callback fired when the model value changes.
**`valueChange`**
Type: `[details: ValueChangeDetails]`
Description: Function to be called when the rating value changes.
### Control
#### Props
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
#### Data Attributes
**`data-scope`**: rating-group
**`data-part`**: control
**`data-readonly`**: Present when read-only
**`data-disabled`**: Present when disabled
### HiddenInput
#### Props
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
### Item
#### Props
**`index`**
Type: `number`
Required: true
Default Value: `undefined`
Description: undefined
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
#### Data Attributes
**`data-scope`**: rating-group
**`data-part`**: item
**`data-disabled`**: Present when disabled
**`data-readonly`**: Present when read-only
**`data-checked`**: Present when checked
**`data-highlighted`**: Present when highlighted
**`data-half`**:
### Label
#### Props
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
#### Data Attributes
**`data-scope`**: rating-group
**`data-part`**: label
**`data-disabled`**: Present when disabled
### RootProvider
#### Props
**`value`**
Type: `RatingGroupApi`
Required: true
Default Value: `undefined`
Description: undefined
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
## Accessibility
### Keyboard Support
**`ArrowRight`**
Description: Moves focus to the next star, increasing the rating value based on the `allowHalf` property.
**`ArrowLeft`**
Description: Moves focus to the previous star, decreasing the rating value based on the `allowHalf` property.
**`Enter`**
Description: Selects the focused star in the rating group.
# Segment Group (REACT)
## Anatomy
To set up the segmented control correctly, you'll need to understand its anatomy and how we name its parts.
> Each part includes a `data-part` attribute to help identify them in the DOM.
## Examples
Learn how to use the `SegmentGroup` component in your project. Let's take a look at the most basic example:
```tsx
import { SegmentGroup } from '@ark-ui/react/segment-group'
export const Basic = () => {
const frameworks = ['React', 'Solid', 'Svelte', 'Vue']
return (
{frameworks.map((framework) => (
{framework}
))}
)
}
```
### Initial Value
To set a default segment on initial render, use the `defaultValue` prop:
```tsx
import { SegmentGroup } from '@ark-ui/react/segment-group'
export const InitialValue = () => {
const frameworks = ['React', 'Solid', 'Svelte', 'Vue']
return (
{frameworks.map((framework) => (
{framework}
))}
)
}
```
### Controlled Segment Group
To create a controlled SegmentGroup component, manage the current selected segment using the `value` prop and update it
when the `onValueChange` event handler is called:
```tsx
import { SegmentGroup } from '@ark-ui/react/segment-group'
import { useState } from 'react'
export const Controlled = () => {
const frameworks = ['React', 'Solid', 'Svelte', 'Vue']
const [value, setValue] = useState('React')
return (
setValue(e.value)}>
{frameworks.map((framework) => (
{framework}
))}
)
}
```
### Disabled Segment
To disable a segment, simply pass the `disabled` prop to the `SegmentGroup.Item` component:
```tsx
import { SegmentGroup } from '@ark-ui/react/segment-group'
export const Disabled = () => {
const frameworks = ['React', 'Solid', 'Svelte', 'Vue']
return (
{frameworks.map((framework) => (
{framework}
))}
)
}
```
### Using the Root Provider
The `RootProvider` component provides a context for the radio-group. It accepts the value of the `useRadio-group` hook.
You can leverage it to access the component state and methods from outside the radio-group.
```tsx
import { SegmentGroup, useSegmentGroup } from '@ark-ui/react/segment-group'
export const RootProvider = () => {
const frameworks = ['React', 'Solid', 'Svelte', 'Vue']
const segmentGroup = useSegmentGroup()
return (
<>
{frameworks.map((framework) => (
{framework}
))}
>
)
}
```
> If you're using the `RootProvider` component, you don't need to use the `Root` component.
## API Reference
### Root
#### Props
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
**`defaultValue`**
Type: `string`
Required: false
Default Value: `undefined`
Description: The initial value of the checked radio when rendered.
Use when you don't need to control the value of the radio group.
**`disabled`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: If `true`, the radio group will be disabled
**`form`**
Type: `string`
Required: false
Default Value: `undefined`
Description: The associate form of the underlying input.
**`id`**
Type: `string`
Required: false
Default Value: `undefined`
Description: The unique identifier of the machine.
**`ids`**
Type: `Partial<{
root: string
label: string
indicator: string
item(value: string): string
itemLabel(value: string): string
itemControl(value: string): string
itemHiddenInput(value: string): string
}>`
Required: false
Default Value: `undefined`
Description: The ids of the elements in the radio. Useful for composition.
**`name`**
Type: `string`
Required: false
Default Value: `undefined`
Description: The name of the input fields in the radio
(Useful for form submission).
**`onValueChange`**
Type: `(details: ValueChangeDetails) => void`
Required: false
Default Value: `undefined`
Description: Function called once a radio is checked
**`orientation`**
Type: `'horizontal' | 'vertical'`
Required: false
Default Value: `undefined`
Description: Orientation of the radio group
**`readOnly`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Whether the checkbox is read-only
**`value`**
Type: `string`
Required: false
Default Value: `undefined`
Description: The controlled value of the radio group
#### Data Attributes
**`data-scope`**: radio-group
**`data-part`**: root
**`data-orientation`**: The orientation of the radio-group
**`data-disabled`**: Present when disabled
### Indicator
#### Props
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
#### Data Attributes
**`data-scope`**: radio-group
**`data-part`**: indicator
**`data-disabled`**: Present when disabled
**`data-orientation`**: The orientation of the indicator
### ItemControl
#### Props
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
#### Data Attributes
**`data-scope`**: radio-group
**`data-part`**: item-control
**`data-active`**: Present when active or pressed
### ItemHiddenInput
#### Props
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
### Item
#### Props
**`value`**
Type: `string`
Required: true
Default Value: `undefined`
Description: undefined
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
**`disabled`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: undefined
**`invalid`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: undefined
### ItemText
#### Props
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
### Label
#### Props
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
#### Data Attributes
**`data-scope`**: radio-group
**`data-part`**: label
**`data-orientation`**: The orientation of the label
**`data-disabled`**: Present when disabled
### RootProvider
#### Props
**`value`**
Type: `UseRadioGroupReturn`
Required: true
Default Value: `undefined`
Description: undefined
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
## Accessibility
Complies with the [Radio WAI-ARIA design pattern](https://www.w3.org/WAI/ARIA/apg/patterns/radio/).
### Keyboard Support
**`Tab`**
Description: Moves focus to either the checked radio item or the first radio item in the group.
**`Space`**
Description: When focus is on an unchecked radio item, checks it.
**`ArrowDown`**
Description: Moves focus and checks the next radio item in the group.
**`ArrowRight`**
Description: Moves focus and checks the next radio item in the group.
**`ArrowUp`**
Description: Moves focus to the previous radio item in the group.
**`ArrowLeft`**
Description: Moves focus to the previous radio item in the group.
# Segment Group (SOLID)
## Anatomy
To set up the segmented control correctly, you'll need to understand its anatomy and how we name its parts.
> Each part includes a `data-part` attribute to help identify them in the DOM.
## Examples
Learn how to use the `SegmentGroup` component in your project. Let's take a look at the most basic example:
```tsx
import { SegmentGroup } from '@ark-ui/solid/segment-group'
import { Index } from 'solid-js'
export const Basic = () => {
const frameworks = ['React', 'Solid', 'Svelte', 'Vue']
return (
{(framework) => (
{framework()}
)}
)
}
```
### Initial Value
To set a default segment on initial render, use the `defaultValue` prop:
```tsx
import { SegmentGroup } from '@ark-ui/solid/segment-group'
import { Index } from 'solid-js'
export const InitialValue = () => {
const frameworks = ['React', 'Solid', 'Svelte', 'Vue']
return (
{(framework) => (
{framework()}
)}
)
}
```
### Controlled Segment Group
To create a controlled SegmentGroup component, manage the current selected segment using the `value` prop and update it
when the `onValueChange` event handler is called:
```tsx
import { SegmentGroup } from '@ark-ui/solid/segment-group'
import { Index, createSignal } from 'solid-js'
export const Controlled = () => {
const frameworks = ['React', 'Solid', 'Svelte', 'Vue']
const [value, setValue] = createSignal('React')
return (
setValue(e.value)}>
{(framework) => (
{framework()}
)}
)
}
```
### Disabled Segment
To disable a segment, simply pass the `disabled` prop to the `SegmentGroup.Item` component:
```tsx
import { SegmentGroup } from '@ark-ui/solid/segment-group'
import { Index } from 'solid-js'
export const Disabled = () => {
const frameworks = ['React', 'Solid', 'Svelte', 'Vue']
return (
{(framework) => (
{framework()}
)}
)
}
```
### Using the Root Provider
The `RootProvider` component provides a context for the radio-group. It accepts the value of the `useRadio-group` hook.
You can leverage it to access the component state and methods from outside the radio-group.
```tsx
import { SegmentGroup, useSegmentGroup } from '@ark-ui/solid/segment-group'
import { Index } from 'solid-js'
export const RootProvider = () => {
const frameworks = ['React', 'Solid', 'Svelte', 'Vue']
const segmentGroup = useSegmentGroup()
return (
<>
{(framework) => (
{framework()}
)}
>
)
}
```
> If you're using the `RootProvider` component, you don't need to use the `Root` component.
## API Reference
### Root
#### Props
**`asChild`**
Type: `(props: ParentProps<'div'>) => Element`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
**`defaultValue`**
Type: `string`
Required: false
Default Value: `undefined`
Description: The initial value of the checked radio when rendered.
Use when you don't need to control the value of the radio group.
**`disabled`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: If `true`, the radio group will be disabled
**`form`**
Type: `string`
Required: false
Default Value: `undefined`
Description: The associate form of the underlying input.
**`ids`**
Type: `Partial<{
root: string
label: string
indicator: string
item(value: string): string
itemLabel(value: string): string
itemControl(value: string): string
itemHiddenInput(value: string): string
}>`
Required: false
Default Value: `undefined`
Description: The ids of the elements in the radio. Useful for composition.
**`name`**
Type: `string`
Required: false
Default Value: `undefined`
Description: The name of the input fields in the radio
(Useful for form submission).
**`onValueChange`**
Type: `(details: ValueChangeDetails) => void`
Required: false
Default Value: `undefined`
Description: Function called once a radio is checked
**`orientation`**
Type: `'horizontal' | 'vertical'`
Required: false
Default Value: `undefined`
Description: Orientation of the radio group
**`readOnly`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Whether the checkbox is read-only
**`value`**
Type: `string`
Required: false
Default Value: `undefined`
Description: The controlled value of the radio group
#### Data Attributes
**`data-scope`**: radio-group
**`data-part`**: root
**`data-orientation`**: The orientation of the radio-group
**`data-disabled`**: Present when disabled
### Indicator
#### Props
**`asChild`**
Type: `(props: ParentProps<'div'>) => Element`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
#### Data Attributes
**`data-scope`**: radio-group
**`data-part`**: indicator
**`data-disabled`**: Present when disabled
**`data-orientation`**: The orientation of the indicator
### ItemControl
#### Props
**`asChild`**
Type: `(props: ParentProps<'div'>) => Element`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
#### Data Attributes
**`data-scope`**: radio-group
**`data-part`**: item-control
**`data-active`**: Present when active or pressed
### ItemHiddenInput
#### Props
**`asChild`**
Type: `(props: ParentProps<'input'>) => Element`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
### Item
#### Props
**`value`**
Type: `string`
Required: true
Default Value: `undefined`
Description: undefined
**`asChild`**
Type: `(props: ParentProps<'label'>) => Element`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
**`disabled`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: undefined
**`invalid`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: undefined
### ItemText
#### Props
**`asChild`**
Type: `(props: ParentProps<'span'>) => Element`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
### Label
#### Props
**`asChild`**
Type: `(props: ParentProps<'label'>) => Element`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
#### Data Attributes
**`data-scope`**: radio-group
**`data-part`**: label
**`data-orientation`**: The orientation of the label
**`data-disabled`**: Present when disabled
### RootProvider
#### Props
**`value`**
Type: `UseRadioGroupReturn`
Required: true
Default Value: `undefined`
Description: undefined
**`asChild`**
Type: `(props: ParentProps<'div'>) => Element`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
## Accessibility
Complies with the [Radio WAI-ARIA design pattern](https://www.w3.org/WAI/ARIA/apg/patterns/radio/).
### Keyboard Support
**`Tab`**
Description: Moves focus to either the checked radio item or the first radio item in the group.
**`Space`**
Description: When focus is on an unchecked radio item, checks it.
**`ArrowDown`**
Description: Moves focus and checks the next radio item in the group.
**`ArrowRight`**
Description: Moves focus and checks the next radio item in the group.
**`ArrowUp`**
Description: Moves focus to the previous radio item in the group.
**`ArrowLeft`**
Description: Moves focus to the previous radio item in the group.
# Segment Group (VUE)
## Anatomy
To set up the segmented control correctly, you'll need to understand its anatomy and how we name its parts.
> Each part includes a `data-part` attribute to help identify them in the DOM.
## Examples
Learn how to use the `SegmentGroup` component in your project. Let's take a look at the most basic example:
```vue
{{ framework }}
```
### Initial Value
To set a default segment on initial render, use the `defaultValue` prop:
```vue
{{ framework }}
```
### Controlled Segment Group
To create a controlled SegmentGroup component, manage the current selected segment using the `value` prop and update it
when the `onValueChange` event handler is called:
```vue
{{ framework }}
```
### Disabled Segment
To disable a segment, simply pass the `disabled` prop to the `SegmentGroup.Item` component:
```vue
{{ framework }}
```
### Using the Root Provider
The `RootProvider` component provides a context for the radio-group. It accepts the value of the `useRadio-group` hook.
You can leverage it to access the component state and methods from outside the radio-group.
```vue
{{ framework }}
```
> If you're using the `RootProvider` component, you don't need to use the `Root` component.
## API Reference
### Root
#### Props
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
**`defaultValue`**
Type: `string`
Required: false
Default Value: `undefined`
Description: The initial value of the checked radio when rendered.
Use when you don't need to control the value of the radio group.
**`disabled`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: If `true`, the radio group will be disabled
**`form`**
Type: `string`
Required: false
Default Value: `undefined`
Description: The associate form of the underlying input.
**`id`**
Type: `string`
Required: false
Default Value: `undefined`
Description: The unique identifier of the machine.
**`ids`**
Type: `Partial<{
root: string
label: string
indicator: string
item(value: string): string
itemLabel(value: string): string
itemControl(value: string): string
itemHiddenInput(value: string): string
}>`
Required: false
Default Value: `undefined`
Description: The ids of the elements in the radio. Useful for composition.
**`modelValue`**
Type: `string`
Required: false
Default Value: `undefined`
Description: The v-model value of the radio group
**`name`**
Type: `string`
Required: false
Default Value: `undefined`
Description: The name of the input fields in the radio
(Useful for form submission).
**`orientation`**
Type: `'horizontal' | 'vertical'`
Required: false
Default Value: `undefined`
Description: Orientation of the radio group
**`readOnly`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Whether the checkbox is read-only
#### Emits
**`update:modelValue`**
Type: `[value: string | null]`
Description: The callback fired when the model value changes.
**`valueChange`**
Type: `[details: ValueChangeDetails]`
Description: Function called once a radio is checked
#### Data Attributes
**`data-scope`**: radio-group
**`data-part`**: root
**`data-orientation`**: The orientation of the radio-group
**`data-disabled`**: Present when disabled
### Indicator
#### Props
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
#### Data Attributes
**`data-scope`**: radio-group
**`data-part`**: indicator
**`data-disabled`**: Present when disabled
**`data-orientation`**: The orientation of the indicator
### ItemControl
#### Props
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
#### Data Attributes
**`data-scope`**: radio-group
**`data-part`**: item-control
**`data-active`**: Present when active or pressed
### ItemHiddenInput
#### Props
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
### Item
#### Props
**`value`**
Type: `string`
Required: true
Default Value: `undefined`
Description: undefined
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
**`disabled`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: undefined
**`invalid`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: undefined
### ItemText
#### Props
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
### Label
#### Props
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
#### Data Attributes
**`data-scope`**: radio-group
**`data-part`**: label
**`data-orientation`**: The orientation of the label
**`data-disabled`**: Present when disabled
### RootProvider
#### Props
**`value`**
Type: `RadioGroupApi`
Required: true
Default Value: `undefined`
Description: undefined
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
## Accessibility
Complies with the [Radio WAI-ARIA design pattern](https://www.w3.org/WAI/ARIA/apg/patterns/radio/).
### Keyboard Support
**`Tab`**
Description: Moves focus to either the checked radio item or the first radio item in the group.
**`Space`**
Description: When focus is on an unchecked radio item, checks it.
**`ArrowDown`**
Description: Moves focus and checks the next radio item in the group.
**`ArrowRight`**
Description: Moves focus and checks the next radio item in the group.
**`ArrowUp`**
Description: Moves focus to the previous radio item in the group.
**`ArrowLeft`**
Description: Moves focus to the previous radio item in the group.
# Select (REACT)
## Anatomy
To set up the select correctly, you'll need to understand its anatomy and how we name its parts.
> Each part includes a `data-part` attribute to help identify them in the DOM.
## Examples
Learn how to use the `Select` component in your project. Let's take a look at the most basic example:
```tsx
import { Portal } from '@ark-ui/react/portal'
import { Select, createListCollection } from '@ark-ui/react/select'
import { ChevronDownIcon } from 'lucide-react'
export const Basic = () => {
const collection = createListCollection({ items: ['React', 'Solid', 'Vue'] })
return (
FrameworkClearFrameworks
{collection.items.map((item) => (
{item}✓
))}
)
}
```
### Advanced Customization
For advanced customizations and item properties like `disabled`:
```tsx
import { Portal } from '@ark-ui/react/portal'
import { Select, createListCollection } from '@ark-ui/react/select'
import { ChevronDownIcon } from 'lucide-react'
export const Advanced = () => {
const collection = createListCollection({
items: [
{ label: 'React', value: 'react' },
{ label: 'Solid', value: 'solid' },
{ label: 'Vue', value: 'vue' },
{ label: 'Svelte', value: 'svelte', disabled: true },
],
})
return (
FrameworkClearFrameworks
{collection.items.map((item) => (
{item.label}✓
))}
)
}
```
### Multiple Selection
To enable `multiple` item selection:
```tsx
import { Portal } from '@ark-ui/react/portal'
import { Select, createListCollection } from '@ark-ui/react/select'
import { ChevronDownIcon } from 'lucide-react'
export const Multiple = () => {
const collection = createListCollection({
items: [
{ label: 'React', value: 'react' },
{ label: 'Solid', value: 'solid' },
{ label: 'Vue', value: 'vue' },
{ label: 'Svelte', value: 'svelte', disabled: true },
],
})
return (
FrameworkClearFrameworks
{collection.items.map((item) => (
{item.label}✓
))}
)
}
```
### Controlled Component
For scenarios where you want to control the Select component's state:
```tsx
import { Portal } from '@ark-ui/react/portal'
import { Select, createListCollection } from '@ark-ui/react/select'
import { ChevronDownIcon } from 'lucide-react'
import { useState } from 'react'
interface Item {
label: string
value: string
disabled?: boolean
}
export const Controlled = () => {
const [_, setSelectedItems] = useState([])
const collection = createListCollection({
items: [
{ label: 'React', value: 'react' },
{ label: 'Solid', value: 'solid' },
{ label: 'Vue', value: 'vue' },
{ label: 'Svelte', value: 'svelte', disabled: true },
],
})
return (
setSelectedItems(e.items)}>
FrameworkClearFrameworks
{collection.items.map((item) => (
{item.label}✓
))}
)
}
```
### Usage with a Form Library
See how to use the Select component with popular form libraries:
```tsx
import { Select, createListCollection } from '@ark-ui/react/select'
import { ChevronDownIcon } from 'lucide-react'
import { type SubmitHandler, useForm } from 'react-hook-form'
interface Inputs {
framework: string
}
export const FormLibrary = () => {
const collection = createListCollection({ items: ['React', 'Solid', 'Vue'] })
const { register, handleSubmit } = useForm()
const onSubmit: SubmitHandler = (data) => window.alert(JSON.stringify(data))
return (
)
}
```
### Using the Field Component
The `Field` component helps manage form-related state and accessibility attributes of a select. It includes handling
ARIA labels, helper text, and error text to ensure proper accessibility.
```tsx
import { Field } from '@ark-ui/react/field'
import { Select, createListCollection } from '@ark-ui/react/select'
import { ChevronDownIcon } from 'lucide-react'
export const WithField = (props: Field.RootProps) => {
const collection = createListCollection({ items: ['React', 'Solid', 'Vue'] })
return (
Label
{collection.items.map((item) => (
{item}✓
))}
Additional InfoError Info
)
}
```
### Using the Root Provider
The `RootProvider` component provides a context for the select. It accepts the value of the `useSelect` hook. You can
leverage it to access the component state and methods from outside the select.
```tsx
import { Portal } from '@ark-ui/react/portal'
import { Select, createListCollection, useSelect } from '@ark-ui/react/select'
import { ChevronDownIcon } from 'lucide-react'
export const RootProvider = () => {
const collection = createListCollection({ items: ['React', 'Solid', 'Vue'] })
const select = useSelect({ collection: collection })
return (
<>
FrameworkClearFrameworks
{collection.items.map((item) => (
{item}✓
))}
>
)
}
```
> If you're using the `RootProvider` component, you don't need to use the `Root` component.
## API Reference
### Root
#### Props
**`collection`**
Type: `ListCollection`
Required: true
Default Value: `undefined`
Description: The collection of items
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
**`closeOnSelect`**
Type: `boolean`
Required: false
Default Value: `true`
Description: Whether the select should close after an item is selected
**`composite`**
Type: `boolean`
Required: false
Default Value: `true`
Description: Whether the select is a composed with other composite widgets like tabs or combobox
**`defaultHighlightedValue`**
Type: `string`
Required: false
Default Value: `undefined`
Description: The initial value of the highlighted item when opened.
Use when you don't need to control the highlighted value of the select.
**`defaultOpen`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Whether the select's open state is controlled by the user
**`defaultValue`**
Type: `string[]`
Required: false
Default Value: `undefined`
Description: The initial default value of the select when rendered.
Use when you don't need to control the value of the select.
**`deselectable`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Whether the value can be cleared by clicking the selected item.
**Note:** this is only applicable for single selection
**`disabled`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Whether the select is disabled
**`form`**
Type: `string`
Required: false
Default Value: `undefined`
Description: The associate form of the underlying select.
**`highlightedValue`**
Type: `string`
Required: false
Default Value: `undefined`
Description: The controlled key of the highlighted item
**`id`**
Type: `string`
Required: false
Default Value: `undefined`
Description: The unique identifier of the machine.
**`ids`**
Type: `Partial<{
root: string
content: string
control: string
trigger: string
clearTrigger: string
label: string
hiddenSelect: string
positioner: string
item(id: string | number): string
itemGroup(id: string | number): string
itemGroupLabel(id: string | number): string
}>`
Required: false
Default Value: `undefined`
Description: The ids of the elements in the select. Useful for composition.
**`immediate`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Whether to synchronize the present change immediately or defer it to the next frame
**`invalid`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Whether the select is invalid
**`lazyMount`**
Type: `boolean`
Required: false
Default Value: `false`
Description: Whether to enable lazy mounting
**`loopFocus`**
Type: `boolean`
Required: false
Default Value: `false`
Description: Whether to loop the keyboard navigation through the options
**`multiple`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Whether to allow multiple selection
**`name`**
Type: `string`
Required: false
Default Value: `undefined`
Description: The `name` attribute of the underlying select.
**`onExitComplete`**
Type: `VoidFunction`
Required: false
Default Value: `undefined`
Description: Function called when the animation ends in the closed state
**`onFocusOutside`**
Type: `(event: FocusOutsideEvent) => void`
Required: false
Default Value: `undefined`
Description: Function called when the focus is moved outside the component
**`onHighlightChange`**
Type: `(details: HighlightChangeDetails) => void`
Required: false
Default Value: `undefined`
Description: The callback fired when the highlighted item changes.
**`onInteractOutside`**
Type: `(event: InteractOutsideEvent) => void`
Required: false
Default Value: `undefined`
Description: Function called when an interaction happens outside the component
**`onOpenChange`**
Type: `(details: OpenChangeDetails) => void`
Required: false
Default Value: `undefined`
Description: Function called when the popup is opened
**`onPointerDownOutside`**
Type: `(event: PointerDownOutsideEvent) => void`
Required: false
Default Value: `undefined`
Description: Function called when the pointer is pressed down outside the component
**`onValueChange`**
Type: `(details: ValueChangeDetails) => void`
Required: false
Default Value: `undefined`
Description: The callback fired when the selected item changes.
**`open`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Whether the select menu is open
**`positioning`**
Type: `PositioningOptions`
Required: false
Default Value: `undefined`
Description: The positioning options of the menu.
**`present`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Whether the node is present (controlled by the user)
**`readOnly`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Whether the select is read-only
**`required`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Whether the select is required
**`scrollToIndexFn`**
Type: `(details: ScrollToIndexDetails) => void`
Required: false
Default Value: `undefined`
Description: Function to scroll to a specific index
**`unmountOnExit`**
Type: `boolean`
Required: false
Default Value: `false`
Description: Whether to unmount on exit.
**`value`**
Type: `string[]`
Required: false
Default Value: `undefined`
Description: The controlled keys of the selected items
#### Data Attributes
**`data-scope`**: select
**`data-part`**: root
**`data-invalid`**: Present when invalid
**`data-readonly`**: Present when read-only
### ClearTrigger
#### Props
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
#### Data Attributes
**`data-scope`**: select
**`data-part`**: clear-trigger
**`data-invalid`**: Present when invalid
### Content
#### Props
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
#### Data Attributes
**`data-scope`**: select
**`data-part`**: content
**`data-state`**: "open" | "closed"
**`data-placement`**: The placement of the content
**`data-activedescendant`**:
### Control
#### Props
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
#### Data Attributes
**`data-scope`**: select
**`data-part`**: control
**`data-state`**: "open" | "closed"
**`data-focus`**: Present when focused
**`data-disabled`**: Present when disabled
**`data-invalid`**: Present when invalid
### HiddenSelect
#### Props
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
### Indicator
#### Props
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
#### Data Attributes
**`data-scope`**: select
**`data-part`**: indicator
**`data-state`**: "open" | "closed"
**`data-disabled`**: Present when disabled
**`data-invalid`**: Present when invalid
**`data-readonly`**: Present when read-only
### ItemGroupLabel
#### Props
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
### ItemGroup
#### Props
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
#### Data Attributes
**`data-scope`**: select
**`data-part`**: item-group
**`data-disabled`**: Present when disabled
### ItemIndicator
#### Props
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
#### Data Attributes
**`data-scope`**: select
**`data-part`**: item-indicator
**`data-state`**: "checked" | "unchecked"
### Item
#### Props
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
**`item`**
Type: `any`
Required: false
Default Value: `undefined`
Description: The item to render
**`persistFocus`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Whether hovering outside should clear the highlighted state
#### Data Attributes
**`data-scope`**: select
**`data-part`**: item
**`data-value`**: The value of the item
**`data-state`**: "checked" | "unchecked"
**`data-highlighted`**: Present when highlighted
**`data-disabled`**: Present when disabled
### ItemText
#### Props
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
#### Data Attributes
**`data-scope`**: select
**`data-part`**: item-text
**`data-state`**: "checked" | "unchecked"
**`data-disabled`**: Present when disabled
**`data-highlighted`**: Present when highlighted
### Label
#### Props
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
#### Data Attributes
**`data-scope`**: select
**`data-part`**: label
**`data-disabled`**: Present when disabled
**`data-invalid`**: Present when invalid
**`data-readonly`**: Present when read-only
### List
#### Props
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
### Positioner
#### Props
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
### RootProvider
#### Props
**`value`**
Type: `UseSelectReturn`
Required: true
Default Value: `undefined`
Description: undefined
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
**`immediate`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Whether to synchronize the present change immediately or defer it to the next frame
**`lazyMount`**
Type: `boolean`
Required: false
Default Value: `false`
Description: Whether to enable lazy mounting
**`onExitComplete`**
Type: `VoidFunction`
Required: false
Default Value: `undefined`
Description: Function called when the animation ends in the closed state
**`present`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Whether the node is present (controlled by the user)
**`unmountOnExit`**
Type: `boolean`
Required: false
Default Value: `false`
Description: Whether to unmount on exit.
### Trigger
#### Props
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
#### Data Attributes
**`data-scope`**: select
**`data-part`**: trigger
**`data-state`**: "open" | "closed"
**`data-disabled`**: Present when disabled
**`data-invalid`**: Present when invalid
**`data-readonly`**: Present when read-only
**`data-placement`**: The placement of the trigger
**`data-placeholder-shown`**: Present when placeholder is shown
### ValueText
#### Props
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
**`placeholder`**
Type: `string`
Required: false
Default Value: `undefined`
Description: Text to display when no value is selected.
#### Data Attributes
**`data-scope`**: select
**`data-part`**: value-text
**`data-disabled`**: Present when disabled
**`data-invalid`**: Present when invalid
**`data-focus`**: Present when focused
## Accessibility
Complies with the [Listbox WAI-ARIA design pattern](https://www.w3.org/WAI/ARIA/apg/patterns/listbox/).
### Keyboard Support
**`Space`**
Description: When focus is on trigger, opens the select and focuses the first selected item. When focus is on the content, selects the highlighted item.
**`Enter`**
Description: When focus is on trigger, opens the select and focuses the first selected item. When focus is on content, selects the focused item.
**`ArrowDown`**
Description: When focus is on trigger, opens the select. When focus is on content, moves focus to the next item.
**`ArrowUp`**
Description: When focus is on trigger, opens the select. When focus is on content, moves focus to the previous item.
**`Esc`**
Description: Closes the select and moves focus to trigger.
**`A-Z + a-z`**
Description: When focus is on trigger, selects the item whose label starts with the typed character. When focus is on the listbox, moves focus to the next item with a label that starts with the typed character.
# Select (SOLID)
## Anatomy
To set up the select correctly, you'll need to understand its anatomy and how we name its parts.
> Each part includes a `data-part` attribute to help identify them in the DOM.
## Examples
Learn how to use the `Select` component in your project. Let's take a look at the most basic example:
```tsx
import { Select, createListCollection } from '@ark-ui/solid/select'
import { Index, Portal } from 'solid-js/web'
export const Basic = () => {
const collection = createListCollection({ items: ['React', 'Solid', 'Vue'] })
return (
Framework▼ClearFrameworks
{(item) => (
{item()}✓
)}
)
}
```
### Advanced Customization
For advanced customizations and item properties like `disabled`:
```tsx
import { Select, createListCollection } from '@ark-ui/solid/select'
import { Index, Portal } from 'solid-js/web'
export const Advanced = () => {
const collection = createListCollection({
items: [
{ label: 'React', value: 'react' },
{ label: 'Solid', value: 'solid' },
{ label: 'Vue', value: 'vue' },
{ label: 'Svelte', value: 'svelte', disabled: true },
],
})
return (
FrameworkClearFrameworks
{(item) => (
{item().label}✓
)}
)
}
```
### Multiple Selection
To enable `multiple` item selection:
```tsx
import { Select, createListCollection } from '@ark-ui/solid/select'
import { Index, Portal } from 'solid-js/web'
export const Multiple = () => {
const collection = createListCollection({
items: [
{ label: 'React', value: 'react' },
{ label: 'Solid', value: 'solid' },
{ label: 'Vue', value: 'vue' },
{ label: 'Svelte', value: 'svelte', disabled: true },
],
})
return (
FrameworkClear
{(item) => (
{item().label}✓
)}
)
}
```
### Controlled Component
For scenarios where you want to control the Select component's state:
```tsx
import { Select, createListCollection } from '@ark-ui/solid/select'
import { createSignal } from 'solid-js'
import { Index, Portal } from 'solid-js/web'
interface Item {
label: string
value: string
disabled?: boolean
}
export const Controlled = () => {
const [, setSelectedItems] = createSignal([])
const collection = createListCollection({
items: [
{ label: 'React', value: 'react' },
{ label: 'Solid', value: 'solid' },
{ label: 'Vue', value: 'vue' },
{ label: 'Svelte', value: 'svelte', disabled: true },
],
})
return (
setSelectedItems(e.items)}>
FrameworkClearFrameworks
{(item) => (
{item().label}✓
)}
)
}
```
### Usage with a Form Library
See how to use the Select component with popular form libraries:
```tsx
import { Select, createListCollection } from '@ark-ui/solid'
import { createForm, getValue, setValue } from '@modular-forms/solid'
import { createMemo } from 'solid-js'
import { Index, Portal } from 'solid-js/web'
export const WithFormLibrary = () => {
const frameworks = createListCollection({
items: [
{ label: 'React', value: 'react' },
{ label: 'Solid', value: 'solid' },
{ label: 'Vue', value: 'vue' },
],
})
const [formStore, { Form, Field }] = createForm({
initialValues: { value: 'solid' },
})
const value = createMemo(() => getValue(formStore, 'value'))
return (
<>
Value is {value()}
>
)
}
```
### Using the Field Component
The `Field` component helps manage form-related state and accessibility attributes of a select. It includes handling
ARIA labels, helper text, and error text to ensure proper accessibility.
```tsx
import { Field } from '@ark-ui/solid/field'
import { Select, createListCollection } from '@ark-ui/solid/select'
import { ChevronDownIcon } from 'lucide-solid'
import { Index } from 'solid-js/web'
export const WithField = (props: Field.RootProps) => {
const collection = createListCollection({ items: ['React', 'Solid', 'Vue'] })
return (
LabelFrameworks
{(item) => (
{item()}✓
)}
Additional InfoError Info
)
}
```
### Using the Root Provider
The `RootProvider` component provides a context for the select. It accepts the value of the `useSelect` hook. You can
leverage it to access the component state and methods from outside the select.
```tsx
import { Select, createListCollection, useSelect } from '@ark-ui/solid/select'
import { Index, Portal } from 'solid-js/web'
export const RootProvider = () => {
const collection = createListCollection({ items: ['React', 'Solid', 'Vue'] })
const select = useSelect({ collection: collection })
return (
<>
Framework▼ClearFrameworks
{(item) => (
{item()}✓
)}
>
)
}
```
> If you're using the `RootProvider` component, you don't need to use the `Root` component.
## API Reference
### Root
#### Props
**`collection`**
Type: `ListCollection`
Required: true
Default Value: `undefined`
Description: The collection of items
**`asChild`**
Type: `(props: ParentProps<'div'>) => Element`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
**`closeOnSelect`**
Type: `boolean`
Required: false
Default Value: `true`
Description: Whether the select should close after an item is selected
**`composite`**
Type: `boolean`
Required: false
Default Value: `true`
Description: Whether the select is a composed with other composite widgets like tabs or combobox
**`defaultHighlightedValue`**
Type: `string`
Required: false
Default Value: `undefined`
Description: The initial value of the highlighted item when opened.
Use when you don't need to control the highlighted value of the select.
**`defaultOpen`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Whether the select's open state is controlled by the user
**`defaultValue`**
Type: `string[]`
Required: false
Default Value: `undefined`
Description: The initial default value of the select when rendered.
Use when you don't need to control the value of the select.
**`deselectable`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Whether the value can be cleared by clicking the selected item.
**Note:** this is only applicable for single selection
**`disabled`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Whether the select is disabled
**`form`**
Type: `string`
Required: false
Default Value: `undefined`
Description: The associate form of the underlying select.
**`highlightedValue`**
Type: `string`
Required: false
Default Value: `undefined`
Description: The controlled key of the highlighted item
**`ids`**
Type: `Partial<{
root: string
content: string
control: string
trigger: string
clearTrigger: string
label: string
hiddenSelect: string
positioner: string
item(id: string | number): string
itemGroup(id: string | number): string
itemGroupLabel(id: string | number): string
}>`
Required: false
Default Value: `undefined`
Description: The ids of the elements in the select. Useful for composition.
**`immediate`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Whether to synchronize the present change immediately or defer it to the next frame
**`invalid`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Whether the select is invalid
**`lazyMount`**
Type: `boolean`
Required: false
Default Value: `false`
Description: Whether to enable lazy mounting
**`loopFocus`**
Type: `boolean`
Required: false
Default Value: `false`
Description: Whether to loop the keyboard navigation through the options
**`multiple`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Whether to allow multiple selection
**`name`**
Type: `string`
Required: false
Default Value: `undefined`
Description: The `name` attribute of the underlying select.
**`onExitComplete`**
Type: `VoidFunction`
Required: false
Default Value: `undefined`
Description: Function called when the animation ends in the closed state
**`onFocusOutside`**
Type: `(event: FocusOutsideEvent) => void`
Required: false
Default Value: `undefined`
Description: Function called when the focus is moved outside the component
**`onHighlightChange`**
Type: `(details: HighlightChangeDetails) => void`
Required: false
Default Value: `undefined`
Description: The callback fired when the highlighted item changes.
**`onInteractOutside`**
Type: `(event: InteractOutsideEvent) => void`
Required: false
Default Value: `undefined`
Description: Function called when an interaction happens outside the component
**`onOpenChange`**
Type: `(details: OpenChangeDetails) => void`
Required: false
Default Value: `undefined`
Description: Function called when the popup is opened
**`onPointerDownOutside`**
Type: `(event: PointerDownOutsideEvent) => void`
Required: false
Default Value: `undefined`
Description: Function called when the pointer is pressed down outside the component
**`onValueChange`**
Type: `(details: ValueChangeDetails) => void`
Required: false
Default Value: `undefined`
Description: The callback fired when the selected item changes.
**`open`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Whether the select menu is open
**`positioning`**
Type: `PositioningOptions`
Required: false
Default Value: `undefined`
Description: The positioning options of the menu.
**`present`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Whether the node is present (controlled by the user)
**`readOnly`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Whether the select is read-only
**`required`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Whether the select is required
**`scrollToIndexFn`**
Type: `(details: ScrollToIndexDetails) => void`
Required: false
Default Value: `undefined`
Description: Function to scroll to a specific index
**`unmountOnExit`**
Type: `boolean`
Required: false
Default Value: `false`
Description: Whether to unmount on exit.
**`value`**
Type: `string[]`
Required: false
Default Value: `undefined`
Description: The controlled keys of the selected items
#### Data Attributes
**`data-scope`**: select
**`data-part`**: root
**`data-invalid`**: Present when invalid
**`data-readonly`**: Present when read-only
### ClearTrigger
#### Props
**`asChild`**
Type: `(props: ParentProps<'button'>) => Element`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
#### Data Attributes
**`data-scope`**: select
**`data-part`**: clear-trigger
**`data-invalid`**: Present when invalid
### Content
#### Props
**`asChild`**
Type: `(props: ParentProps<'div'>) => Element`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
#### Data Attributes
**`data-scope`**: select
**`data-part`**: content
**`data-state`**: "open" | "closed"
**`data-placement`**: The placement of the content
**`data-activedescendant`**:
### Control
#### Props
**`asChild`**
Type: `(props: ParentProps<'div'>) => Element`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
#### Data Attributes
**`data-scope`**: select
**`data-part`**: control
**`data-state`**: "open" | "closed"
**`data-focus`**: Present when focused
**`data-disabled`**: Present when disabled
**`data-invalid`**: Present when invalid
### HiddenSelect
#### Props
**`asChild`**
Type: `(props: ParentProps<'select'>) => Element`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
### Indicator
#### Props
**`asChild`**
Type: `(props: ParentProps<'div'>) => Element`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
#### Data Attributes
**`data-scope`**: select
**`data-part`**: indicator
**`data-state`**: "open" | "closed"
**`data-disabled`**: Present when disabled
**`data-invalid`**: Present when invalid
**`data-readonly`**: Present when read-only
### ItemGroupLabel
#### Props
**`asChild`**
Type: `(props: ParentProps<'div'>) => Element`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
### ItemGroup
#### Props
**`asChild`**
Type: `(props: ParentProps<'div'>) => Element`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
#### Data Attributes
**`data-scope`**: select
**`data-part`**: item-group
**`data-disabled`**: Present when disabled
### ItemIndicator
#### Props
**`asChild`**
Type: `(props: ParentProps<'div'>) => Element`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
#### Data Attributes
**`data-scope`**: select
**`data-part`**: item-indicator
**`data-state`**: "checked" | "unchecked"
### Item
#### Props
**`asChild`**
Type: `(props: ParentProps<'div'>) => Element`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
**`item`**
Type: `any`
Required: false
Default Value: `undefined`
Description: The item to render
**`persistFocus`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Whether hovering outside should clear the highlighted state
#### Data Attributes
**`data-scope`**: select
**`data-part`**: item
**`data-value`**: The value of the item
**`data-state`**: "checked" | "unchecked"
**`data-highlighted`**: Present when highlighted
**`data-disabled`**: Present when disabled
### ItemText
#### Props
**`asChild`**
Type: `(props: ParentProps<'span'>) => Element`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
#### Data Attributes
**`data-scope`**: select
**`data-part`**: item-text
**`data-state`**: "checked" | "unchecked"
**`data-disabled`**: Present when disabled
**`data-highlighted`**: Present when highlighted
### Label
#### Props
**`asChild`**
Type: `(props: ParentProps<'label'>) => Element`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
#### Data Attributes
**`data-scope`**: select
**`data-part`**: label
**`data-disabled`**: Present when disabled
**`data-invalid`**: Present when invalid
**`data-readonly`**: Present when read-only
### List
#### Props
**`asChild`**
Type: `(props: ParentProps<'div'>) => Element`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
### Positioner
#### Props
**`asChild`**
Type: `(props: ParentProps<'div'>) => Element`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
### RootProvider
#### Props
**`value`**
Type: `UseSelectReturn`
Required: true
Default Value: `undefined`
Description: undefined
**`asChild`**
Type: `(props: ParentProps<'div'>) => Element`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
**`immediate`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Whether to synchronize the present change immediately or defer it to the next frame
**`lazyMount`**
Type: `boolean`
Required: false
Default Value: `false`
Description: Whether to enable lazy mounting
**`onExitComplete`**
Type: `VoidFunction`
Required: false
Default Value: `undefined`
Description: Function called when the animation ends in the closed state
**`present`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Whether the node is present (controlled by the user)
**`unmountOnExit`**
Type: `boolean`
Required: false
Default Value: `false`
Description: Whether to unmount on exit.
### Trigger
#### Props
**`asChild`**
Type: `(props: ParentProps<'button'>) => Element`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
#### Data Attributes
**`data-scope`**: select
**`data-part`**: trigger
**`data-state`**: "open" | "closed"
**`data-disabled`**: Present when disabled
**`data-invalid`**: Present when invalid
**`data-readonly`**: Present when read-only
**`data-placement`**: The placement of the trigger
**`data-placeholder-shown`**: Present when placeholder is shown
### ValueText
#### Props
**`asChild`**
Type: `(props: ParentProps<'span'>) => Element`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
**`placeholder`**
Type: `string`
Required: false
Default Value: `undefined`
Description: Text to display when no value is selected.
#### Data Attributes
**`data-scope`**: select
**`data-part`**: value-text
**`data-disabled`**: Present when disabled
**`data-invalid`**: Present when invalid
**`data-focus`**: Present when focused
## Accessibility
Complies with the [Listbox WAI-ARIA design pattern](https://www.w3.org/WAI/ARIA/apg/patterns/listbox/).
### Keyboard Support
**`Space`**
Description: When focus is on trigger, opens the select and focuses the first selected item. When focus is on the content, selects the highlighted item.
**`Enter`**
Description: When focus is on trigger, opens the select and focuses the first selected item. When focus is on content, selects the focused item.
**`ArrowDown`**
Description: When focus is on trigger, opens the select. When focus is on content, moves focus to the next item.
**`ArrowUp`**
Description: When focus is on trigger, opens the select. When focus is on content, moves focus to the previous item.
**`Esc`**
Description: Closes the select and moves focus to trigger.
**`A-Z + a-z`**
Description: When focus is on trigger, selects the item whose label starts with the typed character. When focus is on the listbox, moves focus to the next item with a label that starts with the typed character.
# Select (VUE)
## Anatomy
To set up the select correctly, you'll need to understand its anatomy and how we name its parts.
> Each part includes a `data-part` attribute to help identify them in the DOM.
## Examples
Learn how to use the `Select` component in your project. Let's take a look at the most basic example:
```vue
FrameworkClearFrameworks{{ item }}✓
```
### Advanced Customization
For advanced customizations and item properties like `disabled`:
```vue
FrameworkClearFrameworks{{ item.label }}✓
```
### Multiple Selection
To enable `multiple` item selection:
```vue
FrameworkClearFrameworks{{ item.label }}✓
```
### Controlled Component
For scenarios where you want to control the Select component's state:
```vue
FrameworkClearFrameworks{{ item.label }}✓
```
### Usage with a Form Library
See how to use the Select component with popular form libraries:
```vue
Example not found```
### Using the Field Component
The `Field` component helps manage form-related state and accessibility attributes of a select. It includes handling
ARIA labels, helper text, and error text to ensure proper accessibility.
```vue
LabelClearFrameworks{{ item }}✓Additional InfoError Info
```
### Using the Root Provider
The `RootProvider` component provides a context for the select. It accepts the value of the `useSelect` hook. You can
leverage it to access the component state and methods from outside the select.
```vue
FrameworkClearFrameworks{{ item }}✓
```
> If you're using the `RootProvider` component, you don't need to use the `Root` component.
## API Reference
### Root
#### Props
**`collection`**
Type: `ListCollection`
Required: true
Default Value: `undefined`
Description: The collection of items
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
**`closeOnSelect`**
Type: `boolean`
Required: false
Default Value: `true`
Description: Whether the select should close after an item is selected
**`composite`**
Type: `boolean`
Required: false
Default Value: `true`
Description: Whether the select is a composed with other composite widgets like tabs or combobox
**`defaultHighlightedValue`**
Type: `string`
Required: false
Default Value: `undefined`
Description: The initial value of the highlighted item when opened.
Use when you don't need to control the highlighted value of the select.
**`defaultOpen`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Whether the select's open state is controlled by the user
**`defaultValue`**
Type: `string[]`
Required: false
Default Value: `undefined`
Description: The initial default value of the select when rendered.
Use when you don't need to control the value of the select.
**`deselectable`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Whether the value can be cleared by clicking the selected item.
**Note:** this is only applicable for single selection
**`disabled`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Whether the select is disabled
**`form`**
Type: `string`
Required: false
Default Value: `undefined`
Description: The associate form of the underlying select.
**`highlightedValue`**
Type: `string`
Required: false
Default Value: `undefined`
Description: The controlled key of the highlighted item
**`id`**
Type: `string`
Required: false
Default Value: `undefined`
Description: The unique identifier of the machine.
**`ids`**
Type: `Partial<{
root: string
content: string
control: string
trigger: string
clearTrigger: string
label: string
hiddenSelect: string
positioner: string
item(id: string | number): string
itemGroup(id: string | number): string
itemGroupLabel(id: string | number): string
}>`
Required: false
Default Value: `undefined`
Description: The ids of the elements in the select. Useful for composition.
**`invalid`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Whether the select is invalid
**`lazyMount`**
Type: `boolean`
Required: false
Default Value: `false`
Description: Whether to enable lazy mounting
**`loopFocus`**
Type: `boolean`
Required: false
Default Value: `false`
Description: Whether to loop the keyboard navigation through the options
**`modelValue`**
Type: `string[]`
Required: false
Default Value: `undefined`
Description: The model value of the select
**`multiple`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Whether to allow multiple selection
**`name`**
Type: `string`
Required: false
Default Value: `undefined`
Description: The `name` attribute of the underlying select.
**`open`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Whether the select menu is open
**`positioning`**
Type: `PositioningOptions`
Required: false
Default Value: `undefined`
Description: The positioning options of the menu.
**`readOnly`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Whether the select is read-only
**`required`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Whether the select is required
**`scrollToIndexFn`**
Type: `(details: ScrollToIndexDetails) => void`
Required: false
Default Value: `undefined`
Description: Function to scroll to a specific index
**`unmountOnExit`**
Type: `boolean`
Required: false
Default Value: `false`
Description: Whether to unmount on exit.
#### Data Attributes
**`data-scope`**: select
**`data-part`**: root
**`data-invalid`**: Present when invalid
**`data-readonly`**: Present when read-only
### ClearTrigger
#### Props
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
#### Data Attributes
**`data-scope`**: select
**`data-part`**: clear-trigger
**`data-invalid`**: Present when invalid
### Content
#### Props
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
#### Data Attributes
**`data-scope`**: select
**`data-part`**: content
**`data-state`**: "open" | "closed"
**`data-placement`**: The placement of the content
**`data-activedescendant`**:
### Control
#### Props
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
#### Data Attributes
**`data-scope`**: select
**`data-part`**: control
**`data-state`**: "open" | "closed"
**`data-focus`**: Present when focused
**`data-disabled`**: Present when disabled
**`data-invalid`**: Present when invalid
### HiddenSelect
#### Props
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
### Indicator
#### Props
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
#### Data Attributes
**`data-scope`**: select
**`data-part`**: indicator
**`data-state`**: "open" | "closed"
**`data-disabled`**: Present when disabled
**`data-invalid`**: Present when invalid
**`data-readonly`**: Present when read-only
### ItemGroupLabel
#### Props
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
### ItemGroup
#### Props
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
**`id`**
Type: `string`
Required: false
Default Value: `undefined`
Description: undefined
#### Data Attributes
**`data-scope`**: select
**`data-part`**: item-group
**`data-disabled`**: Present when disabled
### ItemIndicator
#### Props
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
#### Data Attributes
**`data-scope`**: select
**`data-part`**: item-indicator
**`data-state`**: "checked" | "unchecked"
### Item
#### Props
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
**`item`**
Type: `any`
Required: false
Default Value: `undefined`
Description: The item to render
**`persistFocus`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Whether hovering outside should clear the highlighted state
#### Data Attributes
**`data-scope`**: select
**`data-part`**: item
**`data-value`**: The value of the item
**`data-state`**: "checked" | "unchecked"
**`data-highlighted`**: Present when highlighted
**`data-disabled`**: Present when disabled
### ItemText
#### Props
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
#### Data Attributes
**`data-scope`**: select
**`data-part`**: item-text
**`data-state`**: "checked" | "unchecked"
**`data-disabled`**: Present when disabled
**`data-highlighted`**: Present when highlighted
### Label
#### Props
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
#### Data Attributes
**`data-scope`**: select
**`data-part`**: label
**`data-disabled`**: Present when disabled
**`data-invalid`**: Present when invalid
**`data-readonly`**: Present when read-only
### List
#### Props
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
### Positioner
#### Props
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
### RootProvider
#### Props
**`value`**
Type: `SelectApi`
Required: true
Default Value: `undefined`
Description: undefined
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
**`lazyMount`**
Type: `boolean`
Required: false
Default Value: `false`
Description: Whether to enable lazy mounting
**`unmountOnExit`**
Type: `boolean`
Required: false
Default Value: `false`
Description: Whether to unmount on exit.
### Trigger
#### Props
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
#### Data Attributes
**`data-scope`**: select
**`data-part`**: trigger
**`data-state`**: "open" | "closed"
**`data-disabled`**: Present when disabled
**`data-invalid`**: Present when invalid
**`data-readonly`**: Present when read-only
**`data-placement`**: The placement of the trigger
**`data-placeholder-shown`**: Present when placeholder is shown
### ValueText
#### Props
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
**`placeholder`**
Type: `string`
Required: false
Default Value: `undefined`
Description: undefined
#### Data Attributes
**`data-scope`**: select
**`data-part`**: value-text
**`data-disabled`**: Present when disabled
**`data-invalid`**: Present when invalid
**`data-focus`**: Present when focused
## Accessibility
Complies with the [Listbox WAI-ARIA design pattern](https://www.w3.org/WAI/ARIA/apg/patterns/listbox/).
### Keyboard Support
**`Space`**
Description: When focus is on trigger, opens the select and focuses the first selected item. When focus is on the content, selects the highlighted item.
**`Enter`**
Description: When focus is on trigger, opens the select and focuses the first selected item. When focus is on content, selects the focused item.
**`ArrowDown`**
Description: When focus is on trigger, opens the select. When focus is on content, moves focus to the next item.
**`ArrowUp`**
Description: When focus is on trigger, opens the select. When focus is on content, moves focus to the previous item.
**`Esc`**
Description: Closes the select and moves focus to trigger.
**`A-Z + a-z`**
Description: When focus is on trigger, selects the item whose label starts with the typed character. When focus is on the listbox, moves focus to the next item with a label that starts with the typed character.
# Signature Pad (REACT)
## Anatomy
To set up the signature pad correctly, you'll need to understand its anatomy and how we name its parts.
> Each part includes a `data-part` attribute to help identify them in the DOM.
## Examples
Learn how to use the `Signature Pad` component in your project. Let's take a look at the most basic example:
```tsx
import { SignaturePad } from '@ark-ui/react/signature-pad'
export const Basic = () => (
Sign belowClear
)
```
### Image Preview
After the user draws a signature, you can display a preview of the signature as an image. This is useful when you want
to show the user a preview of the signature before saving it.
```tsx
import { SignaturePad } from '@ark-ui/react/signature-pad'
import { useState } from 'react'
export const ImagePreview = () => {
const [imageUrl, setImageUrl] = useState('')
return (
<>
details.getDataUrl('image/png').then((url) => setImageUrl(url))}>
Sign belowClear
{imageUrl && }
>
)
}
```
### Using the Field Component
The `Field` component helps manage form-related state and accessibility attributes of a signature pad. It includes
handling ARIA labels, helper text, and error text to ensure proper accessibility.
```tsx
import { Field } from '@ark-ui/react/field'
import { SignaturePad } from '@ark-ui/react/signature-pad'
import { useState } from 'react'
export const WithField = (props: Field.RootProps) => {
const [value, setValue] = useState('')
return (
details.getDataUrl('image/png').then((url) => setValue(url))}>
LabelClearAdditional InfoError Info
)
}
```
### Using the Root Provider
The `RootProvider` component provides a context for the signature-pad. It accepts the value of the `useSignature-pad`
hook. You can leverage it to access the component state and methods from outside the signature-pad.
```tsx
import { SignaturePad, useSignaturePad } from '@ark-ui/react/signature-pad'
export const RootProvider = () => {
const signaturePad = useSignaturePad()
return (
<>
Sign belowClear
>
)
}
```
> If you're using the `RootProvider` component, you don't need to use the `Root` component.
## API Reference
### Root
#### Props
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
**`disabled`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Whether the signature pad is disabled.
**`drawing`**
Type: `DrawingOptions`
Required: false
Default Value: `'{ size: 2, simulatePressure: true }'`
Description: The drawing options.
**`ids`**
Type: `Partial<{ root: string; control: string; hiddenInput: string; label: string }>`
Required: false
Default Value: `undefined`
Description: The ids of the signature pad elements. Useful for composition.
**`name`**
Type: `string`
Required: false
Default Value: `undefined`
Description: The name of the signature pad. Useful for form submission.
**`onDraw`**
Type: `(details: DrawDetails) => void`
Required: false
Default Value: `undefined`
Description: Callback when the signature pad is drawing.
**`onDrawEnd`**
Type: `(details: DrawEndDetails) => void`
Required: false
Default Value: `undefined`
Description: Callback when the signature pad is done drawing.
**`readOnly`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Whether the signature pad is read-only.
**`required`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Whether the signature pad is required.
**`translations`**
Type: `IntlTranslations`
Required: false
Default Value: `undefined`
Description: The translations of the signature pad. Useful for internationalization.
#### Data Attributes
**`data-scope`**: signature-pad
**`data-part`**: root
**`data-disabled`**: Present when disabled
### ClearTrigger
#### Props
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
### Control
#### Props
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
#### Data Attributes
**`data-scope`**: signature-pad
**`data-part`**: control
**`data-disabled`**: Present when disabled
### Guide
#### Props
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
#### Data Attributes
**`data-scope`**: signature-pad
**`data-part`**: guide
**`data-disabled`**: Present when disabled
### HiddenInput
#### Props
**`value`**
Type: `string`
Required: true
Default Value: `undefined`
Description: undefined
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
### Label
#### Props
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
#### Data Attributes
**`data-scope`**: signature-pad
**`data-part`**: label
**`data-disabled`**: Present when disabled
### RootProvider
#### Props
**`value`**
Type: `UseSignaturePadReturn`
Required: true
Default Value: `undefined`
Description: undefined
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
### Segment
#### Props
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
# Signature Pad (SOLID)
## Anatomy
To set up the signature pad correctly, you'll need to understand its anatomy and how we name its parts.
> Each part includes a `data-part` attribute to help identify them in the DOM.
## Examples
Learn how to use the `Signature Pad` component in your project. Let's take a look at the most basic example:
```tsx
import { SignaturePad } from '@ark-ui/solid/signature-pad'
export const Basic = () => (
Sign belowClear
)
```
### Image Preview
After the user draws a signature, you can display a preview of the signature as an image. This is useful when you want
to show the user a preview of the signature before saving it.
```tsx
import { SignaturePad } from '@ark-ui/solid/signature-pad'
import { Show, createSignal } from 'solid-js'
export const ImagePreview = () => {
const [imageUrl, setImageUrl] = createSignal()
return (
<>
details.getDataUrl('image/png').then((url) => setImageUrl(url))}>
Sign belowClear
>
)
}
```
### Using the Field Component
The `Field` component helps manage form-related state and accessibility attributes of a signature pad. It includes
handling ARIA labels, helper text, and error text to ensure proper accessibility.
```tsx
import { Field } from '@ark-ui/solid/field'
import { SignaturePad } from '@ark-ui/solid/signature-pad'
import { createSignal } from 'solid-js'
export const WithField = (props: Field.RootProps) => {
const [value, setValue] = createSignal('')
return (
details.getDataUrl('image/png').then((url) => setValue(url))}>
LabelClearAdditional InfoError Info
)
}
```
### Using the Root Provider
The `RootProvider` component provides a context for the signature-pad. It accepts the value of the `useSignature-pad`
hook. You can leverage it to access the component state and methods from outside the signature-pad.
```tsx
import { SignaturePad, useSignaturePad } from '@ark-ui/solid/signature-pad'
export const RootProvider = () => {
const signaturePad = useSignaturePad()
return (
<>
Sign belowClear
>
)
}
```
> If you're using the `RootProvider` component, you don't need to use the `Root` component.
## API Reference
### Root
#### Props
**`asChild`**
Type: `(props: ParentProps<'div'>) => Element`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
**`disabled`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Whether the signature pad is disabled.
**`drawing`**
Type: `DrawingOptions`
Required: false
Default Value: `'{ size: 2, simulatePressure: true }'`
Description: The drawing options.
**`ids`**
Type: `Partial<{ root: string; control: string; hiddenInput: string; label: string }>`
Required: false
Default Value: `undefined`
Description: The ids of the signature pad elements. Useful for composition.
**`name`**
Type: `string`
Required: false
Default Value: `undefined`
Description: The name of the signature pad. Useful for form submission.
**`onDraw`**
Type: `(details: DrawDetails) => void`
Required: false
Default Value: `undefined`
Description: Callback when the signature pad is drawing.
**`onDrawEnd`**
Type: `(details: DrawEndDetails) => void`
Required: false
Default Value: `undefined`
Description: Callback when the signature pad is done drawing.
**`readOnly`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Whether the signature pad is read-only.
**`required`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Whether the signature pad is required.
**`translations`**
Type: `IntlTranslations`
Required: false
Default Value: `undefined`
Description: The translations of the signature pad. Useful for internationalization.
#### Data Attributes
**`data-scope`**: signature-pad
**`data-part`**: root
**`data-disabled`**: Present when disabled
### ClearTrigger
#### Props
**`asChild`**
Type: `(props: ParentProps<'button'>) => Element`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
### Control
#### Props
**`asChild`**
Type: `(props: ParentProps<'div'>) => Element`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
#### Data Attributes
**`data-scope`**: signature-pad
**`data-part`**: control
**`data-disabled`**: Present when disabled
### Guide
#### Props
**`asChild`**
Type: `(props: ParentProps<'div'>) => Element`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
#### Data Attributes
**`data-scope`**: signature-pad
**`data-part`**: guide
**`data-disabled`**: Present when disabled
### HiddenInput
#### Props
**`value`**
Type: `string`
Required: true
Default Value: `undefined`
Description: undefined
**`asChild`**
Type: `(props: ParentProps<'input'>) => Element`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
### Label
#### Props
**`asChild`**
Type: `(props: ParentProps<'label'>) => Element`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
#### Data Attributes
**`data-scope`**: signature-pad
**`data-part`**: label
**`data-disabled`**: Present when disabled
### RootProvider
#### Props
**`value`**
Type: `UseSignaturePadReturn`
Required: true
Default Value: `undefined`
Description: undefined
**`asChild`**
Type: `(props: ParentProps<'div'>) => Element`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
### Segment
#### Props
**`asChild`**
Type: `(props: ParentProps<'svg'>) => Element`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
# Signature Pad (VUE)
## Anatomy
To set up the signature pad correctly, you'll need to understand its anatomy and how we name its parts.
> Each part includes a `data-part` attribute to help identify them in the DOM.
## Examples
Learn how to use the `Signature Pad` component in your project. Let's take a look at the most basic example:
```vue
Sign belowClear
```
### Image Preview
After the user draws a signature, you can display a preview of the signature as an image. This is useful when you want
to show the user a preview of the signature before saving it.
```vue
Sign belowClear
```
### Using the Field Component
The `Field` component helps manage form-related state and accessibility attributes of a signature pad. It includes
handling ARIA labels, helper text, and error text to ensure proper accessibility.
```vue
LabelClearAdditional InfoError Info
```
### Using the Root Provider
The `RootProvider` component provides a context for the signature-pad. It accepts the value of the `useSignature-pad`
hook. You can leverage it to access the component state and methods from outside the signature-pad.
```vue
Sign belowClear
```
> If you're using the `RootProvider` component, you don't need to use the `Root` component.
## API Reference
### Root
#### Props
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
**`disabled`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Whether the signature pad is disabled.
**`drawing`**
Type: `DrawingOptions`
Required: false
Default Value: `'{ size: 2, simulatePressure: true }'`
Description: The drawing options.
**`id`**
Type: `string`
Required: false
Default Value: `undefined`
Description: The unique identifier of the machine.
**`ids`**
Type: `Partial<{ root: string; control: string; hiddenInput: string; label: string }>`
Required: false
Default Value: `undefined`
Description: The ids of the signature pad elements. Useful for composition.
**`name`**
Type: `string`
Required: false
Default Value: `undefined`
Description: The name of the signature pad. Useful for form submission.
**`readOnly`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Whether the signature pad is read-only.
**`required`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Whether the signature pad is required.
**`translations`**
Type: `IntlTranslations`
Required: false
Default Value: `undefined`
Description: The translations of the signature pad. Useful for internationalization.
#### Data Attributes
**`data-scope`**: signature-pad
**`data-part`**: root
**`data-disabled`**: Present when disabled
### ClearTrigger
#### Props
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
### Control
#### Props
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
#### Data Attributes
**`data-scope`**: signature-pad
**`data-part`**: control
**`data-disabled`**: Present when disabled
### Guide
#### Props
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
#### Data Attributes
**`data-scope`**: signature-pad
**`data-part`**: guide
**`data-disabled`**: Present when disabled
### HiddenInput
#### Props
**`value`**
Type: `string`
Required: true
Default Value: `undefined`
Description: undefined
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
### Label
#### Props
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
#### Data Attributes
**`data-scope`**: signature-pad
**`data-part`**: label
**`data-disabled`**: Present when disabled
### RootProvider
#### Props
**`value`**
Type: `SignaturePadApi`
Required: true
Default Value: `undefined`
Description: undefined
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
### Segment
#### Props
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
# Slider (REACT)
## Anatomy
To set up the slider correctly, you'll need to understand its anatomy and how we name its parts.
> Each part includes a `data-part` attribute to help identify them in the DOM.
## Examples
Learn how to use the `Slider` component in your project. Let's take a look at the most basic example:
```tsx
import { Slider } from '@ark-ui/react/slider'
export const Basic = () => {
return (
Label
)
}
```
### Range Slider
You can add multiple thumbs to the slider by adding multiple `Slider.Thumb`
```tsx
import { Slider } from '@ark-ui/react/slider'
export const Range = () => {
return (
Label
)
}
```
### Adding marks
You can add marks to the slider track by using the `Slider.MarkerGroup` and `Slider.Marker` components.
Position the `Slider.Marker` components relative to the track by providing the `value` prop.
```tsx
import { Slider } from '@ark-ui/react/slider'
export const WithMarks = () => {
return (
Label0*50*
)
}
```
### Setting the initial value
To set the slider's initial value, set the `defaultValue` prop to the array of numbers.
```tsx
import { Slider } from '@ark-ui/react/slider'
export const InitialValue = () => (
Label***
)
```
### Specifying the minimum and maximum
By default, the minimum is `0` and the maximum is `100`. If that's not what you want, you can easily specify different
bounds by changing the values of the `min` and/or `max` props.
For example, to ask the user for a value between `-10` and `10`, you can use:
```tsx
import { Slider } from '@ark-ui/react/slider'
export const MinMax = () => {
return (
Label
)
}
```
### Setting the value's granularity
By default, the granularity, is `1`, meaning that the value is always an integer. You can change the step attribute to
control the granularity.
For example, If you need a value between `5` and `10`, accurate to two decimal places, you should set the value of step
to `0.01`:
```tsx
import { Slider } from '@ark-ui/react/slider'
export const Step = () => {
return (
Label
)
}
```
### Listening for changes
When the slider value changes, the `onValueChange` and `onValueChangeEnd` callbacks are invoked. You can use this to set
up custom behaviors in your app.
```tsx
import { Slider } from '@ark-ui/react/slider'
export const OnEvent = () => {
return (
console.log(details.value)}
onValueChangeEnd={(details) => console.log(details.value)}
>
Label
)
}
```
### Changing the orientation
By default, the slider is assumed to be horizontal. To change the orientation to vertical, set the orientation property
in the machine's context to vertical.
In this mode, the slider will use the arrow up and down keys to increment/decrement its value.
> Don't forget to change the styles of the vertical slider by specifying its height
```tsx
import { Slider } from '@ark-ui/react/slider'
export const Vertical = () => {
return (
Label
)
}
```
### Changing the origin
By default, the slider's origin is at the start of the track. To change the origin to the center of the track, set the
`origin` prop to `center`.
```tsx
import { Slider } from '@ark-ui/react/slider'
export const CenterOrigin = () => {
return (
Label
)
}
```
### Using the Root Provider
The `RootProvider` component provides a context for the slider. It accepts the value of the `useSlider` hook. You can
leverage it to access the component state and methods from outside the slider.
```tsx
import { Slider, useSlider } from '@ark-ui/react/slider'
export const RootProvider = () => {
const slider = useSlider()
return (
<>
Label
>
)
}
```
> If you're using the `RootProvider` component, you don't need to use the `Root` component.
## API Reference
### Root
#### Props
**`aria-label`**
Type: `string[]`
Required: false
Default Value: `undefined`
Description: The aria-label of each slider thumb. Useful for providing an accessible name to the slider
**`aria-labelledby`**
Type: `string[]`
Required: false
Default Value: `undefined`
Description: The `id` of the elements that labels each slider thumb. Useful for providing an accessible name to the slider
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
**`defaultValue`**
Type: `number[]`
Required: false
Default Value: `undefined`
Description: The initial value of the slider when rendered.
Use when you don't need to control the value of the slider.
**`disabled`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Whether the slider is disabled
**`form`**
Type: `string`
Required: false
Default Value: `undefined`
Description: The associate form of the underlying input element.
**`getAriaValueText`**
Type: `(details: ValueTextDetails) => string`
Required: false
Default Value: `undefined`
Description: Function that returns a human readable value for the slider thumb
**`id`**
Type: `string`
Required: false
Default Value: `undefined`
Description: The unique identifier of the machine.
**`ids`**
Type: `Partial<{
root: string
thumb(index: number): string
hiddenInput(index: number): string
control: string
track: string
range: string
label: string
valueText: string
marker(index: number): string
}>`
Required: false
Default Value: `undefined`
Description: The ids of the elements in the slider. Useful for composition.
**`invalid`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Whether the slider is invalid
**`max`**
Type: `number`
Required: false
Default Value: `100`
Description: The maximum value of the slider
**`min`**
Type: `number`
Required: false
Default Value: `0`
Description: The minimum value of the slider
**`minStepsBetweenThumbs`**
Type: `number`
Required: false
Default Value: `0`
Description: The minimum permitted steps between multiple thumbs.
**`name`**
Type: `string`
Required: false
Default Value: `undefined`
Description: The name associated with each slider thumb (when used in a form)
**`onFocusChange`**
Type: `(details: FocusChangeDetails) => void`
Required: false
Default Value: `undefined`
Description: Function invoked when the slider's focused index changes
**`onValueChange`**
Type: `(details: ValueChangeDetails) => void`
Required: false
Default Value: `undefined`
Description: Function invoked when the value of the slider changes
**`onValueChangeEnd`**
Type: `(details: ValueChangeDetails) => void`
Required: false
Default Value: `undefined`
Description: Function invoked when the slider value change is done
**`orientation`**
Type: `'horizontal' | 'vertical'`
Required: false
Default Value: `"horizontal"`
Description: The orientation of the slider
**`origin`**
Type: `'center' | 'start'`
Required: false
Default Value: `"start"`
Description: The origin of the slider range
- "start": Useful when the value represents an absolute value
- "center": Useful when the value represents an offset (relative)
**`readOnly`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Whether the slider is read-only
**`step`**
Type: `number`
Required: false
Default Value: `1`
Description: The step value of the slider
**`thumbAlignment`**
Type: `'center' | 'contain'`
Required: false
Default Value: `"contain"`
Description: The alignment of the slider thumb relative to the track
- `center`: the thumb will extend beyond the bounds of the slider track.
- `contain`: the thumb will be contained within the bounds of the track.
**`thumbSize`**
Type: `{ width: number; height: number }`
Required: false
Default Value: `undefined`
Description: The slider thumbs dimensions
**`value`**
Type: `number[]`
Required: false
Default Value: `undefined`
Description: The controlled value of the slider
#### Data Attributes
**`data-scope`**: slider
**`data-part`**: root
**`data-disabled`**: Present when disabled
**`data-orientation`**: The orientation of the slider
**`data-dragging`**: Present when in the dragging state
**`data-invalid`**: Present when invalid
**`data-focus`**: Present when focused
### Control
#### Props
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
#### Data Attributes
**`data-scope`**: slider
**`data-part`**: control
**`data-dragging`**: Present when in the dragging state
**`data-disabled`**: Present when disabled
**`data-orientation`**: The orientation of the control
**`data-invalid`**: Present when invalid
**`data-focus`**: Present when focused
### DraggingIndicator
#### Props
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
#### Data Attributes
**`data-scope`**: slider
**`data-part`**: dragging-indicator
**`data-orientation`**: The orientation of the draggingindicator
**`data-state`**: "open" | "closed"
### HiddenInput
#### Props
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
### Label
#### Props
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
#### Data Attributes
**`data-scope`**: slider
**`data-part`**: label
**`data-disabled`**: Present when disabled
**`data-orientation`**: The orientation of the label
**`data-invalid`**: Present when invalid
**`data-dragging`**: Present when in the dragging state
**`data-focus`**: Present when focused
### MarkerGroup
#### Props
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
#### Data Attributes
**`data-scope`**: slider
**`data-part`**: marker-group
**`data-orientation`**: The orientation of the markergroup
### Marker
#### Props
**`value`**
Type: `number`
Required: true
Default Value: `undefined`
Description: undefined
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
#### Data Attributes
**`data-scope`**: slider
**`data-part`**: marker
**`data-orientation`**: The orientation of the marker
**`data-value`**: The value of the item
**`data-disabled`**: Present when disabled
**`data-state`**:
### Range
#### Props
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
#### Data Attributes
**`data-scope`**: slider
**`data-part`**: range
**`data-dragging`**: Present when in the dragging state
**`data-focus`**: Present when focused
**`data-invalid`**: Present when invalid
**`data-disabled`**: Present when disabled
**`data-orientation`**: The orientation of the range
### RootProvider
#### Props
**`value`**
Type: `UseSliderReturn`
Required: true
Default Value: `undefined`
Description: undefined
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
### Thumb
#### Props
**`index`**
Type: `number`
Required: true
Default Value: `undefined`
Description: undefined
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
**`name`**
Type: `string`
Required: false
Default Value: `undefined`
Description: undefined
#### Data Attributes
**`data-scope`**: slider
**`data-part`**: thumb
**`data-index`**: The index of the item
**`data-name`**:
**`data-disabled`**: Present when disabled
**`data-orientation`**: The orientation of the thumb
**`data-focus`**: Present when focused
**`data-dragging`**: Present when in the dragging state
### Track
#### Props
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
#### Data Attributes
**`data-scope`**: slider
**`data-part`**: track
**`data-disabled`**: Present when disabled
**`data-invalid`**: Present when invalid
**`data-dragging`**: Present when in the dragging state
**`data-orientation`**: The orientation of the track
**`data-focus`**: Present when focused
### ValueText
#### Props
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
#### Data Attributes
**`data-scope`**: slider
**`data-part`**: value-text
**`data-disabled`**: Present when disabled
**`data-orientation`**: The orientation of the valuetext
**`data-invalid`**: Present when invalid
**`data-focus`**: Present when focused
## Accessibility
Complies with the [Slider WAI-ARIA design pattern](https://www.w3.org/WAI/ARIA/apg/patterns/slider/).
### Keyboard Support
**`ArrowRight`**
Description: Increments the slider based on defined step
**`ArrowLeft`**
Description: Decrements the slider based on defined step
**`ArrowUp`**
Description: Increases the value by the step amount.
**`ArrowDown`**
Description: Decreases the value by the step amount.
**`PageUp`**
Description: Increases the value by a larger step
**`PageDown`**
Description: Decreases the value by a larger step
**`Shift + ArrowUp`**
Description: Increases the value by a larger step
**`Shift + ArrowDown`**
Description: Decreases the value by a larger step
**`Home`**
Description: Sets the value to its minimum.
**`End`**
Description: Sets the value to its maximum.
# Slider (SOLID)
## Anatomy
To set up the slider correctly, you'll need to understand its anatomy and how we name its parts.
> Each part includes a `data-part` attribute to help identify them in the DOM.
## Examples
Learn how to use the `Slider` component in your project. Let's take a look at the most basic example:
```tsx
import { Slider } from '@ark-ui/solid/slider'
export const Basic = () => {
return (
Label
)
}
```
### Range Slider
You can add multiple thumbs to the slider by adding multiple `Slider.Thumb`
```tsx
import { Slider } from '@ark-ui/solid/slider'
export const Range = () => {
return (
Label
)
}
```
### Adding marks
You can add marks to the slider track by using the `Slider.MarkerGroup` and `Slider.Marker` components.
Position the `Slider.Marker` components relative to the track by providing the `value` prop.
```tsx
import { Slider } from '@ark-ui/solid/slider'
export const WithMarks = () => {
return (
Label0*50*
)
}
```
### Setting the initial value
To set the slider's initial value, set the `defaultValue` prop to the array of numbers.
```tsx
import { Slider } from '@ark-ui/solid/slider'
export const InitialValue = () => (
Label***
)
```
### Specifying the minimum and maximum
By default, the minimum is `0` and the maximum is `100`. If that's not what you want, you can easily specify different
bounds by changing the values of the `min` and/or `max` props.
For example, to ask the user for a value between `-10` and `10`, you can use:
```tsx
import { Slider } from '@ark-ui/solid/slider'
export const MinMax = () => {
return (
Label
)
}
```
### Setting the value's granularity
By default, the granularity, is `1`, meaning that the value is always an integer. You can change the step attribute to
control the granularity.
For example, If you need a value between `5` and `10`, accurate to two decimal places, you should set the value of step
to `0.01`:
```tsx
import { Slider } from '@ark-ui/solid/slider'
export const Step = () => {
return (
Label
)
}
```
### Listening for changes
When the slider value changes, the `onValueChange` and `onValueChangeEnd` callbacks are invoked. You can use this to set
up custom behaviors in your app.
```tsx
import { Slider } from '@ark-ui/solid/slider'
export const OnEvent = () => {
return (
console.log(details.value)}
onValueChangeEnd={(details) => console.log(details.value)}
>
Label
)
}
```
### Changing the orientation
By default, the slider is assumed to be horizontal. To change the orientation to vertical, set the orientation property
in the machine's context to vertical.
In this mode, the slider will use the arrow up and down keys to increment/decrement its value.
> Don't forget to change the styles of the vertical slider by specifying its height
```tsx
import { Slider } from '@ark-ui/solid/slider'
export const Vertical = () => {
return (
Label
)
}
```
### Changing the origin
By default, the slider's origin is at the start of the track. To change the origin to the center of the track, set the
`origin` prop to `center`.
```tsx
import { Slider } from '@ark-ui/solid/slider'
export const CenterOrigin = () => {
return (
Label
)
}
```
### Using the Root Provider
The `RootProvider` component provides a context for the slider. It accepts the value of the `useSlider` hook. You can
leverage it to access the component state and methods from outside the slider.
```tsx
import { Slider, useSlider } from '@ark-ui/solid/slider'
export const RootProvider = () => {
const slider = useSlider()
return (
<>
Label
>
)
}
```
> If you're using the `RootProvider` component, you don't need to use the `Root` component.
## API Reference
### Root
#### Props
**`aria-label`**
Type: `string[]`
Required: false
Default Value: `undefined`
Description: The aria-label of each slider thumb. Useful for providing an accessible name to the slider
**`aria-labelledby`**
Type: `string[]`
Required: false
Default Value: `undefined`
Description: The `id` of the elements that labels each slider thumb. Useful for providing an accessible name to the slider
**`asChild`**
Type: `(props: ParentProps<'div'>) => Element`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
**`defaultValue`**
Type: `number[]`
Required: false
Default Value: `undefined`
Description: The initial value of the slider when rendered.
Use when you don't need to control the value of the slider.
**`disabled`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Whether the slider is disabled
**`form`**
Type: `string`
Required: false
Default Value: `undefined`
Description: The associate form of the underlying input element.
**`getAriaValueText`**
Type: `(details: ValueTextDetails) => string`
Required: false
Default Value: `undefined`
Description: Function that returns a human readable value for the slider thumb
**`id`**
Type: `string`
Required: false
Default Value: `undefined`
Description: The unique identifier of the machine.
**`ids`**
Type: `Partial<{
root: string
thumb(index: number): string
hiddenInput(index: number): string
control: string
track: string
range: string
label: string
valueText: string
marker(index: number): string
}>`
Required: false
Default Value: `undefined`
Description: The ids of the elements in the slider. Useful for composition.
**`invalid`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Whether the slider is invalid
**`max`**
Type: `number`
Required: false
Default Value: `100`
Description: The maximum value of the slider
**`min`**
Type: `number`
Required: false
Default Value: `0`
Description: The minimum value of the slider
**`minStepsBetweenThumbs`**
Type: `number`
Required: false
Default Value: `0`
Description: The minimum permitted steps between multiple thumbs.
**`name`**
Type: `string`
Required: false
Default Value: `undefined`
Description: The name associated with each slider thumb (when used in a form)
**`onFocusChange`**
Type: `(details: FocusChangeDetails) => void`
Required: false
Default Value: `undefined`
Description: Function invoked when the slider's focused index changes
**`onValueChange`**
Type: `(details: ValueChangeDetails) => void`
Required: false
Default Value: `undefined`
Description: Function invoked when the value of the slider changes
**`onValueChangeEnd`**
Type: `(details: ValueChangeDetails) => void`
Required: false
Default Value: `undefined`
Description: Function invoked when the slider value change is done
**`orientation`**
Type: `'horizontal' | 'vertical'`
Required: false
Default Value: `"horizontal"`
Description: The orientation of the slider
**`origin`**
Type: `'start' | 'center'`
Required: false
Default Value: `"start"`
Description: The origin of the slider range
- "start": Useful when the value represents an absolute value
- "center": Useful when the value represents an offset (relative)
**`readOnly`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Whether the slider is read-only
**`step`**
Type: `number`
Required: false
Default Value: `1`
Description: The step value of the slider
**`thumbAlignment`**
Type: `'center' | 'contain'`
Required: false
Default Value: `"contain"`
Description: The alignment of the slider thumb relative to the track
- `center`: the thumb will extend beyond the bounds of the slider track.
- `contain`: the thumb will be contained within the bounds of the track.
**`thumbSize`**
Type: `{ width: number; height: number }`
Required: false
Default Value: `undefined`
Description: The slider thumbs dimensions
**`value`**
Type: `number[]`
Required: false
Default Value: `undefined`
Description: The controlled value of the slider
#### Data Attributes
**`data-scope`**: slider
**`data-part`**: root
**`data-disabled`**: Present when disabled
**`data-orientation`**: The orientation of the slider
**`data-dragging`**: Present when in the dragging state
**`data-invalid`**: Present when invalid
**`data-focus`**: Present when focused
### Control
#### Props
**`asChild`**
Type: `(props: ParentProps<'div'>) => Element`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
#### Data Attributes
**`data-scope`**: slider
**`data-part`**: control
**`data-dragging`**: Present when in the dragging state
**`data-disabled`**: Present when disabled
**`data-orientation`**: The orientation of the control
**`data-invalid`**: Present when invalid
**`data-focus`**: Present when focused
### DraggingIndicator
#### Props
**`asChild`**
Type: `(props: ParentProps<'span'>) => Element`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
#### Data Attributes
**`data-scope`**: slider
**`data-part`**: dragging-indicator
**`data-orientation`**: The orientation of the draggingindicator
**`data-state`**: "open" | "closed"
### HiddenInput
#### Props
**`asChild`**
Type: `(props: ParentProps<'input'>) => Element`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
### Label
#### Props
**`asChild`**
Type: `(props: ParentProps<'label'>) => Element`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
#### Data Attributes
**`data-scope`**: slider
**`data-part`**: label
**`data-disabled`**: Present when disabled
**`data-orientation`**: The orientation of the label
**`data-invalid`**: Present when invalid
**`data-dragging`**: Present when in the dragging state
**`data-focus`**: Present when focused
### MarkerGroup
#### Props
**`asChild`**
Type: `(props: ParentProps<'div'>) => Element`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
#### Data Attributes
**`data-scope`**: slider
**`data-part`**: marker-group
**`data-orientation`**: The orientation of the markergroup
### Marker
#### Props
**`value`**
Type: `number`
Required: true
Default Value: `undefined`
Description: undefined
**`asChild`**
Type: `(props: ParentProps<'span'>) => Element`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
#### Data Attributes
**`data-scope`**: slider
**`data-part`**: marker
**`data-orientation`**: The orientation of the marker
**`data-value`**: The value of the item
**`data-disabled`**: Present when disabled
**`data-state`**:
### Range
#### Props
**`asChild`**
Type: `(props: ParentProps<'div'>) => Element`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
#### Data Attributes
**`data-scope`**: slider
**`data-part`**: range
**`data-dragging`**: Present when in the dragging state
**`data-focus`**: Present when focused
**`data-invalid`**: Present when invalid
**`data-disabled`**: Present when disabled
**`data-orientation`**: The orientation of the range
### RootProvider
#### Props
**`value`**
Type: `UseSliderReturn`
Required: true
Default Value: `undefined`
Description: undefined
**`asChild`**
Type: `(props: ParentProps<'div'>) => Element`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
### Thumb
#### Props
**`index`**
Type: `number`
Required: true
Default Value: `undefined`
Description: undefined
**`asChild`**
Type: `(props: ParentProps<'div'>) => Element`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
**`name`**
Type: `string`
Required: false
Default Value: `undefined`
Description: undefined
#### Data Attributes
**`data-scope`**: slider
**`data-part`**: thumb
**`data-index`**: The index of the item
**`data-name`**:
**`data-disabled`**: Present when disabled
**`data-orientation`**: The orientation of the thumb
**`data-focus`**: Present when focused
**`data-dragging`**: Present when in the dragging state
### Track
#### Props
**`asChild`**
Type: `(props: ParentProps<'div'>) => Element`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
#### Data Attributes
**`data-scope`**: slider
**`data-part`**: track
**`data-disabled`**: Present when disabled
**`data-invalid`**: Present when invalid
**`data-dragging`**: Present when in the dragging state
**`data-orientation`**: The orientation of the track
**`data-focus`**: Present when focused
### ValueText
#### Props
**`asChild`**
Type: `(props: ParentProps<'span'>) => Element`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
#### Data Attributes
**`data-scope`**: slider
**`data-part`**: value-text
**`data-disabled`**: Present when disabled
**`data-orientation`**: The orientation of the valuetext
**`data-invalid`**: Present when invalid
**`data-focus`**: Present when focused
## Accessibility
Complies with the [Slider WAI-ARIA design pattern](https://www.w3.org/WAI/ARIA/apg/patterns/slider/).
### Keyboard Support
**`ArrowRight`**
Description: Increments the slider based on defined step
**`ArrowLeft`**
Description: Decrements the slider based on defined step
**`ArrowUp`**
Description: Increases the value by the step amount.
**`ArrowDown`**
Description: Decreases the value by the step amount.
**`PageUp`**
Description: Increases the value by a larger step
**`PageDown`**
Description: Decreases the value by a larger step
**`Shift + ArrowUp`**
Description: Increases the value by a larger step
**`Shift + ArrowDown`**
Description: Decreases the value by a larger step
**`Home`**
Description: Sets the value to its minimum.
**`End`**
Description: Sets the value to its maximum.
# Slider (VUE)
## Anatomy
To set up the slider correctly, you'll need to understand its anatomy and how we name its parts.
> Each part includes a `data-part` attribute to help identify them in the DOM.
## Examples
Learn how to use the `Slider` component in your project. Let's take a look at the most basic example:
```vue
Label
```
### Range Slider
You can add multiple thumbs to the slider by adding multiple `Slider.Thumb`
```vue
Label
```
### Adding marks
You can add marks to the slider track by using the `Slider.MarkerGroup` and `Slider.Marker` components.
Position the `Slider.Marker` components relative to the track by providing the `value` prop.
```vue
Label0*50*
```
### Setting the initial value
To set the slider's initial value, set the `defaultValue` prop to the array of numbers.
```vue
Label***
```
### Specifying the minimum and maximum
By default, the minimum is `0` and the maximum is `100`. If that's not what you want, you can easily specify different
bounds by changing the values of the `min` and/or `max` props.
For example, to ask the user for a value between `-10` and `10`, you can use:
```vue
Label
```
### Setting the value's granularity
By default, the granularity, is `1`, meaning that the value is always an integer. You can change the step attribute to
control the granularity.
For example, If you need a value between `5` and `10`, accurate to two decimal places, you should set the value of step
to `0.01`:
```vue
Label
```
### Listening for changes
When the slider value changes, the `onValueChange` and `onValueChangeEnd` callbacks are invoked. You can use this to set
up custom behaviors in your app.
```vue
console.log(details.value)"
@value-change-end="(details) => console.log(details.value)"
>
Label
```
### Changing the orientation
By default, the slider is assumed to be horizontal. To change the orientation to vertical, set the orientation property
in the machine's context to vertical.
In this mode, the slider will use the arrow up and down keys to increment/decrement its value.
> Don't forget to change the styles of the vertical slider by specifying its height
```vue
Label
```
### Changing the origin
By default, the slider's origin is at the start of the track. To change the origin to the center of the track, set the
`origin` prop to `center`.
```vue
Label
```
### Using the Root Provider
The `RootProvider` component provides a context for the slider. It accepts the value of the `useSlider` hook. You can
leverage it to access the component state and methods from outside the slider.
```vue
Label
```
> If you're using the `RootProvider` component, you don't need to use the `Root` component.
## API Reference
### Root
#### Props
**`aria-label`**
Type: `string[]`
Required: false
Default Value: `undefined`
Description: The aria-label of each slider thumb. Useful for providing an accessible name to the slider
**`aria-labelledby`**
Type: `string[]`
Required: false
Default Value: `undefined`
Description: The `id` of the elements that labels each slider thumb. Useful for providing an accessible name to the slider
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
**`defaultValue`**
Type: `number[]`
Required: false
Default Value: `undefined`
Description: The initial value of the slider when rendered.
Use when you don't need to control the value of the slider.
**`dir`**
Type: `'rtl' | 'ltr'`
Required: false
Default Value: `"ltr"`
Description: The document's text/writing direction.
**`disabled`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Whether the slider is disabled
**`form`**
Type: `string`
Required: false
Default Value: `undefined`
Description: The associate form of the underlying input element.
**`getAriaValueText`**
Type: `(details: ValueTextDetails) => string`
Required: false
Default Value: `undefined`
Description: Function that returns a human readable value for the slider thumb
**`getRootNode`**
Type: `() => Node | Document | ShadowRoot`
Required: false
Default Value: `undefined`
Description: A root node to correctly resolve document in custom environments. E.x.: Iframes, Electron.
**`id`**
Type: `string`
Required: false
Default Value: `undefined`
Description: The unique identifier of the machine.
**`ids`**
Type: `Partial<{
root: string
thumb(index: number): string
hiddenInput(index: number): string
control: string
track: string
range: string
label: string
valueText: string
marker(index: number): string
}>`
Required: false
Default Value: `undefined`
Description: The ids of the elements in the slider. Useful for composition.
**`invalid`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Whether the slider is invalid
**`max`**
Type: `number`
Required: false
Default Value: `100`
Description: The maximum value of the slider
**`min`**
Type: `number`
Required: false
Default Value: `0`
Description: The minimum value of the slider
**`minStepsBetweenThumbs`**
Type: `number`
Required: false
Default Value: `0`
Description: The minimum permitted steps between multiple thumbs.
**`modelValue`**
Type: `number[]`
Required: false
Default Value: `undefined`
Description: The v-model value of the slider
**`name`**
Type: `string`
Required: false
Default Value: `undefined`
Description: The name associated with each slider thumb (when used in a form)
**`orientation`**
Type: `'horizontal' | 'vertical'`
Required: false
Default Value: `"horizontal"`
Description: The orientation of the slider
**`origin`**
Type: `'start' | 'center'`
Required: false
Default Value: `"start"`
Description: The origin of the slider range
- "start": Useful when the value represents an absolute value
- "center": Useful when the value represents an offset (relative)
**`readOnly`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Whether the slider is read-only
**`step`**
Type: `number`
Required: false
Default Value: `1`
Description: The step value of the slider
**`thumbAlignment`**
Type: `'center' | 'contain'`
Required: false
Default Value: `"contain"`
Description: The alignment of the slider thumb relative to the track
- `center`: the thumb will extend beyond the bounds of the slider track.
- `contain`: the thumb will be contained within the bounds of the track.
**`thumbSize`**
Type: `{ width: number; height: number }`
Required: false
Default Value: `undefined`
Description: The slider thumbs dimensions
#### Emits
**`focusChange`**
Type: `[details: FocusChangeDetails]`
Description: Function invoked when the slider's focused index changes
**`update:modelValue`**
Type: `[value: number[]]`
Description: The callback fired when the model value changes.
**`valueChange`**
Type: `[details: ValueChangeDetails]`
Description: Function invoked when the value of the slider changes
**`valueChangeEnd`**
Type: `[details: ValueChangeDetails]`
Description: Function invoked when the slider value change is done
#### Data Attributes
**`data-scope`**: slider
**`data-part`**: root
**`data-disabled`**: Present when disabled
**`data-orientation`**: The orientation of the slider
**`data-dragging`**: Present when in the dragging state
**`data-invalid`**: Present when invalid
**`data-focus`**: Present when focused
### Control
#### Props
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
#### Data Attributes
**`data-scope`**: slider
**`data-part`**: control
**`data-dragging`**: Present when in the dragging state
**`data-disabled`**: Present when disabled
**`data-orientation`**: The orientation of the control
**`data-invalid`**: Present when invalid
**`data-focus`**: Present when focused
### DraggingIndicator
#### Props
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
#### Data Attributes
**`data-scope`**: slider
**`data-part`**: dragging-indicator
**`data-orientation`**: The orientation of the draggingindicator
**`data-state`**: "open" | "closed"
### HiddenInput
#### Props
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
### Label
#### Props
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
#### Data Attributes
**`data-scope`**: slider
**`data-part`**: label
**`data-disabled`**: Present when disabled
**`data-orientation`**: The orientation of the label
**`data-invalid`**: Present when invalid
**`data-dragging`**: Present when in the dragging state
**`data-focus`**: Present when focused
### MarkerGroup
#### Props
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
#### Data Attributes
**`data-scope`**: slider
**`data-part`**: marker-group
**`data-orientation`**: The orientation of the markergroup
### Marker
#### Props
**`value`**
Type: `number`
Required: true
Default Value: `undefined`
Description: undefined
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
#### Data Attributes
**`data-scope`**: slider
**`data-part`**: marker
**`data-orientation`**: The orientation of the marker
**`data-value`**: The value of the item
**`data-disabled`**: Present when disabled
**`data-state`**:
### Range
#### Props
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
#### Data Attributes
**`data-scope`**: slider
**`data-part`**: range
**`data-dragging`**: Present when in the dragging state
**`data-focus`**: Present when focused
**`data-invalid`**: Present when invalid
**`data-disabled`**: Present when disabled
**`data-orientation`**: The orientation of the range
### RootProvider
#### Props
**`value`**
Type: `SliderApi`
Required: true
Default Value: `undefined`
Description: undefined
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
### Thumb
#### Props
**`index`**
Type: `number`
Required: true
Default Value: `undefined`
Description: undefined
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
**`name`**
Type: `string`
Required: false
Default Value: `undefined`
Description: undefined
#### Data Attributes
**`data-scope`**: slider
**`data-part`**: thumb
**`data-index`**: The index of the item
**`data-name`**:
**`data-disabled`**: Present when disabled
**`data-orientation`**: The orientation of the thumb
**`data-focus`**: Present when focused
**`data-dragging`**: Present when in the dragging state
### Track
#### Props
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
#### Data Attributes
**`data-scope`**: slider
**`data-part`**: track
**`data-disabled`**: Present when disabled
**`data-invalid`**: Present when invalid
**`data-dragging`**: Present when in the dragging state
**`data-orientation`**: The orientation of the track
**`data-focus`**: Present when focused
### ValueText
#### Props
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
#### Data Attributes
**`data-scope`**: slider
**`data-part`**: value-text
**`data-disabled`**: Present when disabled
**`data-orientation`**: The orientation of the valuetext
**`data-invalid`**: Present when invalid
**`data-focus`**: Present when focused
## Accessibility
Complies with the [Slider WAI-ARIA design pattern](https://www.w3.org/WAI/ARIA/apg/patterns/slider/).
### Keyboard Support
**`ArrowRight`**
Description: Increments the slider based on defined step
**`ArrowLeft`**
Description: Decrements the slider based on defined step
**`ArrowUp`**
Description: Increases the value by the step amount.
**`ArrowDown`**
Description: Decreases the value by the step amount.
**`PageUp`**
Description: Increases the value by a larger step
**`PageDown`**
Description: Decreases the value by a larger step
**`Shift + ArrowUp`**
Description: Increases the value by a larger step
**`Shift + ArrowDown`**
Description: Decreases the value by a larger step
**`Home`**
Description: Sets the value to its minimum.
**`End`**
Description: Sets the value to its maximum.
# Splitter (REACT)
## Anatomy
To set up the splitter correctly, you'll need to understand its anatomy and how we name its parts.
> Each part includes a `data-part` attribute to help identify them in the DOM.
## Examples
Learn how to use the `Splitter` component in your project. Let's take a look at the most basic example:
```tsx
import { Splitter } from '@ark-ui/react/splitter'
export const Basic = () => (
AB
)
```
### Using Render Props
The Splitter component allows you to pass a function as a child to gain direct access to its API. This provides more
control and allows you to modify the size of the panels programmatically:
```tsx
import { Splitter } from '@ark-ui/react/splitter'
export const RenderProp = () => (
{(splitter) => (
<>
>
)}
)
```
### Handling Events
Splitter also provides `onResizeStart`, `onResize`, and `onResizeEnd` events which can be useful to perform some actions
during the start and end of the resizing process:
```tsx
import { Splitter } from '@ark-ui/react/splitter'
export const Events = () => (
console.log('onResize', details)}
onResizeStart={() => console.log('onResizeStart')}
onResizeEnd={(details) => console.log('onResizeEnd', details)}
onExpand={(details) => console.log('onExpand', details)}
onCollapse={(details) => console.log('onCollapse', details)}
>
AB
)
```
### Vertical Splitter
By default, the Splitter component is horizontal. If you need a vertical splitter, use the `orientation` prop:
```tsx
import { Splitter } from '@ark-ui/react/splitter'
export const Vertical = () => (
AB
)
```
### Collapsible Panels
To make a panel collapsible, set the `collapsible` prop to `true` on the panel you want to make collapsible.
Additionally, you can use the `collapsedSize` prop to set the size of the panel when it's collapsed.
> This can be useful for building sidebar layouts.
```tsx
import { Splitter } from '@ark-ui/react/splitter'
export const Collapsible = () => (
AB
)
```
### Multiple Panels
Here's an example of how to use the `Splitter` component with multiple panels.
```tsx
import { Splitter } from '@ark-ui/react/splitter'
export const MultiplePanels = () => (
ABC
)
```
### Using the Root Provider
The `RootProvider` component provides a context for the splitter. It accepts the value of the `useSplitter` hook. You
can leverage it to access the component state and methods from outside the splitter.
```tsx
import { Splitter, useSplitter } from '@ark-ui/react/splitter'
export const RootProvider = () => {
const splitter = useSplitter({ defaultSize: [50, 50], panels: [{ id: 'a' }, { id: 'b' }] })
return (
<>
AB
>
)
}
```
> If you're using the `RootProvider` component, you don't need to use the `Root` component.
## API Reference
### Root
#### Props
**`panels`**
Type: `PanelData[]`
Required: true
Default Value: `undefined`
Description: The size constraints of the panels.
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
**`defaultSize`**
Type: `number[]`
Required: false
Default Value: `undefined`
Description: The initial size of the panels when rendered.
Use when you don't need to control the size of the panels.
**`id`**
Type: `string`
Required: false
Default Value: `undefined`
Description: The unique identifier of the machine.
**`ids`**
Type: `Partial<{
root: string
resizeTrigger(id: string): string
label(id: string): string
panel(id: string | number): string
}>`
Required: false
Default Value: `undefined`
Description: The ids of the elements in the splitter. Useful for composition.
**`keyboardResizeBy`**
Type: `number`
Required: false
Default Value: `undefined`
Description: The number of pixels to resize the panel by when the keyboard is used.
**`nonce`**
Type: `string`
Required: false
Default Value: `undefined`
Description: The nonce for the injected splitter cursor stylesheet.
**`onCollapse`**
Type: `(details: ExpandCollapseDetails) => void`
Required: false
Default Value: `undefined`
Description: Function called when a panel is collapsed.
**`onExpand`**
Type: `(details: ExpandCollapseDetails) => void`
Required: false
Default Value: `undefined`
Description: Function called when a panel is expanded.
**`onResize`**
Type: `(details: ResizeDetails) => void`
Required: false
Default Value: `undefined`
Description: Function called when the splitter is resized.
**`onResizeEnd`**
Type: `(details: ResizeEndDetails) => void`
Required: false
Default Value: `undefined`
Description: Function called when the splitter resize ends.
**`onResizeStart`**
Type: `() => void`
Required: false
Default Value: `undefined`
Description: Function called when the splitter resize starts.
**`orientation`**
Type: `'horizontal' | 'vertical'`
Required: false
Default Value: `"horizontal"`
Description: The orientation of the splitter. Can be `horizontal` or `vertical`
**`size`**
Type: `number[]`
Required: false
Default Value: `undefined`
Description: The controlled size data of the panels
#### Data Attributes
**`data-scope`**: splitter
**`data-part`**: root
**`data-orientation`**: The orientation of the splitter
### Panel
#### Props
**`id`**
Type: `string`
Required: true
Default Value: `undefined`
Description: undefined
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
#### Data Attributes
**`data-scope`**: splitter
**`data-part`**: panel
**`data-orientation`**: The orientation of the panel
**`data-id`**:
**`data-index`**: The index of the item
### ResizeTrigger
#### Props
**`id`**
Type: ``${string}:${string}``
Required: true
Default Value: `undefined`
Description: undefined
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
**`disabled`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: undefined
#### Data Attributes
**`data-scope`**: splitter
**`data-part`**: resize-trigger
**`data-id`**:
**`data-orientation`**: The orientation of the resizetrigger
**`data-focus`**: Present when focused
**`data-disabled`**: Present when disabled
### RootProvider
#### Props
**`value`**
Type: `UseSplitterReturn`
Required: true
Default Value: `undefined`
Description: undefined
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
## Accessibility
Complies with the [Window Splitter WAI-ARIA design pattern](https://www.w3.org/WAI/ARIA/apg/patterns/windowsplitter/).
# Splitter (SOLID)
## Anatomy
To set up the splitter correctly, you'll need to understand its anatomy and how we name its parts.
> Each part includes a `data-part` attribute to help identify them in the DOM.
## Examples
Learn how to use the `Splitter` component in your project. Let's take a look at the most basic example:
```tsx
import { Splitter } from '@ark-ui/solid/splitter'
export const Basic = () => (
AB
)
```
### Using Render Props
The Splitter component allows you to pass a function as a child to gain direct access to its API. This provides more
control and allows you to modify the size of the panels programmatically:
```tsx
import { Splitter } from '@ark-ui/solid/splitter'
export const RenderProp = () => (
{(api) => (
<>
>
)}
)
```
### Handling Events
Splitter also provides `onResizeStart`, `onResize`, and `onResizeEnd` events which can be useful to perform some actions
during the start and end of the resizing process:
```tsx
import { Splitter } from '@ark-ui/solid/splitter'
export const Events = () => (
console.log('onResizeStart')}
onResizeEnd={(details) => console.log('onResizeEnd', details)}
onExpand={(details) => console.log('onExpand', details)}
onCollapse={(details) => console.log('onCollapse', details)}
>
AB
)
```
### Vertical Splitter
By default, the Splitter component is horizontal. If you need a vertical splitter, use the `orientation` prop:
```tsx
import { Splitter } from '@ark-ui/solid/splitter'
export const Vertical = () => (
AB
)
```
### Collapsible Panels
To make a panel collapsible, set the `collapsible` prop to `true` on the panel you want to make collapsible.
Additionally, you can use the `collapsedSize` prop to set the size of the panel when it's collapsed.
> This can be useful for building sidebar layouts.
```tsx
import { Splitter } from '@ark-ui/solid/splitter'
export const Collapsible = () => (
AB
)
```
### Multiple Panels
Here's an example of how to use the `Splitter` component with multiple panels.
```tsx
import { Splitter } from '@ark-ui/solid/splitter'
export const MultiplePanels = () => (
ABC
)
```
### Using the Root Provider
The `RootProvider` component provides a context for the splitter. It accepts the value of the `useSplitter` hook. You
can leverage it to access the component state and methods from outside the splitter.
```tsx
import { Splitter, useSplitter } from '@ark-ui/solid/splitter'
export const RootProvider = () => {
const splitter = useSplitter({ defaultSize: [50, 50], panels: [{ id: 'a' }, { id: 'b' }] })
return (
<>
AB
>
)
}
```
> If you're using the `RootProvider` component, you don't need to use the `Root` component.
## API Reference
### Root
#### Props
**`panels`**
Type: `PanelData[]`
Required: true
Default Value: `undefined`
Description: The size constraints of the panels.
**`asChild`**
Type: `(props: ParentProps<'div'>) => Element`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
**`defaultSize`**
Type: `number[]`
Required: false
Default Value: `undefined`
Description: The initial size of the panels when rendered.
Use when you don't need to control the size of the panels.
**`ids`**
Type: `Partial<{
root: string
resizeTrigger(id: string): string
label(id: string): string
panel(id: string | number): string
}>`
Required: false
Default Value: `undefined`
Description: The ids of the elements in the splitter. Useful for composition.
**`keyboardResizeBy`**
Type: `number`
Required: false
Default Value: `undefined`
Description: The number of pixels to resize the panel by when the keyboard is used.
**`nonce`**
Type: `string`
Required: false
Default Value: `undefined`
Description: The nonce for the injected splitter cursor stylesheet.
**`onCollapse`**
Type: `(details: ExpandCollapseDetails) => void`
Required: false
Default Value: `undefined`
Description: Function called when a panel is collapsed.
**`onExpand`**
Type: `(details: ExpandCollapseDetails) => void`
Required: false
Default Value: `undefined`
Description: Function called when a panel is expanded.
**`onResize`**
Type: `(details: ResizeDetails) => void`
Required: false
Default Value: `undefined`
Description: Function called when the splitter is resized.
**`onResizeEnd`**
Type: `(details: ResizeEndDetails) => void`
Required: false
Default Value: `undefined`
Description: Function called when the splitter resize ends.
**`onResizeStart`**
Type: `() => void`
Required: false
Default Value: `undefined`
Description: Function called when the splitter resize starts.
**`orientation`**
Type: `'horizontal' | 'vertical'`
Required: false
Default Value: `"horizontal"`
Description: The orientation of the splitter. Can be `horizontal` or `vertical`
**`size`**
Type: `number[]`
Required: false
Default Value: `undefined`
Description: The controlled size data of the panels
#### Data Attributes
**`data-scope`**: splitter
**`data-part`**: root
**`data-orientation`**: The orientation of the splitter
### Panel
#### Props
**`id`**
Type: `string`
Required: true
Default Value: `undefined`
Description: undefined
**`asChild`**
Type: `(props: ParentProps<'div'>) => Element`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
#### Data Attributes
**`data-scope`**: splitter
**`data-part`**: panel
**`data-orientation`**: The orientation of the panel
**`data-id`**:
**`data-index`**: The index of the item
### ResizeTrigger
#### Props
**`id`**
Type: ``${string}:${string}``
Required: true
Default Value: `undefined`
Description: undefined
**`asChild`**
Type: `(props: ParentProps<'button'>) => Element`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
**`disabled`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: undefined
#### Data Attributes
**`data-scope`**: splitter
**`data-part`**: resize-trigger
**`data-id`**:
**`data-orientation`**: The orientation of the resizetrigger
**`data-focus`**: Present when focused
**`data-disabled`**: Present when disabled
### RootProvider
#### Props
**`value`**
Type: `UseSplitterReturn`
Required: true
Default Value: `undefined`
Description: undefined
**`asChild`**
Type: `(props: ParentProps<'div'>) => Element`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
## Accessibility
Complies with the [Window Splitter WAI-ARIA design pattern](https://www.w3.org/WAI/ARIA/apg/patterns/windowsplitter/).
# Splitter (VUE)
## Anatomy
To set up the splitter correctly, you'll need to understand its anatomy and how we name its parts.
> Each part includes a `data-part` attribute to help identify them in the DOM.
## Examples
Learn how to use the `Splitter` component in your project. Let's take a look at the most basic example:
```vue
AB
```
### Using Render Props
The Splitter component allows you to pass a function as a child to gain direct access to its API. This provides more
control and allows you to modify the size of the panels programmatically:
```vue
```
### Handling Events
Splitter also provides `onResizeStart`, `onResize`, and `onResizeEnd` events which can be useful to perform some actions
during the start and end of the resizing process:
```vue
console.log('onResize', details)"
@resize-start="() => console.log('onResizeStart')"
@resize-end="(details) => console.log('onResizeEnd', details)"
@expand="(details) => console.log('onExpand', details)"
@collapse="(details) => console.log('onCollapse', details)"
>
AB
```
### Vertical Splitter
By default, the Splitter component is horizontal. If you need a vertical splitter, use the `orientation` prop:
```vue
AB
```
### Collapsible Panels
To make a panel collapsible, set the `collapsible` prop to `true` on the panel you want to make collapsible.
Additionally, you can use the `collapsedSize` prop to set the size of the panel when it's collapsed.
> This can be useful for building sidebar layouts.
```vue
AB
```
### Multiple Panels
Here's an example of how to use the `Splitter` component with multiple panels.
```vue
ABC
```
### Using the Root Provider
The `RootProvider` component provides a context for the splitter. It accepts the value of the `useSplitter` hook. You
can leverage it to access the component state and methods from outside the splitter.
```vue
AB
```
> If you're using the `RootProvider` component, you don't need to use the `Root` component.
## API Reference
### Root
#### Props
**`panels`**
Type: `PanelData[]`
Required: true
Default Value: `undefined`
Description: The size constraints of the panels.
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
**`defaultSize`**
Type: `number[]`
Required: false
Default Value: `undefined`
Description: The initial size of the panels when rendered.
Use when you don't need to control the size of the panels.
**`id`**
Type: `string`
Required: false
Default Value: `undefined`
Description: The unique identifier of the machine.
**`ids`**
Type: `Partial<{
root: string
resizeTrigger(id: string): string
label(id: string): string
panel(id: string | number): string
}>`
Required: false
Default Value: `undefined`
Description: The ids of the elements in the splitter. Useful for composition.
**`keyboardResizeBy`**
Type: `number`
Required: false
Default Value: `undefined`
Description: The number of pixels to resize the panel by when the keyboard is used.
**`nonce`**
Type: `string`
Required: false
Default Value: `undefined`
Description: The nonce for the injected splitter cursor stylesheet.
**`orientation`**
Type: `'horizontal' | 'vertical'`
Required: false
Default Value: `"horizontal"`
Description: The orientation of the splitter. Can be `horizontal` or `vertical`
**`size`**
Type: `number[]`
Required: false
Default Value: `undefined`
Description: The controlled size data of the panels
#### Emits
**`collapse`**
Type: `[details: ExpandCollapseDetails]`
Description: Function called when a panel is collapsed.
**`expand`**
Type: `[details: ExpandCollapseDetails]`
Description: Function called when a panel is expanded.
**`resize`**
Type: `[details: ResizeDetails]`
Description: Function called when the splitter is resized.
**`resizeEnd`**
Type: `[details: ResizeEndDetails]`
Description: Function called when the splitter resize ends.
**`resizeStart`**
Type: `[]`
Description: Function called when the splitter resize starts.
**`update:size`**
Type: `[size: number[]]`
Description: The callback fired when the model value changes.
#### Data Attributes
**`data-scope`**: splitter
**`data-part`**: root
**`data-orientation`**: The orientation of the splitter
### Panel
#### Props
**`id`**
Type: `string`
Required: true
Default Value: `undefined`
Description: undefined
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
#### Data Attributes
**`data-scope`**: splitter
**`data-part`**: panel
**`data-orientation`**: The orientation of the panel
**`data-id`**:
**`data-index`**: The index of the item
### ResizeTrigger
#### Props
**`id`**
Type: ``${string}:${string}``
Required: true
Default Value: `undefined`
Description: undefined
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
**`disabled`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: undefined
#### Data Attributes
**`data-scope`**: splitter
**`data-part`**: resize-trigger
**`data-id`**:
**`data-orientation`**: The orientation of the resizetrigger
**`data-focus`**: Present when focused
**`data-disabled`**: Present when disabled
### RootProvider
#### Props
**`value`**
Type: `SplitterApi`
Required: true
Default Value: `undefined`
Description: undefined
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
## Accessibility
Complies with the [Window Splitter WAI-ARIA design pattern](https://www.w3.org/WAI/ARIA/apg/patterns/windowsplitter/).
# Steps (REACT)
## Usage
The `Steps` component is used to guide users through a series of steps in a process.
- Supports horizontal and vertical orientations.
- Support for changing the active step with the keyboard and pointer.
- Support for linear and non-linear steps.
```jsx
import { Steps } from '@ark-ui/react/steps'
```
## Examples
### Basic
Here's a basic example of the `Steps` component.
```tsx
import { Steps } from '@ark-ui/react/steps'
const items = [
{ value: 'first', title: 'First', description: 'Contact Info' },
{ value: 'second', title: 'Second', description: 'Date & Time' },
{ value: 'third', title: 'Third', description: 'Select Rooms' },
]
export const Basic = () => {
return (
{items.map((item, index) => (
{index + 1}{item.title}
))}
{items.map((item, index) => (
{item.title} - {item.description}
))}
Steps Complete - Thank you for filling out the form!
BackNext
)
}
```
### Using the Root Provider
The `RootProvider` component provides a context for the steps. It accepts the value of the `useSteps` hook. You can
leverage it to access the component state and methods from outside the steps.
```tsx
import { Steps, useSteps } from '@ark-ui/react/steps'
const items = [
{ value: 'first', title: 'First', description: 'Contact Info' },
{ value: 'second', title: 'Second', description: 'Date & Time' },
{ value: 'third', title: 'Third', description: 'Select Rooms' },
]
export const RootProvider = () => {
const steps = useSteps({ count: items.length })
return (
<>
{items.map((item, index) => (
{index + 1}{item.title}
))}
{items.map((item, index) => (
{item.title} - {item.description}
))}
Steps Complete - Thank you for filling out the form!
BackNext
>
)
}
```
> If you're using the `RootProvider` component, you don't need to use the `Root` component.
## API Reference
### Root
#### Props
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
**`count`**
Type: `number`
Required: false
Default Value: `undefined`
Description: The total number of steps
**`defaultStep`**
Type: `number`
Required: false
Default Value: `undefined`
Description: The initial value of the stepper when rendered.
Use when you don't need to control the value of the stepper.
**`ids`**
Type: `ElementIds`
Required: false
Default Value: `undefined`
Description: The custom ids for the stepper elements
**`linear`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: If `true`, the stepper requires the user to complete the steps in order
**`onStepChange`**
Type: `(details: StepChangeDetails) => void`
Required: false
Default Value: `undefined`
Description: Callback to be called when the value changes
**`onStepComplete`**
Type: `VoidFunction`
Required: false
Default Value: `undefined`
Description: Callback to be called when a step is completed
**`orientation`**
Type: `'horizontal' | 'vertical'`
Required: false
Default Value: `"horizontal"`
Description: The orientation of the stepper
**`step`**
Type: `number`
Required: false
Default Value: `undefined`
Description: The controlled value of the stepper
#### Data Attributes
**`data-scope`**: steps
**`data-part`**: root
**`data-orientation`**: The orientation of the steps
### CompletedContent
#### Props
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
### Content
#### Props
**`index`**
Type: `number`
Required: true
Default Value: `undefined`
Description: undefined
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
#### Data Attributes
**`data-scope`**: steps
**`data-part`**: content
**`data-state`**: "open" | "closed"
**`data-orientation`**: The orientation of the content
### Indicator
#### Props
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
#### Data Attributes
**`data-scope`**: steps
**`data-part`**: indicator
**`data-complete`**: Present when the indicator value is complete
**`data-current`**: Present when current
**`data-incomplete`**:
### Item
#### Props
**`index`**
Type: `number`
Required: true
Default Value: `undefined`
Description: undefined
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
#### Data Attributes
**`data-scope`**: steps
**`data-part`**: item
**`data-orientation`**: The orientation of the item
### List
#### Props
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
#### Data Attributes
**`data-scope`**: steps
**`data-part`**: list
**`data-orientation`**: The orientation of the list
### NextTrigger
#### Props
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
### PrevTrigger
#### Props
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
### Progress
#### Props
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
#### Data Attributes
**`data-scope`**: steps
**`data-part`**: progress
**`data-complete`**: Present when the progress value is complete
### RootProvider
#### Props
**`value`**
Type: `UseStepsReturn`
Required: true
Default Value: `undefined`
Description: undefined
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
### Separator
#### Props
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
#### Data Attributes
**`data-scope`**: steps
**`data-part`**: separator
**`data-orientation`**: The orientation of the separator
**`data-complete`**: Present when the separator value is complete
**`data-current`**: Present when current
**`data-incomplete`**:
### Trigger
#### Props
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
#### Data Attributes
**`data-scope`**: steps
**`data-part`**: trigger
**`data-state`**: "open" | "closed"
**`data-orientation`**: The orientation of the trigger
**`data-complete`**: Present when the trigger value is complete
**`data-current`**: Present when current
**`data-incomplete`**:
# Steps (SOLID)
## Usage
The `Steps` component is used to guide users through a series of steps in a process.
- Supports horizontal and vertical orientations.
- Support for changing the active step with the keyboard and pointer.
- Support for linear and non-linear steps.
```jsx
import { Steps } from '@ark-ui/react/steps'
```
## Examples
### Basic
Here's a basic example of the `Steps` component.
```tsx
import { Steps } from '@ark-ui/solid/steps'
import { For } from 'solid-js'
const items = [
{ value: 'first', title: 'First', description: 'Contact Info' },
{ value: 'second', title: 'Second', description: 'Date & Time' },
{ value: 'third', title: 'Third', description: 'Select Rooms' },
]
export const Basic = () => {
return (
{(item, index) => (
{index() + 1}{item.title}
)}
{(item, index) => (
{item.title} - {item.description}
)}
Steps Complete - Thank you for filling out the form!
BackNext
)
}
```
### Using the Root Provider
The `RootProvider` component provides a context for the steps. It accepts the value of the `useSteps` hook. You can
leverage it to access the component state and methods from outside the steps.
```tsx
import { Steps, useSteps } from '@ark-ui/solid/steps'
import { For } from 'solid-js'
const items = [
{ value: 'first', title: 'First', description: 'Contact Info' },
{ value: 'second', title: 'Second', description: 'Date & Time' },
{ value: 'third', title: 'Third', description: 'Select Rooms' },
]
export const RootProvider = () => {
const steps = useSteps({ count: items.length })
return (
<>
{(item, index) => (
{index() + 1}{item.title}
)}
{(item, index) => (
{item.title} - {item.description}
)}
Steps Complete - Thank you for filling out the form!
BackNext
>
)
}
```
> If you're using the `RootProvider` component, you don't need to use the `Root` component.
## API Reference
### Root
#### Props
**`asChild`**
Type: `(props: ParentProps<'div'>) => Element`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
**`count`**
Type: `number`
Required: false
Default Value: `undefined`
Description: The total number of steps
**`defaultStep`**
Type: `number`
Required: false
Default Value: `undefined`
Description: The initial value of the stepper when rendered.
Use when you don't need to control the value of the stepper.
**`ids`**
Type: `ElementIds`
Required: false
Default Value: `undefined`
Description: The custom ids for the stepper elements
**`linear`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: If `true`, the stepper requires the user to complete the steps in order
**`onStepChange`**
Type: `(details: StepChangeDetails) => void`
Required: false
Default Value: `undefined`
Description: Callback to be called when the value changes
**`onStepComplete`**
Type: `VoidFunction`
Required: false
Default Value: `undefined`
Description: Callback to be called when a step is completed
**`orientation`**
Type: `'horizontal' | 'vertical'`
Required: false
Default Value: `"horizontal"`
Description: The orientation of the stepper
**`step`**
Type: `number`
Required: false
Default Value: `undefined`
Description: The controlled value of the stepper
#### Data Attributes
**`data-scope`**: steps
**`data-part`**: root
**`data-orientation`**: The orientation of the steps
### CompletedContent
#### Props
**`asChild`**
Type: `(props: ParentProps<'div'>) => Element`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
### Content
#### Props
**`index`**
Type: `number`
Required: true
Default Value: `undefined`
Description: undefined
**`asChild`**
Type: `(props: ParentProps<'div'>) => Element`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
#### Data Attributes
**`data-scope`**: steps
**`data-part`**: content
**`data-state`**: "open" | "closed"
**`data-orientation`**: The orientation of the content
### Indicator
#### Props
**`asChild`**
Type: `(props: ParentProps<'div'>) => Element`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
#### Data Attributes
**`data-scope`**: steps
**`data-part`**: indicator
**`data-complete`**: Present when the indicator value is complete
**`data-current`**: Present when current
**`data-incomplete`**:
### Item
#### Props
**`index`**
Type: `number`
Required: true
Default Value: `undefined`
Description: undefined
**`asChild`**
Type: `(props: ParentProps<'div'>) => Element`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
#### Data Attributes
**`data-scope`**: steps
**`data-part`**: item
**`data-orientation`**: The orientation of the item
### List
#### Props
**`asChild`**
Type: `(props: ParentProps<'div'>) => Element`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
#### Data Attributes
**`data-scope`**: steps
**`data-part`**: list
**`data-orientation`**: The orientation of the list
### NextTrigger
#### Props
**`asChild`**
Type: `(props: ParentProps<'button'>) => Element`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
### PrevTrigger
#### Props
**`asChild`**
Type: `(props: ParentProps<'button'>) => Element`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
### Progress
#### Props
**`asChild`**
Type: `(props: ParentProps<'div'>) => Element`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
#### Data Attributes
**`data-scope`**: steps
**`data-part`**: progress
**`data-complete`**: Present when the progress value is complete
### RootProvider
#### Props
**`value`**
Type: `UseStepsReturn`
Required: true
Default Value: `undefined`
Description: undefined
**`asChild`**
Type: `(props: ParentProps<'div'>) => Element`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
### Separator
#### Props
**`asChild`**
Type: `(props: ParentProps<'div'>) => Element`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
#### Data Attributes
**`data-scope`**: steps
**`data-part`**: separator
**`data-orientation`**: The orientation of the separator
**`data-complete`**: Present when the separator value is complete
**`data-current`**: Present when current
**`data-incomplete`**:
### Trigger
#### Props
**`asChild`**
Type: `(props: ParentProps<'button'>) => Element`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
#### Data Attributes
**`data-scope`**: steps
**`data-part`**: trigger
**`data-state`**: "open" | "closed"
**`data-orientation`**: The orientation of the trigger
**`data-complete`**: Present when the trigger value is complete
**`data-current`**: Present when current
**`data-incomplete`**:
# Steps (VUE)
## Usage
The `Steps` component is used to guide users through a series of steps in a process.
- Supports horizontal and vertical orientations.
- Support for changing the active step with the keyboard and pointer.
- Support for linear and non-linear steps.
```jsx
import { Steps } from '@ark-ui/react/steps'
```
## Examples
### Basic
Here's a basic example of the `Steps` component.
```vue
{{ index + 1 }}{{ item.title }}
{{ item.title }} - {{ item.description }}
Steps Complete - Thank you for filling out the form!
BackNext
```
### Using the Root Provider
The `RootProvider` component provides a context for the steps. It accepts the value of the `useSteps` hook. You can
leverage it to access the component state and methods from outside the steps.
```vue
{{ index + 1 }}{{ item.title }}
{{ item.title }} - {{ item.description }}
Steps Complete - Thank you for filling out the form!
BackNext
```
> If you're using the `RootProvider` component, you don't need to use the `Root` component.
## API Reference
### Root
#### Props
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
**`count`**
Type: `number`
Required: false
Default Value: `undefined`
Description: The total number of steps
**`defaultStep`**
Type: `number`
Required: false
Default Value: `undefined`
Description: The initial value of the stepper when rendered.
Use when you don't need to control the value of the stepper.
**`id`**
Type: `string`
Required: false
Default Value: `undefined`
Description: The unique identifier of the machine.
**`ids`**
Type: `ElementIds`
Required: false
Default Value: `undefined`
Description: The custom ids for the stepper elements
**`linear`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: If `true`, the stepper requires the user to complete the steps in order
**`orientation`**
Type: `'horizontal' | 'vertical'`
Required: false
Default Value: `"horizontal"`
Description: The orientation of the stepper
**`step`**
Type: `number`
Required: false
Default Value: `undefined`
Description: The controlled value of the stepper
#### Data Attributes
**`data-scope`**: steps
**`data-part`**: root
**`data-orientation`**: The orientation of the steps
### CompletedContent
#### Props
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
### Content
#### Props
**`index`**
Type: `number`
Required: true
Default Value: `undefined`
Description: undefined
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
#### Data Attributes
**`data-scope`**: steps
**`data-part`**: content
**`data-state`**: "open" | "closed"
**`data-orientation`**: The orientation of the content
### Indicator
#### Props
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
#### Data Attributes
**`data-scope`**: steps
**`data-part`**: indicator
**`data-complete`**: Present when the indicator value is complete
**`data-current`**: Present when current
**`data-incomplete`**:
### Item
#### Props
**`index`**
Type: `number`
Required: true
Default Value: `undefined`
Description: undefined
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
#### Data Attributes
**`data-scope`**: steps
**`data-part`**: item
**`data-orientation`**: The orientation of the item
### List
#### Props
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
#### Data Attributes
**`data-scope`**: steps
**`data-part`**: list
**`data-orientation`**: The orientation of the list
### NextTrigger
#### Props
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
### PrevTrigger
#### Props
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
### Progress
#### Props
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
#### Data Attributes
**`data-scope`**: steps
**`data-part`**: progress
**`data-complete`**: Present when the progress value is complete
### RootProvider
#### Props
**`value`**
Type: `StepsApi`
Required: true
Default Value: `undefined`
Description: undefined
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
### Separator
#### Props
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
#### Data Attributes
**`data-scope`**: steps
**`data-part`**: separator
**`data-orientation`**: The orientation of the separator
**`data-complete`**: Present when the separator value is complete
**`data-current`**: Present when current
**`data-incomplete`**:
### Trigger
#### Props
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
#### Data Attributes
**`data-scope`**: steps
**`data-part`**: trigger
**`data-state`**: "open" | "closed"
**`data-orientation`**: The orientation of the trigger
**`data-complete`**: Present when the trigger value is complete
**`data-current`**: Present when current
**`data-incomplete`**:
# Switch (REACT)
## Anatomy
To set up the switch correctly, you'll need to understand its anatomy and how we name its parts.
> Each part includes a `data-part` attribute to help identify them in the DOM.
### Design impact on the asChild property
The `Switch.Root` element of the switch is a `label` element. This is because the switch is a form control and should be
associated with a label to provide context and meaning to the user. Otherwise, the HTML and accessibility structure will
be invalid.
> If you need to use the `asChild` property, make sure that the `label` element is the direct child of the `Switch.Root`
> component.
## Examples
Learn how to use the `Switch` component in your project. Let's take a look at the most basic example:
```tsx
import { Switch } from '@ark-ui/react/switch'
export const Basic = () => (
Label
)
```
### Controlled Switch
For a controlled Switch component, the state of the toggle is managed using the checked prop, and updates when the
`onCheckedChange` event handler is called:
```tsx
import { Switch } from '@ark-ui/react/switch'
import { useState } from 'react'
export const Controlled = () => {
const [checked, setChecked] = useState(false)
return (
setChecked(e.checked)}>
Label
)
}
```
### Render Prop Usage
The Switch component also allows for a render prop, granting direct access to its internal state. This enables you to
dynamically adjust and customize aspects of the component based on its current state:
```tsx
import { Switch } from '@ark-ui/react/switch'
export const RenderProp = () => (
{(context) => Feature is {context.checked ? 'enabled' : 'disabled'}}
)
```
### Using the Field Component
The `Field` component helps manage form-related state and accessibility attributes of a switch. It includes handling
ARIA labels, helper text, and error text to ensure proper accessibility.
```tsx
import { Field } from '@ark-ui/react/field'
import { Switch } from '@ark-ui/react/switch'
export const WithField = (props: Field.RootProps) => (
LabelAdditional InfoError Info
)
```
### Using the Root Provider
The `RootProvider` component provides a context for the switch. It accepts the value of the `useSwitch` hook. You can
leverage it to access the component state and methods from outside the switch.
```tsx
import { Switch, useSwitch } from '@ark-ui/react/switch'
export const RootProvider = () => {
const switchApi = useSwitch()
return (
<>
Label
>
)
}
```
> If you're using the `RootProvider` component, you don't need to use the `Root` component.
## API Reference
### Root
#### Props
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
**`checked`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: The controlled checked state of the switch
**`disabled`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Whether the switch is disabled.
**`ids`**
Type: `Partial<{ root: string; hiddenInput: string; control: string; label: string; thumb: string }>`
Required: false
Default Value: `undefined`
Description: The ids of the elements in the switch. Useful for composition.
**`invalid`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: If `true`, the switch is marked as invalid.
**`label`**
Type: `string`
Required: false
Default Value: `undefined`
Description: Specifies the localized strings that identifies the accessibility elements and their states
**`name`**
Type: `string`
Required: false
Default Value: `undefined`
Description: The name of the input field in a switch
(Useful for form submission).
**`onCheckedChange`**
Type: `(details: CheckedChangeDetails) => void`
Required: false
Default Value: `undefined`
Description: Function to call when the switch is clicked.
**`readOnly`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Whether the switch is read-only
**`required`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: If `true`, the switch input is marked as required,
**`value`**
Type: `string | number`
Required: false
Default Value: `"on"`
Description: The value of switch input. Useful for form submission.
#### Data Attributes
**`data-active`**: Present when active or pressed
**`data-focus`**: Present when focused
**`data-focus-visible`**: Present when focused with keyboard
**`data-readonly`**: Present when read-only
**`data-hover`**: Present when hovered
**`data-disabled`**: Present when disabled
**`data-state`**: "checked" | "unchecked"
**`data-invalid`**: Present when invalid
### Control
#### Props
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
#### Data Attributes
**`data-active`**: Present when active or pressed
**`data-focus`**: Present when focused
**`data-focus-visible`**: Present when focused with keyboard
**`data-readonly`**: Present when read-only
**`data-hover`**: Present when hovered
**`data-disabled`**: Present when disabled
**`data-state`**: "checked" | "unchecked"
**`data-invalid`**: Present when invalid
### HiddenInput
#### Props
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
### Label
#### Props
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
#### Data Attributes
**`data-active`**: Present when active or pressed
**`data-focus`**: Present when focused
**`data-focus-visible`**: Present when focused with keyboard
**`data-readonly`**: Present when read-only
**`data-hover`**: Present when hovered
**`data-disabled`**: Present when disabled
**`data-state`**: "checked" | "unchecked"
**`data-invalid`**: Present when invalid
### RootProvider
#### Props
**`value`**
Type: `UseSwitchReturn`
Required: true
Default Value: `undefined`
Description: undefined
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
### Thumb
#### Props
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
#### Data Attributes
**`data-active`**: Present when active or pressed
**`data-focus`**: Present when focused
**`data-focus-visible`**: Present when focused with keyboard
**`data-readonly`**: Present when read-only
**`data-hover`**: Present when hovered
**`data-disabled`**: Present when disabled
**`data-state`**: "checked" | "unchecked"
**`data-invalid`**: Present when invalid
## Accessibility
Complies with the [Switch WAI-ARIA design pattern](https://www.w3.org/WAI/ARIA/apg/patterns/switch/).
### Keyboard Support
**`Space + Enter`**
Description: Toggle the switch
# Switch (SOLID)
## Anatomy
To set up the switch correctly, you'll need to understand its anatomy and how we name its parts.
> Each part includes a `data-part` attribute to help identify them in the DOM.
### Design impact on the asChild property
The `Switch.Root` element of the switch is a `label` element. This is because the switch is a form control and should be
associated with a label to provide context and meaning to the user. Otherwise, the HTML and accessibility structure will
be invalid.
> If you need to use the `asChild` property, make sure that the `label` element is the direct child of the `Switch.Root`
> component.
## Examples
Learn how to use the `Switch` component in your project. Let's take a look at the most basic example:
```tsx
import { Switch } from '@ark-ui/solid/switch'
export const Basic = () => (
Label
)
```
### Controlled Switch
For a controlled Switch component, the state of the toggle is managed using the checked prop, and updates when the
`onCheckedChange` event handler is called:
```tsx
import { Switch } from '@ark-ui/solid/switch'
import { createSignal } from 'solid-js'
export const Controlled = () => {
const [checked, setChecked] = createSignal(false)
return (
setChecked(e.checked)}>
Label
)
}
```
### Render Prop Usage
The Switch component also allows for a render prop, granting direct access to its internal state. This enables you to
dynamically adjust and customize aspects of the component based on its current state:
```tsx
import { Switch } from '@ark-ui/solid/switch'
export const RenderProp = () => (
{(context) => Feature is {context().checked ? 'enabled' : 'disabled'}}
)
```
### Using the Field Component
The `Field` component helps manage form-related state and accessibility attributes of a switch. It includes handling
ARIA labels, helper text, and error text to ensure proper accessibility.
```tsx
import { Field } from '@ark-ui/solid/field'
import { Switch } from '@ark-ui/solid/switch'
export const WithField = (props: Field.RootProps) => (
LabelAdditional InfoError Info
)
```
### Using the Root Provider
The `RootProvider` component provides a context for the switch. It accepts the value of the `useSwitch` hook. You can
leverage it to access the component state and methods from outside the switch.
```tsx
import { Switch, useSwitch } from '@ark-ui/solid/switch'
export const RootProvider = () => {
const switchApi = useSwitch()
return (
<>
Label
>
)
}
```
> If you're using the `RootProvider` component, you don't need to use the `Root` component.
## API Reference
### Root
#### Props
**`asChild`**
Type: `(props: ParentProps<'label'>) => Element`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
**`checked`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: The controlled checked state of the switch
**`defaultChecked`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: The initial checked state of the switch when rendered.
Use when you don't need to control the checked state of the switch.
**`disabled`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Whether the switch is disabled.
**`ids`**
Type: `Partial<{ root: string; hiddenInput: string; control: string; label: string; thumb: string }>`
Required: false
Default Value: `undefined`
Description: The ids of the elements in the switch. Useful for composition.
**`invalid`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: If `true`, the switch is marked as invalid.
**`label`**
Type: `string`
Required: false
Default Value: `undefined`
Description: Specifies the localized strings that identifies the accessibility elements and their states
**`name`**
Type: `string`
Required: false
Default Value: `undefined`
Description: The name of the input field in a switch
(Useful for form submission).
**`onCheckedChange`**
Type: `(details: CheckedChangeDetails) => void`
Required: false
Default Value: `undefined`
Description: Function to call when the switch is clicked.
**`readOnly`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Whether the switch is read-only
**`required`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: If `true`, the switch input is marked as required,
**`value`**
Type: `string | number`
Required: false
Default Value: `"on"`
Description: The value of switch input. Useful for form submission.
#### Data Attributes
**`data-active`**: Present when active or pressed
**`data-focus`**: Present when focused
**`data-focus-visible`**: Present when focused with keyboard
**`data-readonly`**: Present when read-only
**`data-hover`**: Present when hovered
**`data-disabled`**: Present when disabled
**`data-state`**: "checked" | "unchecked"
**`data-invalid`**: Present when invalid
### Control
#### Props
**`asChild`**
Type: `(props: ParentProps<'span'>) => Element`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
#### Data Attributes
**`data-active`**: Present when active or pressed
**`data-focus`**: Present when focused
**`data-focus-visible`**: Present when focused with keyboard
**`data-readonly`**: Present when read-only
**`data-hover`**: Present when hovered
**`data-disabled`**: Present when disabled
**`data-state`**: "checked" | "unchecked"
**`data-invalid`**: Present when invalid
### HiddenInput
#### Props
**`asChild`**
Type: `(props: ParentProps<'input'>) => Element`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
### Label
#### Props
**`asChild`**
Type: `(props: ParentProps<'span'>) => Element`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
#### Data Attributes
**`data-active`**: Present when active or pressed
**`data-focus`**: Present when focused
**`data-focus-visible`**: Present when focused with keyboard
**`data-readonly`**: Present when read-only
**`data-hover`**: Present when hovered
**`data-disabled`**: Present when disabled
**`data-state`**: "checked" | "unchecked"
**`data-invalid`**: Present when invalid
### RootProvider
#### Props
**`value`**
Type: `UseSwitchReturn`
Required: true
Default Value: `undefined`
Description: undefined
**`asChild`**
Type: `(props: ParentProps<'label'>) => Element`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
### Thumb
#### Props
**`asChild`**
Type: `(props: ParentProps<'span'>) => Element`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
#### Data Attributes
**`data-active`**: Present when active or pressed
**`data-focus`**: Present when focused
**`data-focus-visible`**: Present when focused with keyboard
**`data-readonly`**: Present when read-only
**`data-hover`**: Present when hovered
**`data-disabled`**: Present when disabled
**`data-state`**: "checked" | "unchecked"
**`data-invalid`**: Present when invalid
## Accessibility
Complies with the [Switch WAI-ARIA design pattern](https://www.w3.org/WAI/ARIA/apg/patterns/switch/).
### Keyboard Support
**`Space + Enter`**
Description: Toggle the switch
# Switch (VUE)
## Anatomy
To set up the switch correctly, you'll need to understand its anatomy and how we name its parts.
> Each part includes a `data-part` attribute to help identify them in the DOM.
### Design impact on the asChild property
The `Switch.Root` element of the switch is a `label` element. This is because the switch is a form control and should be
associated with a label to provide context and meaning to the user. Otherwise, the HTML and accessibility structure will
be invalid.
> If you need to use the `asChild` property, make sure that the `label` element is the direct child of the `Switch.Root`
> component.
## Examples
Learn how to use the `Switch` component in your project. Let's take a look at the most basic example:
```vue
Label
```
### Controlled Switch
For a controlled Switch component, the state of the toggle is managed using the checked prop, and updates when the
`onCheckedChange` event handler is called:
```vue
Label
```
### Render Prop Usage
The Switch component also allows for a render prop, granting direct access to its internal state. This enables you to
dynamically adjust and customize aspects of the component based on its current state:
```vue
Feature is {{ api.checked ? 'enabled' : 'disabled' }}
```
### Using the Field Component
The `Field` component helps manage form-related state and accessibility attributes of a switch. It includes handling
ARIA labels, helper text, and error text to ensure proper accessibility.
```vue
LabelAdditional InfoError Info
```
### Using the Root Provider
The `RootProvider` component provides a context for the switch. It accepts the value of the `useSwitch` hook. You can
leverage it to access the component state and methods from outside the switch.
```vue
Label
```
> If you're using the `RootProvider` component, you don't need to use the `Root` component.
## API Reference
### Root
#### Props
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
**`checked`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: The controlled checked state of the switch
**`defaultChecked`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: The initial checked state of the switch when rendered.
Use when you don't need to control the checked state of the switch.
**`disabled`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Whether the switch is disabled.
**`form`**
Type: `string`
Required: false
Default Value: `undefined`
Description: The id of the form that the switch belongs to
**`id`**
Type: `string`
Required: false
Default Value: `undefined`
Description: The unique identifier of the machine.
**`ids`**
Type: `Partial<{ root: string; hiddenInput: string; control: string; label: string; thumb: string }>`
Required: false
Default Value: `undefined`
Description: The ids of the elements in the switch. Useful for composition.
**`invalid`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: If `true`, the switch is marked as invalid.
**`label`**
Type: `string`
Required: false
Default Value: `undefined`
Description: Specifies the localized strings that identifies the accessibility elements and their states
**`name`**
Type: `string`
Required: false
Default Value: `undefined`
Description: The name of the input field in a switch
(Useful for form submission).
**`readOnly`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Whether the switch is read-only
**`required`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: If `true`, the switch input is marked as required,
**`value`**
Type: `string`
Required: false
Default Value: `"on"`
Description: The value of checkbox input. Useful for form submission.
#### Emits
**`checkedChange`**
Type: `[details: CheckedChangeDetails]`
Description: Function to call when the switch is clicked.
**`update:checked`**
Type: `[checked: boolean]`
Description: The callback fired when the model value changes.
#### Data Attributes
**`data-active`**: Present when active or pressed
**`data-focus`**: Present when focused
**`data-focus-visible`**: Present when focused with keyboard
**`data-readonly`**: Present when read-only
**`data-hover`**: Present when hovered
**`data-disabled`**: Present when disabled
**`data-state`**: "checked" | "unchecked"
**`data-invalid`**: Present when invalid
### Control
#### Props
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
#### Data Attributes
**`data-active`**: Present when active or pressed
**`data-focus`**: Present when focused
**`data-focus-visible`**: Present when focused with keyboard
**`data-readonly`**: Present when read-only
**`data-hover`**: Present when hovered
**`data-disabled`**: Present when disabled
**`data-state`**: "checked" | "unchecked"
**`data-invalid`**: Present when invalid
### HiddenInput
#### Props
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
### Label
#### Props
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
#### Data Attributes
**`data-active`**: Present when active or pressed
**`data-focus`**: Present when focused
**`data-focus-visible`**: Present when focused with keyboard
**`data-readonly`**: Present when read-only
**`data-hover`**: Present when hovered
**`data-disabled`**: Present when disabled
**`data-state`**: "checked" | "unchecked"
**`data-invalid`**: Present when invalid
### RootProvider
#### Props
**`value`**
Type: `SwitchApi`
Required: true
Default Value: `undefined`
Description: undefined
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
### Thumb
#### Props
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
#### Data Attributes
**`data-active`**: Present when active or pressed
**`data-focus`**: Present when focused
**`data-focus-visible`**: Present when focused with keyboard
**`data-readonly`**: Present when read-only
**`data-hover`**: Present when hovered
**`data-disabled`**: Present when disabled
**`data-state`**: "checked" | "unchecked"
**`data-invalid`**: Present when invalid
## Accessibility
Complies with the [Switch WAI-ARIA design pattern](https://www.w3.org/WAI/ARIA/apg/patterns/switch/).
### Keyboard Support
**`Space + Enter`**
Description: Toggle the switch
# Tabs (REACT)
## Anatomy
To set up the tabs correctly, you'll need to understand its anatomy and how we name its parts.
> Each part includes a `data-part` attribute to help identify them in the DOM.
## Examples
Learn how to use the `Tabs` component in your project. Let's take a look at the most basic example:
```tsx
import { Tabs } from '@ark-ui/react/tabs'
export const Basic = () => (
ReactVueSolidReact ContentVue ContentSolid Content
)
```
### Initial Tab
To set a default tab on initial render, use the `defaultValue` prop:
```tsx
import { Tabs } from '@ark-ui/react/tabs'
export const InitialTab = () => (
ReactVueSolidReact ContentVue ContentSolid Content
)
```
### Tab Indicator
To provide a visual cue for the selected tab, use the `Tabs.Indicator` component:
```tsx
import { Tabs } from '@ark-ui/react/tabs'
export const Indicator = () => (
ReactVueSolidReact ContentVue ContentSolid Content
)
```
### Lazy Mounting
Lazy mounting is a feature that allows the content of a tab to be rendered only when the tab is first activated. This is
useful for performance optimization, especially when tab content is large or complex. To enable lazy mounting, use the
`lazyMount` prop on the `Tabs.Content` component.
In addition, the `unmountOnExit` prop can be used in conjunction with `lazyMount` to unmount the tab content when the
tab is deactivated, freeing up resources. The next time the tab is activated, its content will be re-rendered.
```tsx
import { Tabs } from '@ark-ui/react/tabs'
export const LazyMount = () => (
ReactVueSolidReact ContentVue ContentSolid Content
)
```
### Disabled Tab
To disable a tab, simply pass the `disabled` prop to the `Tabs.Trigger` component:
```tsx
import { Tabs } from '@ark-ui/react/tabs'
export const DisabledTab = () => (
React
Vue
SolidReact ContentVue ContentSolid Content
)
```
### Controlled Tabs
To create a controlled Tabs component, manage the current selected tab using the `value` prop and update it when the
`onValueChange` event handler is called:
```tsx
import { Tabs } from '@ark-ui/react/tabs'
import { useState } from 'react'
export const Controlled = () => {
const [value, setValue] = useState('react')
return (
setValue(e.value)}>
ReactVueSolidReact ContentVue ContentSolid Content
)
}
```
### Router Controlled Tabs
When using frameworks like Next.js, Remix, or React Router, controlling the active tabs based on the URL can be useful.
To achieve this, you need to do two things:
- Set the `value` prop to the current URL path.
- Listen to the `onValueChange` event and update the URL path.
Here's an example using Remix Router
```tsx
import { Tabs } from '@ark-ui/react/tabs'
import { useLocation, useNavigate, Link } from '@remix-run/react'
export default function App() {
const { pathname } = useLocation()
const navigate = useNavigate()
const lastPathFragment = pathname.substring(pathname.lastIndexOf('/') + 1)
const activeTab = lastPathFragment.length > 0 ? lastPathFragment : 'homepage'
return (
{
navigate(`/${value === 'home' ? '' : value}`)
}}
>
Home
Page 1
Page 2
)
}
```
### Vertical Tabs
The default orientation of the tabs is `horizontal`. To change the orientation, set the `orientation` prop to
`vertical`.
```tsx
import { Tabs } from '@ark-ui/react/tabs'
export const Vertical = () => (
ReactVueSolidReact ContentVue ContentSolid Content
)
```
### Manual Activation
By default, the tab can be selected when it receives focus from either the keyboard or pointer interaction. This is
called automatic tab activation.
In contrast, manual tab activation means the tab is selected with the
Enter key or by clicking on the tab.
```tsx
import { Tabs } from '@ark-ui/react/tabs'
export const Manual = () => (
ReactVueSolidReact ContentVue ContentSolid Content
)
```
### Using the Root Provider
The `RootProvider` component provides a context for the tabs. It accepts the value of the `useTabs` hook. You can
leverage it to access the component state and methods from outside the tabs.
```tsx
import { Tabs, useTabs } from '@ark-ui/react/tabs'
export const RootProvider = () => {
const tabs = useTabs()
return (
<>
ReactVueSolidReact ContentVue ContentSolid Content
>
)
}
```
> If you're using the `RootProvider` component, you don't need to use the `Root` component.
## API Reference
### Root
#### Props
**`activationMode`**
Type: `'manual' | 'automatic'`
Required: false
Default Value: `"automatic"`
Description: The activation mode of the tabs. Can be `manual` or `automatic`
- `manual`: Tabs are activated when clicked or press `enter` key.
- `automatic`: Tabs are activated when receiving focus
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
**`composite`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Whether the tab is composite
**`defaultValue`**
Type: `string`
Required: false
Default Value: `undefined`
Description: The initial selected tab value when rendered.
Use when you don't need to control the selected tab value.
**`deselectable`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Whether the active tab can be deselected when clicking on it.
**`id`**
Type: `string`
Required: false
Default Value: `undefined`
Description: The unique identifier of the machine.
**`ids`**
Type: `Partial<{ root: string; trigger: string; list: string; content: string; indicator: string }>`
Required: false
Default Value: `undefined`
Description: The ids of the elements in the tabs. Useful for composition.
**`lazyMount`**
Type: `boolean`
Required: false
Default Value: `false`
Description: Whether to enable lazy mounting
**`loopFocus`**
Type: `boolean`
Required: false
Default Value: `true`
Description: Whether the keyboard navigation will loop from last tab to first, and vice versa.
**`navigate`**
Type: `(details: NavigateDetails) => void`
Required: false
Default Value: `undefined`
Description: Function to navigate to the selected tab when clicking on it.
Useful if tab triggers are anchor elements.
**`onFocusChange`**
Type: `(details: FocusChangeDetails) => void`
Required: false
Default Value: `undefined`
Description: Callback to be called when the focused tab changes
**`onValueChange`**
Type: `(details: ValueChangeDetails) => void`
Required: false
Default Value: `undefined`
Description: Callback to be called when the selected/active tab changes
**`orientation`**
Type: `'horizontal' | 'vertical'`
Required: false
Default Value: `"horizontal"`
Description: The orientation of the tabs. Can be `horizontal` or `vertical`
- `horizontal`: only left and right arrow key navigation will work.
- `vertical`: only up and down arrow key navigation will work.
**`translations`**
Type: `IntlTranslations`
Required: false
Default Value: `undefined`
Description: Specifies the localized strings that identifies the accessibility elements and their states
**`unmountOnExit`**
Type: `boolean`
Required: false
Default Value: `false`
Description: Whether to unmount on exit.
**`value`**
Type: `string`
Required: false
Default Value: `undefined`
Description: The controlled selected tab value
#### Data Attributes
**`data-scope`**: tabs
**`data-part`**: root
**`data-orientation`**: The orientation of the tabs
**`data-focus`**: Present when focused
### TabContent
#### Props
**`value`**
Type: `string`
Required: true
Default Value: `undefined`
Description: The value of the tab
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
### TabIndicator
#### Props
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
### TabList
#### Props
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
### TabTrigger
#### Props
**`value`**
Type: `string`
Required: true
Default Value: `undefined`
Description: The value of the tab
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
**`disabled`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Whether the tab is disabled
### RootProvider
#### Props
**`value`**
Type: `UseTabsReturn`
Required: true
Default Value: `undefined`
Description: undefined
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
**`lazyMount`**
Type: `boolean`
Required: false
Default Value: `false`
Description: Whether to enable lazy mounting
**`unmountOnExit`**
Type: `boolean`
Required: false
Default Value: `false`
Description: Whether to unmount on exit.
## Accessibility
Complies with the [Tabs WAI-ARIA design pattern](https://www.w3.org/WAI/ARIA/apg/patterns/tabs/).
### Keyboard Support
**`Tab`**
Description: When focus moves onto the tabs, focuses the active trigger. When a trigger is focused, moves focus to the active content.
**`ArrowDown`**
Description: Moves focus to the next trigger in vertical orientation and activates its associated content.
**`ArrowRight`**
Description: Moves focus to the next trigger in horizontal orientation and activates its associated content.
**`ArrowUp`**
Description: Moves focus to the previous trigger in vertical orientation and activates its associated content.
**`ArrowLeft`**
Description: Moves focus to the previous trigger in horizontal orientation and activates its associated content.
**`Home`**
Description: Moves focus to the first trigger and activates its associated content.
**`End`**
Description: Moves focus to the last trigger and activates its associated content.
**`Enter + Space`**
Description: In manual mode, when a trigger is focused, moves focus to its associated content.
# Tabs (SOLID)
## Anatomy
To set up the tabs correctly, you'll need to understand its anatomy and how we name its parts.
> Each part includes a `data-part` attribute to help identify them in the DOM.
## Examples
Learn how to use the `Tabs` component in your project. Let's take a look at the most basic example:
```tsx
import { Tabs } from '@ark-ui/solid/tabs'
export const Basic = () => (
ReactVueSolidReact ContentVue ContentSolid Content
)
```
### Initial Tab
To set a default tab on initial render, use the `defaultValue` prop:
```tsx
import { Tabs } from '@ark-ui/solid/tabs'
export const InitialTab = () => (
ReactVueSolidReact ContentVue ContentSolid Content
)
```
### Tab Indicator
To provide a visual cue for the selected tab, use the `Tabs.Indicator` component:
```tsx
import { Tabs } from '@ark-ui/solid/tabs'
export const Indicator = () => (
ReactVueSolidReact ContentVue ContentSolid Content
)
```
### Lazy Mounting
Lazy mounting is a feature that allows the content of a tab to be rendered only when the tab is first activated. This is
useful for performance optimization, especially when tab content is large or complex. To enable lazy mounting, use the
`lazyMount` prop on the `Tabs.Content` component.
In addition, the `unmountOnExit` prop can be used in conjunction with `lazyMount` to unmount the tab content when the
tab is deactivated, freeing up resources. The next time the tab is activated, its content will be re-rendered.
```tsx
import { Tabs } from '@ark-ui/solid/tabs'
export const LazyMount = () => (
ReactVueSolidReact ContentVue ContentSolid Content
)
```
### Disabled Tab
To disable a tab, simply pass the `disabled` prop to the `Tabs.Trigger` component:
```tsx
import { Tabs } from '@ark-ui/solid/tabs'
export const DisabledTab = () => (
React
Vue
SolidReact ContentVue ContentSolid Content
)
```
### Controlled Tabs
To create a controlled Tabs component, manage the current selected tab using the `value` prop and update it when the
`onValueChange` event handler is called:
```tsx
import { Tabs } from '@ark-ui/solid/tabs'
import { createSignal } from 'solid-js'
export const Controlled = () => {
const [value, setValue] = createSignal('react')
return (
setValue(e.value)}>
ReactVueSolidReact ContentVue ContentSolid Content
)
}
```
### Router Controlled Tabs
When using frameworks like Next.js, Remix, or React Router, controlling the active tabs based on the URL can be useful.
To achieve this, you need to do two things:
- Set the `value` prop to the current URL path.
- Listen to the `onValueChange` event and update the URL path.
Here's an example using Remix Router
```tsx
import { Tabs } from '@ark-ui/react/tabs'
import { useLocation, useNavigate, Link } from '@remix-run/react'
export default function App() {
const { pathname } = useLocation()
const navigate = useNavigate()
const lastPathFragment = pathname.substring(pathname.lastIndexOf('/') + 1)
const activeTab = lastPathFragment.length > 0 ? lastPathFragment : 'homepage'
return (
{
navigate(`/${value === 'home' ? '' : value}`)
}}
>
Home
Page 1
Page 2
)
}
```
### Vertical Tabs
The default orientation of the tabs is `horizontal`. To change the orientation, set the `orientation` prop to
`vertical`.
```tsx
import { Tabs } from '@ark-ui/solid/tabs'
export const Vertical = () => (
ReactVueSolidReact ContentVue ContentSolid Content
)
```
### Manual Activation
By default, the tab can be selected when it receives focus from either the keyboard or pointer interaction. This is
called automatic tab activation.
In contrast, manual tab activation means the tab is selected with the
Enter key or by clicking on the tab.
```tsx
import { Tabs } from '@ark-ui/solid/tabs'
export const Manual = () => (
ReactVueSolidReact ContentVue ContentSolid Content
)
```
### Using the Root Provider
The `RootProvider` component provides a context for the tabs. It accepts the value of the `useTabs` hook. You can
leverage it to access the component state and methods from outside the tabs.
```tsx
import { Tabs, useTabs } from '@ark-ui/solid/tabs'
export const RootProvider = () => {
const tabs = useTabs()
return (
<>
ReactVueSolidReact ContentVue ContentSolid Content
>
)
}
```
> If you're using the `RootProvider` component, you don't need to use the `Root` component.
## API Reference
### Root
#### Props
**`activationMode`**
Type: `'manual' | 'automatic'`
Required: false
Default Value: `"automatic"`
Description: The activation mode of the tabs. Can be `manual` or `automatic`
- `manual`: Tabs are activated when clicked or press `enter` key.
- `automatic`: Tabs are activated when receiving focus
**`asChild`**
Type: `(props: ParentProps<'div'>) => Element`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
**`composite`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Whether the tab is composite
**`defaultValue`**
Type: `string`
Required: false
Default Value: `undefined`
Description: The initial selected tab value when rendered.
Use when you don't need to control the selected tab value.
**`deselectable`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Whether the active tab can be deselected when clicking on it.
**`ids`**
Type: `Partial<{ root: string; trigger: string; list: string; content: string; indicator: string }>`
Required: false
Default Value: `undefined`
Description: The ids of the elements in the tabs. Useful for composition.
**`lazyMount`**
Type: `boolean`
Required: false
Default Value: `false`
Description: Whether to enable lazy mounting
**`loopFocus`**
Type: `boolean`
Required: false
Default Value: `true`
Description: Whether the keyboard navigation will loop from last tab to first, and vice versa.
**`navigate`**
Type: `(details: NavigateDetails) => void`
Required: false
Default Value: `undefined`
Description: Function to navigate to the selected tab when clicking on it.
Useful if tab triggers are anchor elements.
**`onFocusChange`**
Type: `(details: FocusChangeDetails) => void`
Required: false
Default Value: `undefined`
Description: Callback to be called when the focused tab changes
**`onValueChange`**
Type: `(details: ValueChangeDetails) => void`
Required: false
Default Value: `undefined`
Description: Callback to be called when the selected/active tab changes
**`orientation`**
Type: `'horizontal' | 'vertical'`
Required: false
Default Value: `"horizontal"`
Description: The orientation of the tabs. Can be `horizontal` or `vertical`
- `horizontal`: only left and right arrow key navigation will work.
- `vertical`: only up and down arrow key navigation will work.
**`translations`**
Type: `IntlTranslations`
Required: false
Default Value: `undefined`
Description: Specifies the localized strings that identifies the accessibility elements and their states
**`unmountOnExit`**
Type: `boolean`
Required: false
Default Value: `false`
Description: Whether to unmount on exit.
**`value`**
Type: `string`
Required: false
Default Value: `undefined`
Description: The controlled selected tab value
#### Data Attributes
**`data-scope`**: tabs
**`data-part`**: root
**`data-orientation`**: The orientation of the tabs
**`data-focus`**: Present when focused
### TabContent
#### Props
**`value`**
Type: `string`
Required: true
Default Value: `undefined`
Description: The value of the tab
**`asChild`**
Type: `(props: ParentProps<'div'>) => Element`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
### TabIndicator
#### Props
**`asChild`**
Type: `(props: ParentProps<'div'>) => Element`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
### TabList
#### Props
**`asChild`**
Type: `(props: ParentProps<'div'>) => Element`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
### TabTrigger
#### Props
**`value`**
Type: `string`
Required: true
Default Value: `undefined`
Description: The value of the tab
**`asChild`**
Type: `(props: ParentProps<'button'>) => Element`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
**`disabled`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Whether the tab is disabled
### RootProvider
#### Props
**`value`**
Type: `UseTabsReturn`
Required: true
Default Value: `undefined`
Description: undefined
**`asChild`**
Type: `(props: ParentProps<'div'>) => Element`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
**`lazyMount`**
Type: `boolean`
Required: false
Default Value: `false`
Description: Whether to enable lazy mounting
**`unmountOnExit`**
Type: `boolean`
Required: false
Default Value: `false`
Description: Whether to unmount on exit.
## Accessibility
Complies with the [Tabs WAI-ARIA design pattern](https://www.w3.org/WAI/ARIA/apg/patterns/tabs/).
### Keyboard Support
**`Tab`**
Description: When focus moves onto the tabs, focuses the active trigger. When a trigger is focused, moves focus to the active content.
**`ArrowDown`**
Description: Moves focus to the next trigger in vertical orientation and activates its associated content.
**`ArrowRight`**
Description: Moves focus to the next trigger in horizontal orientation and activates its associated content.
**`ArrowUp`**
Description: Moves focus to the previous trigger in vertical orientation and activates its associated content.
**`ArrowLeft`**
Description: Moves focus to the previous trigger in horizontal orientation and activates its associated content.
**`Home`**
Description: Moves focus to the first trigger and activates its associated content.
**`End`**
Description: Moves focus to the last trigger and activates its associated content.
**`Enter + Space`**
Description: In manual mode, when a trigger is focused, moves focus to its associated content.
# Tabs (VUE)
## Anatomy
To set up the tabs correctly, you'll need to understand its anatomy and how we name its parts.
> Each part includes a `data-part` attribute to help identify them in the DOM.
## Examples
Learn how to use the `Tabs` component in your project. Let's take a look at the most basic example:
```vue
ReactVueSolidReact ContentVue ContentSolid Content
```
### Initial Tab
To set a default tab on initial render, use the `defaultValue` prop:
```vue
ReactVueSolidReact ContentVue ContentSolid Content
```
### Tab Indicator
To provide a visual cue for the selected tab, use the `Tabs.Indicator` component:
```vue
ReactVueSolidReact ContentVue ContentSolid Content
```
### Lazy Mounting
Lazy mounting is a feature that allows the content of a tab to be rendered only when the tab is first activated. This is
useful for performance optimization, especially when tab content is large or complex. To enable lazy mounting, use the
`lazyMount` prop on the `Tabs.Content` component.
In addition, the `unmountOnExit` prop can be used in conjunction with `lazyMount` to unmount the tab content when the
tab is deactivated, freeing up resources. The next time the tab is activated, its content will be re-rendered.
```vue
ReactVueSolidReact ContentVue ContentSolid Content
```
### Disabled Tab
To disable a tab, simply pass the `disabled` prop to the `Tabs.Trigger` component:
```vue
ReactVueSolidReact ContentVue ContentSolid Content
```
### Controlled Tabs
To create a controlled Tabs component, manage the current selected tab using the `value` prop and update it when the
`onValueChange` event handler is called:
```vue
Selected tab: {{ value }}
ReactVueSolidReact ContentVue ContentSolid Content
```
### Router Controlled Tabs
When using frameworks like Next.js, Remix, or React Router, controlling the active tabs based on the URL can be useful.
To achieve this, you need to do two things:
- Set the `value` prop to the current URL path.
- Listen to the `onValueChange` event and update the URL path.
Here's an example using Remix Router
```tsx
import { Tabs } from '@ark-ui/react/tabs'
import { useLocation, useNavigate, Link } from '@remix-run/react'
export default function App() {
const { pathname } = useLocation()
const navigate = useNavigate()
const lastPathFragment = pathname.substring(pathname.lastIndexOf('/') + 1)
const activeTab = lastPathFragment.length > 0 ? lastPathFragment : 'homepage'
return (
{
navigate(`/${value === 'home' ? '' : value}`)
}}
>
Home
Page 1
Page 2
)
}
```
### Vertical Tabs
The default orientation of the tabs is `horizontal`. To change the orientation, set the `orientation` prop to
`vertical`.
```vue
ReactVueSolidReact ContentVue ContentSolid Content
```
### Manual Activation
By default, the tab can be selected when it receives focus from either the keyboard or pointer interaction. This is
called automatic tab activation.
In contrast, manual tab activation means the tab is selected with the
Enter key or by clicking on the tab.
```vue
ReactVueSolidReact ContentVue ContentSolid Content
```
### Using the Root Provider
The `RootProvider` component provides a context for the tabs. It accepts the value of the `useTabs` hook. You can
leverage it to access the component state and methods from outside the tabs.
```vue
ReactVueSolidReact ContentVue ContentSolid Content
```
> If you're using the `RootProvider` component, you don't need to use the `Root` component.
## API Reference
### Root
#### Props
**`activationMode`**
Type: `'manual' | 'automatic'`
Required: false
Default Value: `"automatic"`
Description: The activation mode of the tabs. Can be `manual` or `automatic`
- `manual`: Tabs are activated when clicked or press `enter` key.
- `automatic`: Tabs are activated when receiving focus
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
**`composite`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Whether the tab is composite
**`defaultValue`**
Type: `string`
Required: false
Default Value: `undefined`
Description: The initial selected tab value when rendered.
Use when you don't need to control the selected tab value.
**`deselectable`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Whether the active tab can be deselected when clicking on it.
**`id`**
Type: `string`
Required: false
Default Value: `undefined`
Description: The unique identifier of the machine.
**`ids`**
Type: `Partial<{ root: string; trigger: string; list: string; content: string; indicator: string }>`
Required: false
Default Value: `undefined`
Description: The ids of the elements in the tabs. Useful for composition.
**`lazyMount`**
Type: `boolean`
Required: false
Default Value: `false`
Description: Whether to enable lazy mounting
**`loopFocus`**
Type: `boolean`
Required: false
Default Value: `true`
Description: Whether the keyboard navigation will loop from last tab to first, and vice versa.
**`modelValue`**
Type: `string`
Required: false
Default Value: `undefined`
Description: The v-model value of the tabs
**`navigate`**
Type: `(details: NavigateDetails) => void`
Required: false
Default Value: `undefined`
Description: Function to navigate to the selected tab when clicking on it.
Useful if tab triggers are anchor elements.
**`orientation`**
Type: `'horizontal' | 'vertical'`
Required: false
Default Value: `"horizontal"`
Description: The orientation of the tabs. Can be `horizontal` or `vertical`
- `horizontal`: only left and right arrow key navigation will work.
- `vertical`: only up and down arrow key navigation will work.
**`translations`**
Type: `IntlTranslations`
Required: false
Default Value: `undefined`
Description: Specifies the localized strings that identifies the accessibility elements and their states
**`unmountOnExit`**
Type: `boolean`
Required: false
Default Value: `false`
Description: Whether to unmount on exit.
#### Emits
**`focusChange`**
Type: `[details: FocusChangeDetails]`
Description: Callback to be called when the focused tab changes
**`update:modelValue`**
Type: `[value: string]`
Description: The callback fired when the model value changes.
**`valueChange`**
Type: `[details: ValueChangeDetails]`
Description: Callback to be called when the selected/active tab changes
#### Data Attributes
**`data-scope`**: tabs
**`data-part`**: root
**`data-orientation`**: The orientation of the tabs
**`data-focus`**: Present when focused
### TabContent
#### Props
**`value`**
Type: `string`
Required: true
Default Value: `undefined`
Description: The value of the tab
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
### TabIndicator
#### Props
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
### TabList
#### Props
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
### TabTrigger
#### Props
**`value`**
Type: `string`
Required: true
Default Value: `undefined`
Description: The value of the tab
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
**`disabled`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Whether the tab is disabled
### RootProvider
#### Props
**`value`**
Type: `TabsApi`
Required: true
Default Value: `undefined`
Description: undefined
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
**`lazyMount`**
Type: `boolean`
Required: false
Default Value: `false`
Description: Whether to enable lazy mounting
**`unmountOnExit`**
Type: `boolean`
Required: false
Default Value: `false`
Description: Whether to unmount on exit.
## Accessibility
Complies with the [Tabs WAI-ARIA design pattern](https://www.w3.org/WAI/ARIA/apg/patterns/tabs/).
### Keyboard Support
**`Tab`**
Description: When focus moves onto the tabs, focuses the active trigger. When a trigger is focused, moves focus to the active content.
**`ArrowDown`**
Description: Moves focus to the next trigger in vertical orientation and activates its associated content.
**`ArrowRight`**
Description: Moves focus to the next trigger in horizontal orientation and activates its associated content.
**`ArrowUp`**
Description: Moves focus to the previous trigger in vertical orientation and activates its associated content.
**`ArrowLeft`**
Description: Moves focus to the previous trigger in horizontal orientation and activates its associated content.
**`Home`**
Description: Moves focus to the first trigger and activates its associated content.
**`End`**
Description: Moves focus to the last trigger and activates its associated content.
**`Enter + Space`**
Description: In manual mode, when a trigger is focused, moves focus to its associated content.
# Tags Input (REACT)
## Anatomy
To set up the tags input correctly, you'll need to understand its anatomy and how we name its parts.
> Each part includes a `data-part` attribute to help identify them in the DOM.
## Examples
Learn how to use the `TagsInput` component in your project. Let's take a look at the most basic example:
```tsx
import { TagsInput } from '@ark-ui/react/tags-input'
export const Basic = () => {
return (
{(tagsInput) => (
<>
Frameworks
{tagsInput.value.map((value, index) => (
{value}Delete
))}
Clear all
>
)}
)
}
```
### Navigating and Editing tags
When the input has an empty value or the caret is at the start position, the tags can be selected by using the arrow
left and arrow right keys. When "visual" focus in on any tag:
- Pressing Enter or double-clicking on the tag will put it in edit mode, allowing the user change its value
and press Enter to commit the changes.
- Pressing Delete or Backspace will delete the tag that has _visual_ focus.
### Setting the initial tags
To set the initial tag values, set the `defaultValue` prop.
```tsx
import { TagsInput } from '@ark-ui/react/tags-input'
export const InitialValue = () => {
return (
{(tagsInput) => (
<>
Frameworks
{tagsInput.value.map((value, index) => (
{value}Delete
))}
Clear all
>
)}
)
}
```
### Limiting the number of tags
To limit the number of tags within the component, you can set the `max` property to the limit you want. The default
value is `Infinity`.
When the tag reaches the limit, new tags cannot be added except the `allowOverflow` prop is set to `true`.
```tsx
import { TagsInput } from '@ark-ui/react/tags-input'
export const MaxWithOverflow = () => {
return (
{(tagsInput) => (
<>
Frameworks
{tagsInput.value.map((value, index) => (
{value}Delete
))}
Clear all
>
)}
)
}
```
### Validating Tags
Before a tag is added, the `validate` function is called to determine whether to accept or reject a tag.
A common use-case for validating tags is preventing duplicates or validating the data type.
```tsx
import { TagsInput } from '@ark-ui/react/tags-input'
export const Validated = () => {
return (
{
return !details.value.includes(details.inputValue)
}}
>
{(tagsInput) => (
<>
Frameworks
{tagsInput.value.map((value, index) => (
{value}Delete
))}
Clear all
>
)}
)
}
```
### Blur behavior
When the tags input is blurred, you can configure the action the component should take by passing the `blurBehavior`
prop.
- `add` — Adds the tag to the list of tags.
- `clear` — Clears the tags input value.
```tsx
import { TagsInput } from '@ark-ui/react/tags-input'
export const BlurBehavior = () => {
return (
{(tagsInput) => (
<>
Frameworks
{tagsInput.value.map((value, index) => (
{value}Delete
))}
Clear all
>
)}
)
}
```
### Paste behavior
To add a tag when a arbitrary value is pasted in the input element, pass the `addOnPaste` prop.
When a value is pasted, the component will:
- check if the value is a valid tag based on the `validate` option
- split the value by the `delimiter` option passed
```tsx
import { TagsInput } from '@ark-ui/react/tags-input'
export const PasteBehavior = () => {
return (
{(tagsInput) => (
<>
Frameworks
{tagsInput.value.map((value, index) => (
{value}Delete
))}
Clear all
>
)}
)
}
```
### Disable tag editing
by default the tags can be edited by double-clicking on the tag or focusing on them and pressing
Enter. To disable this behavior, pass `editable={false}`
```tsx
import { TagsInput } from '@ark-ui/react/tags-input'
export const DisabledEditing = () => {
return (
{(tagsInput) => (
<>
Frameworks
{tagsInput.value.map((value, index) => (
{value}Delete
))}
Clear all
>
)}
)
}
```
### Events
During the lifetime of the tags input interaction, here's a list of events we emit:
- `onValueChange` — invoked when the tag value changes.
- `onHighlightChange` — invoked when a tag has visual focus.
- `onValueInvalid` — invoked when the max tag count is reached or the `validate` function returns `false`.
```tsx
import { TagsInput } from '@ark-ui/react/tags-input'
export const OnEvent = () => {
return (
{
console.log('tags changed to:', details.value)
}}
onHighlightChange={(details) => {
console.log('highlighted tag:', details.highlightedValue)
}}
onValueInvalid={(details) => {
console.log('Invalid!', details.reason)
}}
max={3}
allowOverflow
validate={(details) => {
return !details.value.includes(details.inputValue)
}}
>
{(tagsInput) => (
<>
Frameworks
{tagsInput.value.map((value, index) => (
{value}Delete
))}
Clear all
>
)}
)
}
```
### Using the Field Component
The `Field` component helps manage form-related state and accessibility attributes of a tags input. It includes handling
ARIA labels, helper text, and error text to ensure proper accessibility.
```tsx
import { Field } from '@ark-ui/react/field'
import { TagsInput } from '@ark-ui/react/tags-input'
export const WithField = (props: Field.RootProps) => {
return (
{(tagsInput) => (
<>
Label
{tagsInput.value.map((value, index) => (
{value}Delete
))}
Clear all
>
)}
Additional InfoError Info
)
}
```
### Using the Root Provider
The `RootProvider` component provides a context for the tags-input. It accepts the value of the `useTags-input` hook.
You can leverage it to access the component state and methods from outside the tags-input.
```tsx
import { TagsInput, useTagsInput } from '@ark-ui/react/tags-input'
export const RootProvider = () => {
const tagsInput = useTagsInput()
return (
<>
{(tagsInput) => (
<>
Frameworks
{tagsInput.value.map((value, index) => (
{value}Delete
))}
Clear all
>
)}
>
)
}
```
> If you're using the `RootProvider` component, you don't need to use the `Root` component.
## API Reference
### Root
#### Props
**`addOnPaste`**
Type: `boolean`
Required: false
Default Value: `false`
Description: Whether to add a tag when you paste values into the tag input
**`allowOverflow`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Whether to allow tags to exceed max. In this case,
we'll attach `data-invalid` to the root
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
**`autoFocus`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Whether the input should be auto-focused
**`blurBehavior`**
Type: `'clear' | 'add'`
Required: false
Default Value: `undefined`
Description: The behavior of the tags input when the input is blurred
- `"add"`: add the input value as a new tag
- `"clear"`: clear the input value
**`defaultInputValue`**
Type: `string`
Required: false
Default Value: `undefined`
Description: The initial tag input value when rendered.
Use when you don't need to control the tag input value.
**`defaultValue`**
Type: `string[]`
Required: false
Default Value: `undefined`
Description: The initial tag value when rendered.
Use when you don't need to control the tag value.
**`delimiter`**
Type: `string | RegExp`
Required: false
Default Value: `","`
Description: The character that serves has:
- event key to trigger the addition of a new tag
- character used to split tags when pasting into the input
**`disabled`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Whether the tags input should be disabled
**`editable`**
Type: `boolean`
Required: false
Default Value: `true`
Description: Whether a tag can be edited after creation, by pressing `Enter` or double clicking.
**`form`**
Type: `string`
Required: false
Default Value: `undefined`
Description: The associate form of the underlying input element.
**`id`**
Type: `string`
Required: false
Default Value: `undefined`
Description: The unique identifier of the machine.
**`ids`**
Type: `Partial<{
root: string
input: string
hiddenInput: string
clearBtn: string
label: string
control: string
item(opts: ItemProps): string
itemDeleteTrigger(opts: ItemProps): string
itemInput(opts: ItemProps): string
}>`
Required: false
Default Value: `undefined`
Description: The ids of the elements in the tags input. Useful for composition.
**`inputValue`**
Type: `string`
Required: false
Default Value: `undefined`
Description: The controlled tag input's value
**`invalid`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Whether the tags input is invalid
**`max`**
Type: `number`
Required: false
Default Value: `Infinity`
Description: The max number of tags
**`maxLength`**
Type: `number`
Required: false
Default Value: `undefined`
Description: The max length of the input.
**`name`**
Type: `string`
Required: false
Default Value: `undefined`
Description: The name attribute for the input. Useful for form submissions
**`onFocusOutside`**
Type: `(event: FocusOutsideEvent) => void`
Required: false
Default Value: `undefined`
Description: Function called when the focus is moved outside the component
**`onHighlightChange`**
Type: `(details: HighlightChangeDetails) => void`
Required: false
Default Value: `undefined`
Description: Callback fired when a tag is highlighted by pointer or keyboard navigation
**`onInputValueChange`**
Type: `(details: InputValueChangeDetails) => void`
Required: false
Default Value: `undefined`
Description: Callback fired when the input value is updated
**`onInteractOutside`**
Type: `(event: InteractOutsideEvent) => void`
Required: false
Default Value: `undefined`
Description: Function called when an interaction happens outside the component
**`onPointerDownOutside`**
Type: `(event: PointerDownOutsideEvent) => void`
Required: false
Default Value: `undefined`
Description: Function called when the pointer is pressed down outside the component
**`onValueChange`**
Type: `(details: ValueChangeDetails) => void`
Required: false
Default Value: `undefined`
Description: Callback fired when the tag values is updated
**`onValueInvalid`**
Type: `(details: ValidityChangeDetails) => void`
Required: false
Default Value: `undefined`
Description: Callback fired when the max tag count is reached or the `validateTag` function returns `false`
**`readOnly`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Whether the tags input should be read-only
**`required`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Whether the tags input is required
**`translations`**
Type: `IntlTranslations`
Required: false
Default Value: `undefined`
Description: Specifies the localized strings that identifies the accessibility elements and their states
**`validate`**
Type: `(details: ValidateArgs) => boolean`
Required: false
Default Value: `undefined`
Description: Returns a boolean that determines whether a tag can be added.
Useful for preventing duplicates or invalid tag values.
**`value`**
Type: `string[]`
Required: false
Default Value: `undefined`
Description: The controlled tag value
#### Data Attributes
**`data-scope`**: tags-input
**`data-part`**: root
**`data-invalid`**: Present when invalid
**`data-readonly`**: Present when read-only
**`data-disabled`**: Present when disabled
**`data-focus`**: Present when focused
**`data-empty`**:
### ClearTrigger
#### Props
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
#### Data Attributes
**`data-scope`**: tags-input
**`data-part`**: clear-trigger
**`data-readonly`**: Present when read-only
### Control
#### Props
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
#### Data Attributes
**`data-scope`**: tags-input
**`data-part`**: control
**`data-disabled`**: Present when disabled
**`data-readonly`**: Present when read-only
**`data-invalid`**: Present when invalid
**`data-focus`**: Present when focused
### HiddenInput
#### Props
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
### Input
#### Props
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
#### Data Attributes
**`data-scope`**: tags-input
**`data-part`**: input
**`data-invalid`**: Present when invalid
**`data-readonly`**: Present when read-only
### ItemDeleteTrigger
#### Props
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
### ItemInput
#### Props
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
### ItemPreview
#### Props
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
#### Data Attributes
**`data-scope`**: tags-input
**`data-part`**: item-preview
**`data-value`**: The value of the item
**`data-disabled`**: Present when disabled
**`data-highlighted`**: Present when highlighted
### Item
#### Props
**`index`**
Type: `string | number`
Required: true
Default Value: `undefined`
Description: undefined
**`value`**
Type: `string`
Required: true
Default Value: `undefined`
Description: undefined
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
**`disabled`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: undefined
#### Data Attributes
**`data-scope`**: tags-input
**`data-part`**: item
**`data-value`**: The value of the item
**`data-disabled`**: Present when disabled
### ItemText
#### Props
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
#### Data Attributes
**`data-scope`**: tags-input
**`data-part`**: item-text
**`data-disabled`**: Present when disabled
**`data-highlighted`**: Present when highlighted
### Label
#### Props
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
#### Data Attributes
**`data-scope`**: tags-input
**`data-part`**: label
**`data-disabled`**: Present when disabled
**`data-invalid`**: Present when invalid
**`data-readonly`**: Present when read-only
### RootProvider
#### Props
**`value`**
Type: `UseTagsInputReturn`
Required: true
Default Value: `undefined`
Description: undefined
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
## Accessibility
### Keyboard Support
**`ArrowLeft`**
Description: Moves focus to the previous tag item
**`ArrowRight`**
Description: Moves focus to the next tag item
**`Backspace`**
Description: Deletes the tag item that has visual focus or the last tag item
**`Enter`**
Description: When a tag item has visual focus, it puts the tag in edit mode. When the input has focus, it adds the value to the list of tags
**`Delete`**
Description: Deletes the tag item that has visual focus
**`Control + V`**
Description: When `addOnPaste` is set. Adds the pasted value as a tags
# Tags Input (SOLID)
## Anatomy
To set up the tags input correctly, you'll need to understand its anatomy and how we name its parts.
> Each part includes a `data-part` attribute to help identify them in the DOM.
## Examples
Learn how to use the `TagsInput` component in your project. Let's take a look at the most basic example:
```tsx
import { TagsInput } from '@ark-ui/solid/tags-input'
import { Index } from 'solid-js'
export const Basic = () => (
{(api) => (
<>
Frameworks
{(value, index) => (
{value()}Delete
)}
Clear All
>
)}
)
```
### Navigating and Editing tags
When the input has an empty value or the caret is at the start position, the tags can be selected by using the arrow
left and arrow right keys. When "visual" focus in on any tag:
- Pressing Enter or double-clicking on the tag will put it in edit mode, allowing the user change its value
and press Enter to commit the changes.
- Pressing Delete or Backspace will delete the tag that has _visual_ focus.
### Setting the initial tags
To set the initial tag values, set the `defaultValue` prop.
```tsx
import { TagsInput } from '@ark-ui/solid/tags-input'
import { Index } from 'solid-js'
export const InitialValue = () => {
return (
{(api) => (
<>
Frameworks
{(value, index) => (
{value()}Delete
)}
Clear all
>
)}
)
}
```
### Limiting the number of tags
To limit the number of tags within the component, you can set the `max` property to the limit you want. The default
value is `Infinity`.
When the tag reaches the limit, new tags cannot be added except the `allowOverflow` prop is set to `true`.
```tsx
import { TagsInput } from '@ark-ui/solid/tags-input'
import { Index } from 'solid-js'
export const MaxWithOverflow = () => {
return (
{(api) => (
<>
Frameworks
{(value, index) => (
{value()}Delete
)}
Clear all
>
)}
)
}
```
### Validating Tags
Before a tag is added, the `validate` function is called to determine whether to accept or reject a tag.
A common use-case for validating tags is preventing duplicates or validating the data type.
```tsx
import { TagsInput } from '@ark-ui/solid/tags-input'
import { Index } from 'solid-js'
export const Validated = () => {
return (
{
return !details.value.includes(details.inputValue)
}}
>
{(api) => (
<>
Frameworks
{(value, index) => (
{value()}Delete
)}
Clear all
>
)}
)
}
```
### Blur behavior
When the tags input is blurred, you can configure the action the component should take by passing the `blurBehavior`
prop.
- `add` — Adds the tag to the list of tags.
- `clear` — Clears the tags input value.
```tsx
import { TagsInput } from '@ark-ui/solid/tags-input'
import { Index } from 'solid-js'
export const BlurBehavior = () => {
return (
{(api) => (
<>
Frameworks
{(value, index) => (
{value()}Delete
)}
Clear all
>
)}
)
}
```
### Paste behavior
To add a tag when a arbitrary value is pasted in the input element, pass the `addOnPaste` prop.
When a value is pasted, the component will:
- check if the value is a valid tag based on the `validate` option
- split the value by the `delimiter` option passed
```tsx
import { TagsInput } from '@ark-ui/solid/tags-input'
import { Index } from 'solid-js'
export const PasteBehavior = () => {
return (
{(api) => (
<>
Frameworks
{(value, index) => (
{value()}Delete
)}
Clear all
>
)}
)
}
```
### Disable tag editing
by default the tags can be edited by double-clicking on the tag or focusing on them and pressing
Enter. To disable this behavior, pass `editable={false}`
```tsx
import { TagsInput } from '@ark-ui/solid/tags-input'
import { Index } from 'solid-js'
export const DisabledEditing = () => {
return (
{(api) => (
<>
Frameworks
{(value, index) => (
{value()}Delete
)}
Clear all
>
)}
)
}
```
### Events
During the lifetime of the tags input interaction, here's a list of events we emit:
- `onValueChange` — invoked when the tag value changes.
- `onHighlightChange` — invoked when a tag has visual focus.
- `onValueInvalid` — invoked when the max tag count is reached or the `validate` function returns `false`.
```tsx
import { TagsInput } from '@ark-ui/solid/tags-input'
import { Index } from 'solid-js'
export const OnEvent = () => {
return (
{
console.log('tags changed to:', details.value)
}}
onHighlightChange={(details) => {
console.log('highlighted tag:', details.highlightedValue)
}}
onValueInvalid={(details) => {
console.log('Invalid!', details.reason)
}}
max={3}
allowOverflow
validate={(details) => {
return !details.value.includes(details.inputValue)
}}
>
{(api) => (
<>
Frameworks
{(value, index) => (
{value()}Delete
)}
Clear all
>
)}
)
}
```
### Using the Field Component
The `Field` component helps manage form-related state and accessibility attributes of a tags input. It includes handling
ARIA labels, helper text, and error text to ensure proper accessibility.
```tsx
import { Field } from '@ark-ui/solid/field'
import { TagsInput } from '@ark-ui/solid/tags-input'
import { Index } from 'solid-js'
export const WithField = (props: Field.RootProps) => {
return (
{(tagsInput) => (
<>
Label
{(value, index) => (
{value()}Delete
)}
Clear all
>
)}
Additional InfoError Info
)
}
```
### Using the Root Provider
The `RootProvider` component provides a context for the tags-input. It accepts the value of the `useTags-input` hook.
You can leverage it to access the component state and methods from outside the tags-input.
```tsx
import { TagsInput, useTagsInput } from '@ark-ui/solid/tags-input'
import { Index } from 'solid-js'
export const RootProvider = () => {
const tagsInput = useTagsInput()
return (
<>
{(api) => (
<>
Frameworks
{(value, index) => (
{value()}Delete
)}
Clear All
>
)}
>
)
}
```
> If you're using the `RootProvider` component, you don't need to use the `Root` component.
## API Reference
### Root
#### Props
**`addOnPaste`**
Type: `boolean`
Required: false
Default Value: `false`
Description: Whether to add a tag when you paste values into the tag input
**`allowOverflow`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Whether to allow tags to exceed max. In this case,
we'll attach `data-invalid` to the root
**`asChild`**
Type: `(props: ParentProps<'div'>) => Element`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
**`autoFocus`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Whether the input should be auto-focused
**`blurBehavior`**
Type: `'clear' | 'add'`
Required: false
Default Value: `undefined`
Description: The behavior of the tags input when the input is blurred
- `"add"`: add the input value as a new tag
- `"clear"`: clear the input value
**`defaultInputValue`**
Type: `string`
Required: false
Default Value: `undefined`
Description: The initial tag input value when rendered.
Use when you don't need to control the tag input value.
**`defaultValue`**
Type: `string[]`
Required: false
Default Value: `undefined`
Description: The initial tag value when rendered.
Use when you don't need to control the tag value.
**`delimiter`**
Type: `string | RegExp`
Required: false
Default Value: `","`
Description: The character that serves has:
- event key to trigger the addition of a new tag
- character used to split tags when pasting into the input
**`disabled`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Whether the tags input should be disabled
**`editable`**
Type: `boolean`
Required: false
Default Value: `true`
Description: Whether a tag can be edited after creation, by pressing `Enter` or double clicking.
**`form`**
Type: `string`
Required: false
Default Value: `undefined`
Description: The associate form of the underlying input element.
**`ids`**
Type: `Partial<{
root: string
input: string
hiddenInput: string
clearBtn: string
label: string
control: string
item(opts: ItemProps): string
itemDeleteTrigger(opts: ItemProps): string
itemInput(opts: ItemProps): string
}>`
Required: false
Default Value: `undefined`
Description: The ids of the elements in the tags input. Useful for composition.
**`inputValue`**
Type: `string`
Required: false
Default Value: `undefined`
Description: The controlled tag input's value
**`invalid`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Whether the tags input is invalid
**`max`**
Type: `number`
Required: false
Default Value: `Infinity`
Description: The max number of tags
**`maxLength`**
Type: `number`
Required: false
Default Value: `undefined`
Description: The max length of the input.
**`name`**
Type: `string`
Required: false
Default Value: `undefined`
Description: The name attribute for the input. Useful for form submissions
**`onFocusOutside`**
Type: `(event: FocusOutsideEvent) => void`
Required: false
Default Value: `undefined`
Description: Function called when the focus is moved outside the component
**`onHighlightChange`**
Type: `(details: HighlightChangeDetails) => void`
Required: false
Default Value: `undefined`
Description: Callback fired when a tag is highlighted by pointer or keyboard navigation
**`onInputValueChange`**
Type: `(details: InputValueChangeDetails) => void`
Required: false
Default Value: `undefined`
Description: Callback fired when the input value is updated
**`onInteractOutside`**
Type: `(event: InteractOutsideEvent) => void`
Required: false
Default Value: `undefined`
Description: Function called when an interaction happens outside the component
**`onPointerDownOutside`**
Type: `(event: PointerDownOutsideEvent) => void`
Required: false
Default Value: `undefined`
Description: Function called when the pointer is pressed down outside the component
**`onValueChange`**
Type: `(details: ValueChangeDetails) => void`
Required: false
Default Value: `undefined`
Description: Callback fired when the tag values is updated
**`onValueInvalid`**
Type: `(details: ValidityChangeDetails) => void`
Required: false
Default Value: `undefined`
Description: Callback fired when the max tag count is reached or the `validateTag` function returns `false`
**`readOnly`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Whether the tags input should be read-only
**`required`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Whether the tags input is required
**`translations`**
Type: `IntlTranslations`
Required: false
Default Value: `undefined`
Description: Specifies the localized strings that identifies the accessibility elements and their states
**`validate`**
Type: `(details: ValidateArgs) => boolean`
Required: false
Default Value: `undefined`
Description: Returns a boolean that determines whether a tag can be added.
Useful for preventing duplicates or invalid tag values.
**`value`**
Type: `string[]`
Required: false
Default Value: `undefined`
Description: The controlled tag value
#### Data Attributes
**`data-scope`**: tags-input
**`data-part`**: root
**`data-invalid`**: Present when invalid
**`data-readonly`**: Present when read-only
**`data-disabled`**: Present when disabled
**`data-focus`**: Present when focused
**`data-empty`**:
### ClearTrigger
#### Props
**`asChild`**
Type: `(props: ParentProps<'button'>) => Element`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
#### Data Attributes
**`data-scope`**: tags-input
**`data-part`**: clear-trigger
**`data-readonly`**: Present when read-only
### Control
#### Props
**`asChild`**
Type: `(props: ParentProps<'div'>) => Element`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
#### Data Attributes
**`data-scope`**: tags-input
**`data-part`**: control
**`data-disabled`**: Present when disabled
**`data-readonly`**: Present when read-only
**`data-invalid`**: Present when invalid
**`data-focus`**: Present when focused
### HiddenInput
#### Props
**`asChild`**
Type: `(props: ParentProps<'input'>) => Element`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
### Input
#### Props
**`asChild`**
Type: `(props: ParentProps<'input'>) => Element`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
#### Data Attributes
**`data-scope`**: tags-input
**`data-part`**: input
**`data-invalid`**: Present when invalid
**`data-readonly`**: Present when read-only
### ItemDeleteTrigger
#### Props
**`asChild`**
Type: `(props: ParentProps<'button'>) => Element`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
### ItemInput
#### Props
**`asChild`**
Type: `(props: ParentProps<'input'>) => Element`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
### ItemPreview
#### Props
**`asChild`**
Type: `(props: ParentProps<'div'>) => Element`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
#### Data Attributes
**`data-scope`**: tags-input
**`data-part`**: item-preview
**`data-value`**: The value of the item
**`data-disabled`**: Present when disabled
**`data-highlighted`**: Present when highlighted
### Item
#### Props
**`index`**
Type: `string | number`
Required: true
Default Value: `undefined`
Description: undefined
**`value`**
Type: `string`
Required: true
Default Value: `undefined`
Description: undefined
**`asChild`**
Type: `(props: ParentProps<'div'>) => Element`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
**`disabled`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: undefined
#### Data Attributes
**`data-scope`**: tags-input
**`data-part`**: item
**`data-value`**: The value of the item
**`data-disabled`**: Present when disabled
### ItemText
#### Props
**`asChild`**
Type: `(props: ParentProps<'span'>) => Element`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
#### Data Attributes
**`data-scope`**: tags-input
**`data-part`**: item-text
**`data-disabled`**: Present when disabled
**`data-highlighted`**: Present when highlighted
### Label
#### Props
**`asChild`**
Type: `(props: ParentProps<'label'>) => Element`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
#### Data Attributes
**`data-scope`**: tags-input
**`data-part`**: label
**`data-disabled`**: Present when disabled
**`data-invalid`**: Present when invalid
**`data-readonly`**: Present when read-only
### RootProvider
#### Props
**`value`**
Type: `UseTagsInputReturn`
Required: true
Default Value: `undefined`
Description: undefined
**`asChild`**
Type: `(props: ParentProps<'div'>) => Element`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
## Accessibility
### Keyboard Support
**`ArrowLeft`**
Description: Moves focus to the previous tag item
**`ArrowRight`**
Description: Moves focus to the next tag item
**`Backspace`**
Description: Deletes the tag item that has visual focus or the last tag item
**`Enter`**
Description: When a tag item has visual focus, it puts the tag in edit mode. When the input has focus, it adds the value to the list of tags
**`Delete`**
Description: Deletes the tag item that has visual focus
**`Control + V`**
Description: When `addOnPaste` is set. Adds the pasted value as a tags
# Tags Input (VUE)
## Anatomy
To set up the tags input correctly, you'll need to understand its anatomy and how we name its parts.
> Each part includes a `data-part` attribute to help identify them in the DOM.
## Examples
Learn how to use the `TagsInput` component in your project. Let's take a look at the most basic example:
```vue
Frameworks{{ value }}DeleteClear all
```
### Navigating and Editing tags
When the input has an empty value or the caret is at the start position, the tags can be selected by using the arrow
left and arrow right keys. When "visual" focus in on any tag:
- Pressing Enter or double-clicking on the tag will put it in edit mode, allowing the user change its value
and press Enter to commit the changes.
- Pressing Delete or Backspace will delete the tag that has _visual_ focus.
### Setting the initial tags
To set the initial tag values, set the `defaultValue` prop.
```vue
Frameworks{{ value }}DeleteClear all
```
### Limiting the number of tags
To limit the number of tags within the component, you can set the `max` property to the limit you want. The default
value is `Infinity`.
When the tag reaches the limit, new tags cannot be added except the `allowOverflow` prop is set to `true`.
```vue
Frameworks{{ value }}DeleteClear all
```
### Validating Tags
Before a tag is added, the `validate` function is called to determine whether to accept or reject a tag.
A common use-case for validating tags is preventing duplicates or validating the data type.
```vue
Frameworks{{ value }}DeleteClear all
```
### Blur behavior
When the tags input is blurred, you can configure the action the component should take by passing the `blurBehavior`
prop.
- `add` — Adds the tag to the list of tags.
- `clear` — Clears the tags input value.
```vue
Frameworks{{ value }}DeleteClear all
```
### Paste behavior
To add a tag when a arbitrary value is pasted in the input element, pass the `addOnPaste` prop.
When a value is pasted, the component will:
- check if the value is a valid tag based on the `validate` option
- split the value by the `delimiter` option passed
```vue
Frameworks{{ value }}DeleteClear all
```
### Disable tag editing
by default the tags can be edited by double-clicking on the tag or focusing on them and pressing
Enter. To disable this behavior, pass `editable={false}`
```vue
Frameworks{{ value }}DeleteClear all
```
### Events
During the lifetime of the tags input interaction, here's a list of events we emit:
- `onValueChange` — invoked when the tag value changes.
- `onHighlightChange` — invoked when a tag has visual focus.
- `onValueInvalid` — invoked when the max tag count is reached or the `validate` function returns `false`.
```vue
console.log(details)"
@highlight-change="(details) => console.log(details)"
@value-invalid="(details) => console.log(details)"
>
Frameworks{{ value }}DeleteClear all
```
### Using the Field Component
The `Field` component helps manage form-related state and accessibility attributes of a tags input. It includes handling
ARIA labels, helper text, and error text to ensure proper accessibility.
```vue
Label{{ value }}DeleteClear allAdditional InfoError Info
```
### Using the Root Provider
The `RootProvider` component provides a context for the tags-input. It accepts the value of the `useTags-input` hook.
You can leverage it to access the component state and methods from outside the tags-input.
```vue
Frameworks{{ value }}DeleteClear all
```
> If you're using the `RootProvider` component, you don't need to use the `Root` component.
## API Reference
### Root
#### Props
**`addOnPaste`**
Type: `boolean`
Required: false
Default Value: `false`
Description: Whether to add a tag when you paste values into the tag input
**`allowOverflow`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Whether to allow tags to exceed max. In this case,
we'll attach `data-invalid` to the root
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
**`autoFocus`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Whether the input should be auto-focused
**`blurBehavior`**
Type: `'add' | 'clear'`
Required: false
Default Value: `undefined`
Description: The behavior of the tags input when the input is blurred
- `"add"`: add the input value as a new tag
- `"clear"`: clear the input value
**`defaultInputValue`**
Type: `string`
Required: false
Default Value: `undefined`
Description: The initial tag input value when rendered.
Use when you don't need to control the tag input value.
**`defaultValue`**
Type: `string[]`
Required: false
Default Value: `undefined`
Description: The initial tag value when rendered.
Use when you don't need to control the tag value.
**`delimiter`**
Type: `string | RegExp`
Required: false
Default Value: `","`
Description: The character that serves has:
- event key to trigger the addition of a new tag
- character used to split tags when pasting into the input
**`disabled`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Whether the tags input should be disabled
**`editable`**
Type: `boolean`
Required: false
Default Value: `true`
Description: Whether a tag can be edited after creation, by pressing `Enter` or double clicking.
**`form`**
Type: `string`
Required: false
Default Value: `undefined`
Description: The associate form of the underlying input element.
**`id`**
Type: `string`
Required: false
Default Value: `undefined`
Description: The unique identifier of the machine.
**`ids`**
Type: `Partial<{
root: string
input: string
hiddenInput: string
clearBtn: string
label: string
control: string
item(opts: ItemProps): string
itemDeleteTrigger(opts: ItemProps): string
itemInput(opts: ItemProps): string
}>`
Required: false
Default Value: `undefined`
Description: The ids of the elements in the tags input. Useful for composition.
**`inputValue`**
Type: `string`
Required: false
Default Value: `undefined`
Description: The controlled tag input's value
**`invalid`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Whether the tags input is invalid
**`max`**
Type: `number`
Required: false
Default Value: `Infinity`
Description: The max number of tags
**`maxLength`**
Type: `number`
Required: false
Default Value: `undefined`
Description: The max length of the input.
**`modelValue`**
Type: `string[]`
Required: false
Default Value: `undefined`
Description: The v-model value of the tags input
**`name`**
Type: `string`
Required: false
Default Value: `undefined`
Description: The name attribute for the input. Useful for form submissions
**`readOnly`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Whether the tags input should be read-only
**`required`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Whether the tags input is required
**`translations`**
Type: `IntlTranslations`
Required: false
Default Value: `undefined`
Description: Specifies the localized strings that identifies the accessibility elements and their states
**`validate`**
Type: `(details: ValidateArgs) => boolean`
Required: false
Default Value: `undefined`
Description: Returns a boolean that determines whether a tag can be added.
Useful for preventing duplicates or invalid tag values.
#### Emits
**`focusOutside`**
Type: `[event: FocusOutsideEvent]`
Description: Function called when the focus is moved outside the component
**`highlightChange`**
Type: `[details: HighlightChangeDetails]`
Description: Callback fired when a tag is highlighted by pointer or keyboard navigation
**`inputValueChange`**
Type: `[details: InputValueChangeDetails]`
Description: Callback fired when the input value is updated
**`interactOutside`**
Type: `[event: InteractOutsideEvent]`
Description: Function called when an interaction happens outside the component
**`pointerDownOutside`**
Type: `[event: PointerDownOutsideEvent]`
Description: Function called when the pointer is pressed down outside the component
**`update:inputValue`**
Type: `[value: string]`
Description: The callback fired when the input value changes.
**`update:modelValue`**
Type: `[value: string[]]`
Description: The callback fired when the model value changes.
**`valueChange`**
Type: `[details: ValueChangeDetails]`
Description: Callback fired when the tag values is updated
**`valueInvalid`**
Type: `[details: ValidityChangeDetails]`
Description: Callback fired when the max tag count is reached or the `validateTag` function returns `false`
#### Data Attributes
**`data-scope`**: tags-input
**`data-part`**: root
**`data-invalid`**: Present when invalid
**`data-readonly`**: Present when read-only
**`data-disabled`**: Present when disabled
**`data-focus`**: Present when focused
**`data-empty`**:
### ClearTrigger
#### Props
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
#### Data Attributes
**`data-scope`**: tags-input
**`data-part`**: clear-trigger
**`data-readonly`**: Present when read-only
### Control
#### Props
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
#### Data Attributes
**`data-scope`**: tags-input
**`data-part`**: control
**`data-disabled`**: Present when disabled
**`data-readonly`**: Present when read-only
**`data-invalid`**: Present when invalid
**`data-focus`**: Present when focused
### HiddenInput
#### Props
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
### Input
#### Props
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
#### Data Attributes
**`data-scope`**: tags-input
**`data-part`**: input
**`data-invalid`**: Present when invalid
**`data-readonly`**: Present when read-only
### ItemDeleteTrigger
#### Props
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
### ItemInput
#### Props
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
### ItemPreview
#### Props
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
#### Data Attributes
**`data-scope`**: tags-input
**`data-part`**: item-preview
**`data-value`**: The value of the item
**`data-disabled`**: Present when disabled
**`data-highlighted`**: Present when highlighted
### Item
#### Props
**`index`**
Type: `string | number`
Required: true
Default Value: `undefined`
Description: undefined
**`value`**
Type: `string`
Required: true
Default Value: `undefined`
Description: undefined
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
**`disabled`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: undefined
#### Data Attributes
**`data-scope`**: tags-input
**`data-part`**: item
**`data-value`**: The value of the item
**`data-disabled`**: Present when disabled
### ItemText
#### Props
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
#### Data Attributes
**`data-scope`**: tags-input
**`data-part`**: item-text
**`data-disabled`**: Present when disabled
**`data-highlighted`**: Present when highlighted
### Label
#### Props
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
#### Data Attributes
**`data-scope`**: tags-input
**`data-part`**: label
**`data-disabled`**: Present when disabled
**`data-invalid`**: Present when invalid
**`data-readonly`**: Present when read-only
### RootProvider
#### Props
**`value`**
Type: `TagsInputApi`
Required: true
Default Value: `undefined`
Description: undefined
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
## Accessibility
### Keyboard Support
**`ArrowLeft`**
Description: Moves focus to the previous tag item
**`ArrowRight`**
Description: Moves focus to the next tag item
**`Backspace`**
Description: Deletes the tag item that has visual focus or the last tag item
**`Enter`**
Description: When a tag item has visual focus, it puts the tag in edit mode. When the input has focus, it adds the value to the list of tags
**`Delete`**
Description: Deletes the tag item that has visual focus
**`Control + V`**
Description: When `addOnPaste` is set. Adds the pasted value as a tags
# Timer (REACT)
## Examples
Learn how to use the `Timer` component in your project. Let's take a look at the most basic example:
```tsx
import { Timer } from '@ark-ui/react/timer'
export const Basic = () => (
:::PlayResumePause
)
```
### Countdown Timer
You can create a countdown timer by setting the `targetMs` prop to a future timestamp:
```tsx
import { Timer } from '@ark-ui/react/timer'
export const Countdown = () => (
:::
)
```
### Timer Events
The Timer component provides events that you can listen to for various timer-related actions.
- The `onComplete` event is triggered when the timer reaches its target time.
- The `onTick` event is called on each timer update, providing details about the current timer state.
```tsx
import { Timer } from '@ark-ui/react/timer'
export const Events = () => (
console.log('Timer completed')}
onTick={(details) => console.log('Tick:', details.formattedTime)}
>
)
```
### Using the Root Provider
The `RootProvider` component provides a context for the timer. It accepts the value of the `useTimer` hook. You can
leverage it to access the component state and methods from outside the timer.
```tsx
import { Timer, useTimer } from '@ark-ui/react/timer'
export const RootProvider = () => {
const timer = useTimer({ targetMs: 60 * 60 * 1000 })
return (
<>
:::PlayResumePause
>
)
}
```
> If you're using the `RootProvider` component, you don't need to use the `Root` component.
## API Reference
### Root
#### Props
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
**`autoStart`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Whether the timer should start automatically
**`countdown`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Whether the timer should countdown, decrementing the timer on each tick.
**`ids`**
Type: `Partial<{ root: string; area: string }>`
Required: false
Default Value: `undefined`
Description: The ids of the timer parts
**`interval`**
Type: `number`
Required: false
Default Value: `1000`
Description: The interval in milliseconds to update the timer count.
**`onComplete`**
Type: `() => void`
Required: false
Default Value: `undefined`
Description: Function invoked when the timer is completed
**`onTick`**
Type: `(details: TickDetails) => void`
Required: false
Default Value: `undefined`
Description: Function invoked when the timer ticks
**`startMs`**
Type: `number`
Required: false
Default Value: `undefined`
Description: The total duration of the timer in milliseconds.
**`targetMs`**
Type: `number`
Required: false
Default Value: `undefined`
Description: The minimum count of the timer in milliseconds.
### ActionTrigger
#### Props
**`action`**
Type: `TimerAction`
Required: true
Default Value: `undefined`
Description: undefined
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
### Area
#### Props
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
### Control
#### Props
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
### Item
#### Props
**`type`**
Type: `keyof Time`
Required: true
Default Value: `undefined`
Description: undefined
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
#### Data Attributes
**`data-scope`**: timer
**`data-part`**: item
**`data-type`**: The type of the item
### RootProvider
#### Props
**`value`**
Type: `UseTimerReturn`
Required: true
Default Value: `undefined`
Description: undefined
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
### Separator
#### Props
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
# Timer (SOLID)
## Examples
Learn how to use the `Timer` component in your project. Let's take a look at the most basic example:
```tsx
import { Timer } from '@ark-ui/solid/timer'
export const Basic = () => (
:::PlayResumePause
)
```
### Countdown Timer
You can create a countdown timer by setting the `targetMs` prop to a future timestamp:
```tsx
import { Timer } from '@ark-ui/solid/timer'
export const Countdown = () => (
:::
)
```
### Timer Events
The Timer component provides events that you can listen to for various timer-related actions.
- The `onComplete` event is triggered when the timer reaches its target time.
- The `onTick` event is called on each timer update, providing details about the current timer state.
```tsx
import { Timer } from '@ark-ui/solid/timer'
export const Events = () => (
console.log('Timer completed')}
onTick={(details) => console.log('Tick:', details.formattedTime)}
>
)
```
### Using the Root Provider
The `RootProvider` component provides a context for the timer. It accepts the value of the `useTimer` hook. You can
leverage it to access the component state and methods from outside the timer.
```tsx
import { Timer, useTimer } from '@ark-ui/solid/timer'
export const RootProvider = () => {
const timer = useTimer({ targetMs: 60 * 60 * 1000 })
return (
<>
:::PlayResumePause
>
)
}
```
> If you're using the `RootProvider` component, you don't need to use the `Root` component.
## API Reference
### Root
#### Props
**`asChild`**
Type: `(props: ParentProps<'div'>) => Element`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
**`autoStart`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Whether the timer should start automatically
**`countdown`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Whether the timer should countdown, decrementing the timer on each tick.
**`ids`**
Type: `Partial<{ root: string; area: string }>`
Required: false
Default Value: `undefined`
Description: The ids of the timer parts
**`interval`**
Type: `number`
Required: false
Default Value: `1000`
Description: The interval in milliseconds to update the timer count.
**`onComplete`**
Type: `() => void`
Required: false
Default Value: `undefined`
Description: Function invoked when the timer is completed
**`onTick`**
Type: `(details: TickDetails) => void`
Required: false
Default Value: `undefined`
Description: Function invoked when the timer ticks
**`startMs`**
Type: `number`
Required: false
Default Value: `undefined`
Description: The total duration of the timer in milliseconds.
**`targetMs`**
Type: `number`
Required: false
Default Value: `undefined`
Description: The minimum count of the timer in milliseconds.
### ActionTrigger
#### Props
**`action`**
Type: `TimerAction`
Required: true
Default Value: `undefined`
Description: undefined
**`asChild`**
Type: `(props: ParentProps<'button'>) => Element`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
### Area
#### Props
**`asChild`**
Type: `(props: ParentProps<'div'>) => Element`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
### Control
#### Props
**`asChild`**
Type: `(props: ParentProps<'div'>) => Element`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
### Item
#### Props
**`type`**
Type: `keyof Time`
Required: true
Default Value: `undefined`
Description: undefined
**`asChild`**
Type: `(props: ParentProps<'div'>) => Element`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
#### Data Attributes
**`data-scope`**: timer
**`data-part`**: item
**`data-type`**: The type of the item
### RootProvider
#### Props
**`value`**
Type: `UseTimerReturn`
Required: true
Default Value: `undefined`
Description: undefined
**`asChild`**
Type: `(props: ParentProps<'div'>) => Element`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
### Separator
#### Props
**`asChild`**
Type: `(props: ParentProps<'div'>) => Element`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
# Timer (VUE)
## Examples
Learn how to use the `Timer` component in your project. Let's take a look at the most basic example:
```vue
:::PlayResumePause
```
### Countdown Timer
You can create a countdown timer by setting the `targetMs` prop to a future timestamp:
```vue
:::
```
### Timer Events
The Timer component provides events that you can listen to for various timer-related actions.
- The `onComplete` event is triggered when the timer reaches its target time.
- The `onTick` event is called on each timer update, providing details about the current timer state.
```vue
console.log('Timer completed')"
@tick="(details) => console.log('Tick:', details.formattedTime)"
>
```
### Using the Root Provider
The `RootProvider` component provides a context for the timer. It accepts the value of the `useTimer` hook. You can
leverage it to access the component state and methods from outside the timer.
```vue
:::PlayResumePause
```
> If you're using the `RootProvider` component, you don't need to use the `Root` component.
## API Reference
### Root
#### Props
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
**`autoStart`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Whether the timer should start automatically
**`countdown`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Whether the timer should countdown, decrementing the timer on each tick.
**`id`**
Type: `string`
Required: false
Default Value: `undefined`
Description: The unique identifier of the machine.
**`ids`**
Type: `Partial<{ root: string; area: string }>`
Required: false
Default Value: `undefined`
Description: The ids of the timer parts
**`interval`**
Type: `number`
Required: false
Default Value: `250`
Description: The interval in milliseconds to update the timer count.
**`startMs`**
Type: `number`
Required: false
Default Value: `undefined`
Description: The total duration of the timer in milliseconds.
**`targetMs`**
Type: `number`
Required: false
Default Value: `undefined`
Description: The minimum count of the timer in milliseconds.
#### Emits
**`complete`**
Type: `[]`
Description: Function invoked when the timer is completed
**`tick`**
Type: `[details: TickDetails]`
Description: Function invoked when the timer ticks
### ActionTrigger
#### Props
**`action`**
Type: `TimerAction`
Required: true
Default Value: `undefined`
Description: undefined
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
### Area
#### Props
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
### Control
#### Props
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
### Item
#### Props
**`type`**
Type: `keyof Time`
Required: true
Default Value: `undefined`
Description: undefined
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
#### Data Attributes
**`data-scope`**: timer
**`data-part`**: item
**`data-type`**: The type of the item
### RootProvider
#### Props
**`value`**
Type: `TimerApi`
Required: true
Default Value: `undefined`
Description: undefined
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
### Separator
#### Props
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
# Toast (REACT)
## Anatomy
To set up the toast correctly, you'll need to understand its anatomy and how we name its parts.
> Each part includes a `data-part` attribute to help identify them in the DOM.
## Setup
To use the Toast component, create the toast engine using the `createToaster` function.
This function manages the placement and grouping of toasts, and provides a `toast` object needed to create toast
notification.
```ts
const toaster = createToaster({
placement: 'bottom-end',
overlap: true,
gap: 24,
})
```
## Examples
Here's an example of creating a toast using the `toast.create` method.
```tsx
import { Toast, Toaster, createToaster } from '@ark-ui/react/toast'
import { XIcon } from 'lucide-react'
const toaster = createToaster({
placement: 'bottom-end',
overlap: true,
gap: 24,
})
export const Basic = () => {
return (
)
}
```
## API Reference
### Root
#### Props
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
#### Data Attributes
**`data-scope`**: toast
**`data-part`**: root
**`data-state`**: "open" | "closed"
**`data-type`**: The type of the item
**`data-placement`**: The placement of the toast
**`data-align`**:
**`data-side`**:
**`data-mounted`**: Present when mounted
**`data-paused`**: Present when paused
**`data-first`**:
**`data-sibling`**:
**`data-stack`**:
**`data-overlap`**: Present when overlapping
### ActionTrigger
#### Props
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
### CloseTrigger
#### Props
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
### Description
#### Props
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
### Title
#### Props
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
### Toaster
#### Props
**`toaster`**
Type: `CreateToasterReturn`
Required: true
Default Value: `undefined`
Description: undefined
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
**`dir`**
Type: `'rtl' | 'ltr'`
Required: false
Default Value: `"ltr"`
Description: The document's text/writing direction.
**`getRootNode`**
Type: `() => Node | ShadowRoot | Document`
Required: false
Default Value: `undefined`
Description: A root node to correctly resolve document in custom environments. E.x.: Iframes, Electron.
# Toast (SOLID)
## Anatomy
To set up the toast correctly, you'll need to understand its anatomy and how we name its parts.
> Each part includes a `data-part` attribute to help identify them in the DOM.
## Setup
To use the Toast component, create the toast engine using the `createToaster` function.
This function manages the placement and grouping of toasts, and provides a `toast` object needed to create toast
notification.
```ts
const toaster = createToaster({
placement: 'bottom-end',
overlap: true,
gap: 24,
})
```
## Examples
Here's an example of creating a toast using the `toast.create` method.
```tsx
import { Toast, Toaster, createToaster } from '@ark-ui/solid/toast'
import { XIcon } from 'lucide-solid'
export const Basic = () => {
const toaster = createToaster({
placement: 'bottom-end',
gap: 24,
})
return (
)
}
```
## API Reference
### Root
#### Props
**`asChild`**
Type: `(props: ParentProps<'div'>) => Element`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
#### Data Attributes
**`data-scope`**: toast
**`data-part`**: root
**`data-state`**: "open" | "closed"
**`data-type`**: The type of the item
**`data-placement`**: The placement of the toast
**`data-align`**:
**`data-side`**:
**`data-mounted`**: Present when mounted
**`data-paused`**: Present when paused
**`data-first`**:
**`data-sibling`**:
**`data-stack`**:
**`data-overlap`**: Present when overlapping
### ActionTrigger
#### Props
**`asChild`**
Type: `(props: ParentProps<'button'>) => Element`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
### CloseTrigger
#### Props
**`asChild`**
Type: `(props: ParentProps<'button'>) => Element`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
### Description
#### Props
**`asChild`**
Type: `(props: ParentProps<'div'>) => Element`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
### Title
#### Props
**`asChild`**
Type: `(props: ParentProps<'div'>) => Element`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
### Toaster
#### Props
**`toaster`**
Type: `CreateToasterReturn`
Required: true
Default Value: `undefined`
Description: undefined
**`asChild`**
Type: `(props: ParentProps<'div'>) => Element`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
**`dir`**
Type: `'ltr' | 'rtl'`
Required: false
Default Value: `"ltr"`
Description: The document's text/writing direction.
**`getRootNode`**
Type: `() => Node | ShadowRoot | Document`
Required: false
Default Value: `undefined`
Description: A root node to correctly resolve document in custom environments. E.x.: Iframes, Electron.
# Toast (VUE)
## Anatomy
To set up the toast correctly, you'll need to understand its anatomy and how we name its parts.
> Each part includes a `data-part` attribute to help identify them in the DOM.
## Setup
To use the Toast component, create the toast engine using the `createToaster` function.
This function manages the placement and grouping of toasts, and provides a `toast` object needed to create toast
notification.
```ts
const toaster = createToaster({
placement: 'bottom-end',
overlap: true,
gap: 24,
})
```
## Examples
Here's an example of creating a toast using the `toast.create` method.
```vue
{{ toast.title }}{{ toast.description }}ActionClose
```
### Update Toast
To update a toast, use the `toast.update` method.
```vue
{{ toast.title }}{{ toast.description }}
```
### Action
To add an action to a toast, use the `toast.action` property.
```vue
```
## API Reference
### Root
#### Props
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
#### Data Attributes
**`data-scope`**: toast
**`data-part`**: root
**`data-state`**: "open" | "closed"
**`data-type`**: The type of the item
**`data-placement`**: The placement of the toast
**`data-align`**:
**`data-side`**:
**`data-mounted`**: Present when mounted
**`data-paused`**: Present when paused
**`data-first`**:
**`data-sibling`**:
**`data-stack`**:
**`data-overlap`**: Present when overlapping
### ActionTrigger
#### Props
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
### CloseTrigger
#### Props
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
### Description
#### Props
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
### Title
#### Props
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
### Toaster
#### Props
**`toaster`**
Type: `CreateToasterReturn`
Required: true
Default Value: `undefined`
Description: undefined
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
# Toggle Group (REACT)
## Anatomy
To set up the toggle group correctly, you'll need to understand its anatomy and how we name its parts.
> Each part includes a `data-part` attribute to help identify them in the DOM.
## Examples
Learn how to use the `ToggleGroup` component in your project. Let's take a look at the most basic example:
```tsx
import { ToggleGroup } from '@ark-ui/react/toggle-group'
export const Basic = () => {
return (
ABC
)
}
```
### Multiple Selection
Demonstrates how to enable `multiple` selection within the group.
```tsx
import { ToggleGroup } from '@ark-ui/react/toggle-group'
export const Multiple = () => {
return (
ABC
)
}
```
### Initial Value
Shows how to set an initial value in the toggle group.
```tsx
import { ToggleGroup } from '@ark-ui/react/toggle-group'
export const InitialValue = () => {
return (
ABC
)
}
```
### Using the Root Provider
The `RootProvider` component provides a context for the toggle-group. It accepts the value of the `useToggle-group`
hook. You can leverage it to access the component state and methods from outside the toggle-group.
```tsx
import { ToggleGroup, useToggleGroup } from '@ark-ui/react/toggle-group'
export const RootProvider = () => {
const toggleGroup = useToggleGroup()
return (
<>
ABC
>
)
}
```
> If you're using the `RootProvider` component, you don't need to use the `Root` component.
## API Reference
### Root
#### Props
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
**`defaultValue`**
Type: `string[]`
Required: false
Default Value: `undefined`
Description: The initial selected value of the toggle group when rendered.
Use when you don't need to control the selected value of the toggle group.
**`disabled`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Whether the toggle is disabled.
**`id`**
Type: `string`
Required: false
Default Value: `undefined`
Description: The unique identifier of the machine.
**`ids`**
Type: `Partial<{ root: string; item(value: string): string }>`
Required: false
Default Value: `undefined`
Description: The ids of the elements in the toggle. Useful for composition.
**`loopFocus`**
Type: `boolean`
Required: false
Default Value: `true`
Description: Whether to loop focus inside the toggle group.
**`multiple`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Whether to allow multiple toggles to be selected.
**`onValueChange`**
Type: `(details: ValueChangeDetails) => void`
Required: false
Default Value: `undefined`
Description: Function to call when the toggle is clicked.
**`orientation`**
Type: `Orientation`
Required: false
Default Value: `"horizontal"`
Description: The orientation of the toggle group.
**`rovingFocus`**
Type: `boolean`
Required: false
Default Value: `true`
Description: Whether to use roving tab index to manage focus.
**`value`**
Type: `string[]`
Required: false
Default Value: `undefined`
Description: The controlled selected value of the toggle group.
#### Data Attributes
**`data-scope`**: toggle-group
**`data-part`**: root
**`data-disabled`**: Present when disabled
**`data-orientation`**: The orientation of the toggle-group
**`data-focus`**: Present when focused
### Item
#### Props
**`value`**
Type: `string`
Required: true
Default Value: `undefined`
Description: undefined
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
**`disabled`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: undefined
#### Data Attributes
**`data-scope`**: toggle-group
**`data-part`**: item
**`data-focus`**: Present when focused
**`data-disabled`**: Present when disabled
**`data-orientation`**: The orientation of the item
**`data-state`**: "on" | "off"
### RootProvider
#### Props
**`value`**
Type: `UseToggleGroupReturn`
Required: true
Default Value: `undefined`
Description: undefined
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
## Accessibility
### Keyboard Support
**`Tab`**
Description: Moves focus to either the pressed item or the first item in the group.
**`Space`**
Description: Activates/deactivates the item.
**`Enter`**
Description: Activates/deactivates the item.
**`ArrowDown`**
Description: Moves focus to the next item in the group.
**`ArrowRight`**
Description: Moves focus to the next item in the group.
**`ArrowUp`**
Description: Moves focus to the previous item in the group.
**`ArrowLeft`**
Description: Moves focus to the previous item in the group.
**`Home`**
Description: Moves focus to the first item.
**`End`**
Description: Moves focus to the last item.
# Toggle Group (SOLID)
## Anatomy
To set up the toggle group correctly, you'll need to understand its anatomy and how we name its parts.
> Each part includes a `data-part` attribute to help identify them in the DOM.
## Examples
Learn how to use the `ToggleGroup` component in your project. Let's take a look at the most basic example:
```tsx
import { ToggleGroup } from '@ark-ui/solid/toggle-group'
export const Basic = () => {
return (
ABC
)
}
```
### Multiple Selection
Demonstrates how to enable `multiple` selection within the group.
```tsx
import { ToggleGroup } from '@ark-ui/solid/toggle-group'
export const Multiple = () => {
return (
ABC
)
}
```
### Initial Value
Shows how to set an initial value in the toggle group.
```tsx
import { ToggleGroup } from '@ark-ui/solid/toggle-group'
export const InitialValue = () => {
return (
ABC
)
}
```
### Using the Root Provider
The `RootProvider` component provides a context for the toggle-group. It accepts the value of the `useToggle-group`
hook. You can leverage it to access the component state and methods from outside the toggle-group.
```tsx
import { ToggleGroup, useToggleGroup } from '@ark-ui/solid/toggle-group'
export const RootProvider = () => {
const toggleGroup = useToggleGroup()
return (
<>
ABC
>
)
}
```
> If you're using the `RootProvider` component, you don't need to use the `Root` component.
## API Reference
### Root
#### Props
**`asChild`**
Type: `(props: ParentProps<'div'>) => Element`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
**`defaultValue`**
Type: `string[]`
Required: false
Default Value: `undefined`
Description: The initial selected value of the toggle group when rendered.
Use when you don't need to control the selected value of the toggle group.
**`disabled`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Whether the toggle is disabled.
**`ids`**
Type: `Partial<{ root: string; item(value: string): string }>`
Required: false
Default Value: `undefined`
Description: The ids of the elements in the toggle. Useful for composition.
**`loopFocus`**
Type: `boolean`
Required: false
Default Value: `true`
Description: Whether to loop focus inside the toggle group.
**`multiple`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Whether to allow multiple toggles to be selected.
**`onValueChange`**
Type: `(details: ValueChangeDetails) => void`
Required: false
Default Value: `undefined`
Description: Function to call when the toggle is clicked.
**`orientation`**
Type: `Orientation`
Required: false
Default Value: `"horizontal"`
Description: The orientation of the toggle group.
**`rovingFocus`**
Type: `boolean`
Required: false
Default Value: `true`
Description: Whether to use roving tab index to manage focus.
**`value`**
Type: `string[]`
Required: false
Default Value: `undefined`
Description: The controlled selected value of the toggle group.
#### Data Attributes
**`data-scope`**: toggle-group
**`data-part`**: root
**`data-disabled`**: Present when disabled
**`data-orientation`**: The orientation of the toggle-group
**`data-focus`**: Present when focused
### Item
#### Props
**`value`**
Type: `string`
Required: true
Default Value: `undefined`
Description: undefined
**`asChild`**
Type: `(props: ParentProps<'button'>) => Element`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
**`disabled`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: undefined
#### Data Attributes
**`data-scope`**: toggle-group
**`data-part`**: item
**`data-focus`**: Present when focused
**`data-disabled`**: Present when disabled
**`data-orientation`**: The orientation of the item
**`data-state`**: "on" | "off"
### RootProvider
#### Props
**`value`**
Type: `UseToggleGroupReturn`
Required: true
Default Value: `undefined`
Description: undefined
**`asChild`**
Type: `(props: ParentProps<'div'>) => Element`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
## Accessibility
### Keyboard Support
**`Tab`**
Description: Moves focus to either the pressed item or the first item in the group.
**`Space`**
Description: Activates/deactivates the item.
**`Enter`**
Description: Activates/deactivates the item.
**`ArrowDown`**
Description: Moves focus to the next item in the group.
**`ArrowRight`**
Description: Moves focus to the next item in the group.
**`ArrowUp`**
Description: Moves focus to the previous item in the group.
**`ArrowLeft`**
Description: Moves focus to the previous item in the group.
**`Home`**
Description: Moves focus to the first item.
**`End`**
Description: Moves focus to the last item.
# Toggle Group (VUE)
## Anatomy
To set up the toggle group correctly, you'll need to understand its anatomy and how we name its parts.
> Each part includes a `data-part` attribute to help identify them in the DOM.
## Examples
Learn how to use the `ToggleGroup` component in your project. Let's take a look at the most basic example:
```vue
ABC
```
### Multiple Selection
Demonstrates how to enable `multiple` selection within the group.
```vue
ABC
```
### Initial Value
Shows how to set an initial value in the toggle group.
```vue
ABC
```
### Using the Root Provider
The `RootProvider` component provides a context for the toggle-group. It accepts the value of the `useToggle-group`
hook. You can leverage it to access the component state and methods from outside the toggle-group.
```vue
ABC
```
> If you're using the `RootProvider` component, you don't need to use the `Root` component.
## API Reference
### Root
#### Props
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
**`defaultValue`**
Type: `string[]`
Required: false
Default Value: `undefined`
Description: The initial selected value of the toggle group when rendered.
Use when you don't need to control the selected value of the toggle group.
**`disabled`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Whether the toggle is disabled.
**`id`**
Type: `string`
Required: false
Default Value: `undefined`
Description: The unique identifier of the machine.
**`ids`**
Type: `Partial<{ root: string; item(value: string): string }>`
Required: false
Default Value: `undefined`
Description: The ids of the elements in the toggle. Useful for composition.
**`loopFocus`**
Type: `boolean`
Required: false
Default Value: `true`
Description: Whether to loop focus inside the toggle group.
**`modelValue`**
Type: `string[]`
Required: false
Default Value: `undefined`
Description: The v-model value of the toggle group
**`multiple`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Whether to allow multiple toggles to be selected.
**`orientation`**
Type: `Orientation`
Required: false
Default Value: `"horizontal"`
Description: The orientation of the toggle group.
**`rovingFocus`**
Type: `boolean`
Required: false
Default Value: `true`
Description: Whether to use roving tab index to manage focus.
#### Emits
**`update:modelValue`**
Type: `[value: string[]]`
Description: The callback fired when the model value changes.
**`valueChange`**
Type: `[details: ValueChangeDetails]`
Description: Function to call when the toggle is clicked.
#### Data Attributes
**`data-scope`**: toggle-group
**`data-part`**: root
**`data-disabled`**: Present when disabled
**`data-orientation`**: The orientation of the toggle-group
**`data-focus`**: Present when focused
### Item
#### Props
**`value`**
Type: `string`
Required: true
Default Value: `undefined`
Description: undefined
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
**`disabled`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: undefined
#### Data Attributes
**`data-scope`**: toggle-group
**`data-part`**: item
**`data-focus`**: Present when focused
**`data-disabled`**: Present when disabled
**`data-orientation`**: The orientation of the item
**`data-state`**: "on" | "off"
### RootProvider
#### Props
**`value`**
Type: `ToggleGroupApi`
Required: true
Default Value: `undefined`
Description: undefined
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
## Accessibility
### Keyboard Support
**`Tab`**
Description: Moves focus to either the pressed item or the first item in the group.
**`Space`**
Description: Activates/deactivates the item.
**`Enter`**
Description: Activates/deactivates the item.
**`ArrowDown`**
Description: Moves focus to the next item in the group.
**`ArrowRight`**
Description: Moves focus to the next item in the group.
**`ArrowUp`**
Description: Moves focus to the previous item in the group.
**`ArrowLeft`**
Description: Moves focus to the previous item in the group.
**`Home`**
Description: Moves focus to the first item.
**`End`**
Description: Moves focus to the last item.
# Toggle (REACT)
## Examples
Here's a basic example of how to use the `Toggle` component:
```tsx
import { Toggle } from '@ark-ui/react/toggle'
import { BoldIcon } from 'lucide-react'
export const Basic = () => {
return (
)
}
```
### Controlled
Use the `pressed` and `onPressedChange` props to control the toggle's state.
```tsx
import { Toggle } from '@ark-ui/react/toggle'
import { Volume, VolumeOff } from 'lucide-react'
import { useState } from 'react'
export const Controlled = () => {
const [pressed, setPressed] = useState(false)
return (
{pressed ? : }
Volume is {pressed ? 'unmuted' : 'muted'}
)
}
```
### Disabled
Use the `disabled` prop to disable the toggle.
```tsx
import { Toggle } from '@ark-ui/react/toggle'
import { BoldIcon } from 'lucide-react'
export const Disabled = () => {
return (
)
}
```
### Indicator
Use the `Toggle.Indicator` component to render different indicators based on the state of the toggle.
```tsx
import { Toggle } from '@ark-ui/react/toggle'
import { Volume, VolumeOff } from 'lucide-react'
export const Indicator = () => {
return (
}>
)
}
```
## API Reference
### Root
#### Props
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
**`defaultPressed`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: The default pressed state of the toggle.
**`onPressedChange`**
Type: `(pressed: boolean) => void`
Required: false
Default Value: `undefined`
Description: Event handler called when the pressed state of the toggle changes.
**`pressed`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: The pressed state of the toggle.
#### Data Attributes
**`data-scope`**: toggle
**`data-part`**: root
**`data-state`**: "on" | "off"
**`data-pressed`**: Present when pressed
**`data-disabled`**: Present when disabled
### Indicator
#### Props
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
**`fallback`**
Type: `string | number | bigint | boolean | ReactElement> | Iterable | ReactPortal | Promise<...>`
Required: false
Default Value: `undefined`
Description: The fallback content to render when the toggle is not pressed.
#### Data Attributes
**`data-scope`**: toggle
**`data-part`**: indicator
**`data-disabled`**: Present when disabled
**`data-pressed`**: Present when pressed
**`data-state`**: "on" | "off"
# Toggle (SOLID)
## Examples
Here's a basic example of how to use the `Toggle` component:
```tsx
import { Toggle } from '@ark-ui/solid/toggle'
import { BoldIcon } from 'lucide-solid'
export const Basic = () => {
return (
)
}
```
### Controlled
Use the `pressed` and `onPressedChange` props to control the toggle's state.
```tsx
import { Toggle } from '@ark-ui/solid/toggle'
import { Volume, VolumeOff } from 'lucide-solid'
import { Show, createSignal } from 'solid-js'
export const Controlled = () => {
const [pressed, setPressed] = createSignal(false)
return (
}>
Volume is {pressed() ? 'unmuted' : 'muted'}
)
}
```
### Disabled
Use the `disabled` prop to disable the toggle.
```tsx
import { Toggle } from '@ark-ui/solid/toggle'
import { BoldIcon } from 'lucide-solid'
export const Disabled = () => {
return (
)
}
```
### Indicator
Use the `Toggle.Indicator` component to render different indicators based on the state of the toggle.
```tsx
import { Toggle } from '@ark-ui/solid/toggle'
import { Volume, VolumeOff } from 'lucide-solid'
export const Indicator = () => {
return (
}>
)
}
```
## API Reference
### Root
#### Props
**`asChild`**
Type: `(props: ParentProps<'button'>) => Element`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
**`defaultPressed`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: The default pressed state of the toggle.
**`onPressedChange`**
Type: `(pressed: boolean) => void`
Required: false
Default Value: `undefined`
Description: Event handler called when the pressed state of the toggle changes.
**`pressed`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: The pressed state of the toggle.
#### Data Attributes
**`data-scope`**: toggle
**`data-part`**: root
**`data-state`**: "on" | "off"
**`data-pressed`**: Present when pressed
**`data-disabled`**: Present when disabled
### Indicator
#### Props
**`asChild`**
Type: `(props: ParentProps<'div'>) => Element`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
**`fallback`**
Type: `number | boolean | Node | ArrayElement | (string & {})`
Required: false
Default Value: `undefined`
Description: undefined
#### Data Attributes
**`data-scope`**: toggle
**`data-part`**: indicator
**`data-disabled`**: Present when disabled
**`data-pressed`**: Present when pressed
**`data-state`**: "on" | "off"
# Toggle (VUE)
## Examples
Here's a basic example of how to use the `Toggle` component:
```vue
```
### Controlled
Use the `pressed` and `onPressedChange` props to control the toggle's state.
```vue
Volume is {{ pressed ? 'unmuted' : 'muted' }}
```
### Disabled
Use the `disabled` prop to disable the toggle.
```vue
```
### Indicator
Use the `Toggle.Indicator` component to render different indicators based on the state of the toggle.
```vue
```
## API Reference
### Root
#### Props
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
**`defaultPressed`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: The default pressed state of the toggle.
**`onPressedChange`**
Type: `(pressed: boolean) => void`
Required: false
Default Value: `undefined`
Description: Event handler called when the pressed state of the toggle changes.
**`pressed`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: The pressed state of the toggle.
#### Data Attributes
**`data-scope`**: toggle
**`data-part`**: root
**`data-state`**: "on" | "off"
**`data-pressed`**: Present when pressed
**`data-disabled`**: Present when disabled
### Indicator
#### Props
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
**`fallback`**
Type: `slot`
Required: false
Default Value: `undefined`
Description: The fallback content to render when the toggle is not pressed.
#### Data Attributes
**`data-scope`**: toggle
**`data-part`**: indicator
**`data-disabled`**: Present when disabled
**`data-pressed`**: Present when pressed
**`data-state`**: "on" | "off"
# Tooltip (REACT)
## Anatomy
To set up the tooltip correctly, you'll need to understand its anatomy and how we name its parts.
> Each part includes a `data-part` attribute to help identify them in the DOM.
## Examples
Learn how to use the `Tooltip` component in your project. Let's take a look at the most basic example:
```tsx
import { Tooltip } from '@ark-ui/react/tooltip'
export const Basic = () => (
Hover MeI am a tooltip!
)
```
### Controlled Tooltip
To create a controlled Tooltip component, manage the state of whether the tooltip is open using the `open` prop:
```tsx
import { Tooltip } from '@ark-ui/react/tooltip'
import { useState } from 'react'
export const Controlled = () => {
const [isOpen, setIsOpen] = useState(false)
return (
<>
Hover MeI am a tooltip!
>
)
}
```
### Using a Render Function
For more control over the Tooltip's functionality, you can use a function as a child, which provides access to the
Tooltip API:
```tsx
import { Tooltip } from '@ark-ui/react/tooltip'
export const RenderFn = () => (
Hover Me
{(tooltip) => This tooltip is open: {tooltip.open.toString()}}
)
```
### Adding an Arrow
To display an arrow pointing to the trigger from the tooltip, use the `Tooltip.Arrow` and `Tooltip.ArrowTip` components:
```tsx
import { Tooltip } from '@ark-ui/react/tooltip'
export const Arrow = () => (
Hover Me
I am a tooltip!
)
```
### Configuring Delay Timings
To configure the delay timings for the Tooltip, use the `closeDelay` and `openDelay` props:
```tsx
import { Tooltip } from '@ark-ui/react/tooltip'
export const Timings = () => (
Hover MeI am a tooltip!
)
```
### Custom Positioning
To customize the position of the Tooltip relative to the trigger, use the `positioning` prop:
```tsx
import { Tooltip } from '@ark-ui/react/tooltip'
export const Positioning = () => (
Hover MeI am a tooltip!
)
```
### Using the Root Provider
The `RootProvider` component provides a context for the tooltip. It accepts the value of the `useTooltip` hook. You can
leverage it to access the component state and methods from outside the tooltip.
```tsx
import { Tooltip, useTooltip } from '@ark-ui/react/tooltip'
export const RootProvider = () => {
const tooltip = useTooltip()
return (
<>
Hover MeI am a tooltip!
>
)
}
```
> If you're using the `RootProvider` component, you don't need to use the `Root` component.
## API Reference
### Root
#### Props
**`aria-label`**
Type: `string`
Required: false
Default Value: `undefined`
Description: Custom label for the tooltip.
**`closeDelay`**
Type: `number`
Required: false
Default Value: `500`
Description: The close delay of the tooltip.
**`closeOnClick`**
Type: `boolean`
Required: false
Default Value: `true`
Description: Whether the tooltip should close on click
**`closeOnEscape`**
Type: `boolean`
Required: false
Default Value: `true`
Description: Whether to close the tooltip when the Escape key is pressed.
**`closeOnPointerDown`**
Type: `boolean`
Required: false
Default Value: `true`
Description: Whether to close the tooltip on pointerdown.
**`closeOnScroll`**
Type: `boolean`
Required: false
Default Value: `true`
Description: Whether the tooltip should close on scroll
**`defaultOpen`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: The initial open state of the tooltip when rendered.
Use when you don't need to control the open state of the tooltip.
**`disabled`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Whether the tooltip is disabled
**`id`**
Type: `string`
Required: false
Default Value: `undefined`
Description: The unique identifier of the machine.
**`ids`**
Type: `Partial<{ trigger: string; content: string; arrow: string; positioner: string }>`
Required: false
Default Value: `undefined`
Description: The ids of the elements in the tooltip. Useful for composition.
**`immediate`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Whether to synchronize the present change immediately or defer it to the next frame
**`interactive`**
Type: `boolean`
Required: false
Default Value: `false`
Description: Whether the tooltip's content is interactive.
In this mode, the tooltip will remain open when user hovers over the content.
**`lazyMount`**
Type: `boolean`
Required: false
Default Value: `false`
Description: Whether to enable lazy mounting
**`onExitComplete`**
Type: `VoidFunction`
Required: false
Default Value: `undefined`
Description: Function called when the animation ends in the closed state
**`onOpenChange`**
Type: `(details: OpenChangeDetails) => void`
Required: false
Default Value: `undefined`
Description: Function called when the tooltip is opened.
**`open`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: The controlled open state of the tooltip
**`openDelay`**
Type: `number`
Required: false
Default Value: `1000`
Description: The open delay of the tooltip.
**`positioning`**
Type: `PositioningOptions`
Required: false
Default Value: `undefined`
Description: The user provided options used to position the popover content
**`present`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Whether the node is present (controlled by the user)
**`unmountOnExit`**
Type: `boolean`
Required: false
Default Value: `false`
Description: Whether to unmount on exit.
### Arrow
#### Props
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
### ArrowTip
#### Props
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
### Content
#### Props
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
#### Data Attributes
**`data-scope`**: tooltip
**`data-part`**: content
**`data-state`**: "open" | "closed"
**`data-placement`**: The placement of the content
### Positioner
#### Props
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
### RootProvider
#### Props
**`value`**
Type: `UseTooltipReturn`
Required: true
Default Value: `undefined`
Description: undefined
**`immediate`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Whether to synchronize the present change immediately or defer it to the next frame
**`lazyMount`**
Type: `boolean`
Required: false
Default Value: `false`
Description: Whether to enable lazy mounting
**`onExitComplete`**
Type: `VoidFunction`
Required: false
Default Value: `undefined`
Description: Function called when the animation ends in the closed state
**`present`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Whether the node is present (controlled by the user)
**`unmountOnExit`**
Type: `boolean`
Required: false
Default Value: `false`
Description: Whether to unmount on exit.
### Trigger
#### Props
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
#### Data Attributes
**`data-scope`**: tooltip
**`data-part`**: trigger
**`data-expanded`**: Present when expanded
**`data-state`**: "open" | "closed"
## Accessibility
Complies with the [Tooltip WAI-ARIA design pattern](https://www.w3.org/WAI/ARIA/apg/patterns/tooltip/).
### Keyboard Support
**`Tab`**
Description: Opens/closes the tooltip without delay.
**`Escape`**
Description: If open, closes the tooltip without delay.
# Tooltip (SOLID)
## Anatomy
To set up the tooltip correctly, you'll need to understand its anatomy and how we name its parts.
> Each part includes a `data-part` attribute to help identify them in the DOM.
## Examples
Learn how to use the `Tooltip` component in your project. Let's take a look at the most basic example:
```tsx
import { Tooltip } from '@ark-ui/solid/tooltip'
import { Portal } from 'solid-js/web'
export const Basic = () => (
Hover MeI am a tooltip!
)
```
### Controlled Tooltip
To create a controlled Tooltip component, manage the state of whether the tooltip is open using the `open` prop:
```tsx
import { Tooltip } from '@ark-ui/solid/tooltip'
import { createSignal } from 'solid-js'
import { Portal } from 'solid-js/web'
export const Controlled = () => {
const [isOpen, setIsOpen] = createSignal(false)
return (
<>
Hover MeI am a tooltip!
>
)
}
```
### Using a Render Function
For more control over the Tooltip's functionality, you can use a function as a child, which provides access to the
Tooltip API:
```tsx
import { Tooltip } from '@ark-ui/solid/tooltip'
import { Portal } from 'solid-js/web'
export const RenderFn = () => (
Hover Me
{(context) => This tooltip is open: {context().open.toString()}}
)
```
### Adding an Arrow
To display an arrow pointing to the trigger from the tooltip, use the `Tooltip.Arrow` and `Tooltip.ArrowTip` components:
```tsx
import { Tooltip } from '@ark-ui/solid/tooltip'
import { Portal } from 'solid-js/web'
export const Arrow = () => (
Hover MeI am a tooltip!
)
```
### Configuring Delay Timings
To configure the delay timings for the Tooltip, use the `closeDelay` and `openDelay` props:
```tsx
import { Tooltip } from '@ark-ui/solid/tooltip'
import { Portal } from 'solid-js/web'
export const Timings = () => (
Hover MeI am a tooltip!
)
```
### Custom Positioning
To customize the position of the Tooltip relative to the trigger, use the `positioning` prop:
```tsx
import { Tooltip } from '@ark-ui/solid/tooltip'
import { Portal } from 'solid-js/web'
export const Positioning = () => (
Hover MeI am a tooltip!
)
```
### Using the Root Provider
The `RootProvider` component provides a context for the tooltip. It accepts the value of the `useTooltip` hook. You can
leverage it to access the component state and methods from outside the tooltip.
```tsx
import { Tooltip, useTooltip } from '@ark-ui/solid/tooltip'
import { Portal } from 'solid-js/web'
export const RootProvider = () => {
const tooltip = useTooltip()
return (
<>
Hover MeI am a tooltip!
>
)
}
```
> If you're using the `RootProvider` component, you don't need to use the `Root` component.
## API Reference
### Root
#### Props
**`aria-label`**
Type: `string`
Required: false
Default Value: `undefined`
Description: Custom label for the tooltip.
**`closeDelay`**
Type: `number`
Required: false
Default Value: `500`
Description: The close delay of the tooltip.
**`closeOnClick`**
Type: `boolean`
Required: false
Default Value: `true`
Description: Whether the tooltip should close on click
**`closeOnEscape`**
Type: `boolean`
Required: false
Default Value: `true`
Description: Whether to close the tooltip when the Escape key is pressed.
**`closeOnPointerDown`**
Type: `boolean`
Required: false
Default Value: `true`
Description: Whether to close the tooltip on pointerdown.
**`closeOnScroll`**
Type: `boolean`
Required: false
Default Value: `true`
Description: Whether the tooltip should close on scroll
**`defaultOpen`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: The initial open state of the tooltip when rendered.
Use when you don't need to control the open state of the tooltip.
**`disabled`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Whether the tooltip is disabled
**`id`**
Type: `string`
Required: false
Default Value: `undefined`
Description: The unique identifier of the machine.
**`ids`**
Type: `Partial<{ trigger: string; content: string; arrow: string; positioner: string }>`
Required: false
Default Value: `undefined`
Description: The ids of the elements in the tooltip. Useful for composition.
**`immediate`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Whether to synchronize the present change immediately or defer it to the next frame
**`interactive`**
Type: `boolean`
Required: false
Default Value: `false`
Description: Whether the tooltip's content is interactive.
In this mode, the tooltip will remain open when user hovers over the content.
**`lazyMount`**
Type: `boolean`
Required: false
Default Value: `false`
Description: Whether to enable lazy mounting
**`onExitComplete`**
Type: `VoidFunction`
Required: false
Default Value: `undefined`
Description: Function called when the animation ends in the closed state
**`onOpenChange`**
Type: `(details: OpenChangeDetails) => void`
Required: false
Default Value: `undefined`
Description: Function called when the tooltip is opened.
**`open`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: The controlled open state of the tooltip
**`openDelay`**
Type: `number`
Required: false
Default Value: `1000`
Description: The open delay of the tooltip.
**`positioning`**
Type: `PositioningOptions`
Required: false
Default Value: `undefined`
Description: The user provided options used to position the popover content
**`present`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Whether the node is present (controlled by the user)
**`unmountOnExit`**
Type: `boolean`
Required: false
Default Value: `false`
Description: Whether to unmount on exit.
### Arrow
#### Props
**`asChild`**
Type: `(props: ParentProps<'div'>) => Element`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
### ArrowTip
#### Props
**`asChild`**
Type: `(props: ParentProps<'div'>) => Element`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
### Content
#### Props
**`asChild`**
Type: `(props: ParentProps<'div'>) => Element`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
#### Data Attributes
**`data-scope`**: tooltip
**`data-part`**: content
**`data-state`**: "open" | "closed"
**`data-placement`**: The placement of the content
### Positioner
#### Props
**`asChild`**
Type: `(props: ParentProps<'div'>) => Element`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
### RootProvider
#### Props
**`value`**
Type: `UseTooltipReturn`
Required: true
Default Value: `undefined`
Description: undefined
**`immediate`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Whether to synchronize the present change immediately or defer it to the next frame
**`lazyMount`**
Type: `boolean`
Required: false
Default Value: `false`
Description: Whether to enable lazy mounting
**`onExitComplete`**
Type: `VoidFunction`
Required: false
Default Value: `undefined`
Description: Function called when the animation ends in the closed state
**`present`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Whether the node is present (controlled by the user)
**`unmountOnExit`**
Type: `boolean`
Required: false
Default Value: `false`
Description: Whether to unmount on exit.
### Trigger
#### Props
**`asChild`**
Type: `(props: ParentProps<'button'>) => Element`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
#### Data Attributes
**`data-scope`**: tooltip
**`data-part`**: trigger
**`data-expanded`**: Present when expanded
**`data-state`**: "open" | "closed"
## Accessibility
Complies with the [Tooltip WAI-ARIA design pattern](https://www.w3.org/WAI/ARIA/apg/patterns/tooltip/).
### Keyboard Support
**`Tab`**
Description: Opens/closes the tooltip without delay.
**`Escape`**
Description: If open, closes the tooltip without delay.
# Tooltip (VUE)
## Anatomy
To set up the tooltip correctly, you'll need to understand its anatomy and how we name its parts.
> Each part includes a `data-part` attribute to help identify them in the DOM.
## Examples
Learn how to use the `Tooltip` component in your project. Let's take a look at the most basic example:
```vue
Hover MeI am a tooltip!
```
### Controlled Tooltip
To create a controlled Tooltip component, manage the state of whether the tooltip is open using the `open` prop:
```vue
Hover MeI am a tooltip!
```
### Using a Render Function
For more control over the Tooltip's functionality, you can use a function as a child, which provides access to the
Tooltip API:
```vue
Hover MeThis tooltip is open: {{ tooltip.open.toString() }}
```
### Adding an Arrow
To display an arrow pointing to the trigger from the tooltip, use the `Tooltip.Arrow` and `Tooltip.ArrowTip` components:
```vue
Hover Me
I am a tooltip!
```
### Configuring Delay Timings
To configure the delay timings for the Tooltip, use the `closeDelay` and `openDelay` props:
```vue
Hover MeI am a tooltip!
```
### Custom Positioning
To customize the position of the Tooltip relative to the trigger, use the `positioning` prop:
```vue
Hover MeI am a tooltip!
```
### Using the Root Provider
The `RootProvider` component provides a context for the tooltip. It accepts the value of the `useTooltip` hook. You can
leverage it to access the component state and methods from outside the tooltip.
```vue
Hover MeI am a tooltip!
```
> If you're using the `RootProvider` component, you don't need to use the `Root` component.
## API Reference
### Root
#### Props
**`aria-label`**
Type: `string`
Required: false
Default Value: `undefined`
Description: Custom label for the tooltip.
**`closeDelay`**
Type: `number`
Required: false
Default Value: `500`
Description: The close delay of the tooltip.
**`closeOnClick`**
Type: `boolean`
Required: false
Default Value: `true`
Description: Whether the tooltip should close on click
**`closeOnEscape`**
Type: `boolean`
Required: false
Default Value: `true`
Description: Whether to close the tooltip when the Escape key is pressed.
**`closeOnPointerDown`**
Type: `boolean`
Required: false
Default Value: `true`
Description: Whether to close the tooltip on pointerdown.
**`closeOnScroll`**
Type: `boolean`
Required: false
Default Value: `true`
Description: Whether the tooltip should close on scroll
**`defaultOpen`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: The initial open state of the tooltip when rendered.
Use when you don't need to control the open state of the tooltip.
**`disabled`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Whether the tooltip is disabled
**`id`**
Type: `string`
Required: false
Default Value: `undefined`
Description: The unique identifier of the machine.
**`ids`**
Type: `Partial<{ trigger: string; content: string; arrow: string; positioner: string }>`
Required: false
Default Value: `undefined`
Description: The ids of the elements in the tooltip. Useful for composition.
**`interactive`**
Type: `boolean`
Required: false
Default Value: `false`
Description: Whether the tooltip's content is interactive.
In this mode, the tooltip will remain open when user hovers over the content.
**`lazyMount`**
Type: `boolean`
Required: false
Default Value: `false`
Description: Whether to enable lazy mounting
**`open`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: The controlled open state of the tooltip
**`openDelay`**
Type: `number`
Required: false
Default Value: `1000`
Description: The open delay of the tooltip.
**`positioning`**
Type: `PositioningOptions`
Required: false
Default Value: `undefined`
Description: The user provided options used to position the popover content
**`unmountOnExit`**
Type: `boolean`
Required: false
Default Value: `false`
Description: Whether to unmount on exit.
#### Emits
**`openChange`**
Type: `[details: OpenChangeDetails]`
Description: Function called when the tooltip is opened.
**`update:open`**
Type: `[open: boolean]`
Description: The callback fired when the open state changes.
### Arrow
#### Props
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
### ArrowTip
#### Props
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
### Content
#### Props
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
#### Data Attributes
**`data-scope`**: tooltip
**`data-part`**: content
**`data-state`**: "open" | "closed"
**`data-placement`**: The placement of the content
### Positioner
#### Props
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
### RootProvider
#### Props
**`value`**
Type: `TooltipApi`
Required: true
Default Value: `undefined`
Description: undefined
**`lazyMount`**
Type: `boolean`
Required: false
Default Value: `false`
Description: Whether to enable lazy mounting
**`unmountOnExit`**
Type: `boolean`
Required: false
Default Value: `false`
Description: Whether to unmount on exit.
### Trigger
#### Props
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
#### Data Attributes
**`data-scope`**: tooltip
**`data-part`**: trigger
**`data-expanded`**: Present when expanded
**`data-state`**: "open" | "closed"
## Accessibility
Complies with the [Tooltip WAI-ARIA design pattern](https://www.w3.org/WAI/ARIA/apg/patterns/tooltip/).
### Keyboard Support
**`Tab`**
Description: Opens/closes the tooltip without delay.
**`Escape`**
Description: If open, closes the tooltip without delay.
# Tour (REACT)
## Features
- Support for different step types such as "dialog", "floating", "tooltip" or "wait"
- Support for customizable content per step
- Wait steps for waiting for a specific selector to appear on the page before showing the next step
- Flexible positioning of the tour dialog per step
- Progress tracking shows users their progress through the tour
## Anatomy
To set up the tour correctly, it's essential to understand its anatomy and the naming of its parts.
> Each part includes a `data-part` attribute to help identify them in the DOM.
## Steps
### Using step types
The tour machine supports different types of steps, allowing you to create a diverse and interactive tour experience.
The available step types are defined in the `StepType` type:
- `tooltip`: Displays the step content as a tooltip, typically positioned near the target element.
- `dialog`: Shows the step content in a modal dialog centered on screen, useful for starting or ending the tour. This
usually don't have a `target` defined.
- `floating`: Presents the step content as a floating element, which can be positioned flexibly on the screen. This
usually don't have a `target` defined.
- `wait`: A special type that waits for a specific condition before proceeding to the next step.
```tsx
const steps: TourStepDetails[] = [
{
id: 'step-1',
type: 'tooltip',
placement: 'top-start',
target: () => document.querySelector('#target-1'),
title: 'Tooltip Step',
description: 'This is a tooltip step',
},
{
id: 'step-2',
type: 'dialog',
title: 'Dialog Step',
description: 'This is a dialog step',
},
{
id: 'step-3',
type: 'floating',
placement: 'top-start',
title: 'Floating Step',
description: 'This is a floating step',
},
{
id: 'step-4',
type: 'wait',
title: 'Wait Step',
description: 'This is a wait step',
effect({ next }) {
// do something and go next
// you can also return a cleanup
},
},
]
```
### Configuring actions
Every step supports a list of actions that are rendered in the step footer.Use the `actions` property to define each
action.
```tsx
const steps: TourStepDetails[] = [
{
id: 'step-1',
type: 'dialog',
title: 'Dialog Step',
description: 'This is a dialog step',
actions: [{ label: 'Show me a tour!', action: 'next' }],
},
]
```
### Changing tooltip placement
Use the `placement` property to define the placement of the tooltip.
```tsx {5}
const steps: TourStepDetails[] = [
{
id: 'step-1',
type: 'tooltip',
placement: 'top-start',
// ...
},
]
```
### Hiding the arrow
Set `arrow: false` in the step property to hide the tooltip arrow. This is only useful for tooltip steps.
```tsx {5}
const steps: TourStepDetails[] = [
{
id: 'step-1',
type: 'tooltip',
arrow: false,
},
]
```
### Hiding the backdrop
Set `backdrop: false` in the step property to hide the backdrop. This applies to all step types except the `wait` step.
```tsx {5}
const steps: TourStepDetails[] = [
{
id: 'step-1',
type: 'dialog',
backdrop: false,
},
]
```
### Step Effects
Step effects are functions that are called before a step is opened. They are useful for adding custom logic to a step.
This function provides the following methods:
- `next()`: Call this method to move to the next step.
- `show()`: Call this method to show the current step.
- `update(details: StepDetails)`: Call this method to update the details of the current step (say, after data has been
fetched).
```tsx
const steps: TourStepDetails[] = [
{
id: 'step-1',
type: 'tooltip',
effect({ next, show, update }) {
fetchData().then((res) => {
// update the step details
update({ title: res.title })
// then show show the step
show()
})
return () => {
// cleanup fetch data
}
},
},
]
```
### Wait Steps
Wait steps are useful when you need to wait for a specific condition before proceeding to the next step.
Use the step `effect` function to perform an action and then call `next()` to move to the next step.
> **Note:** You cannot call `show()` in a wait step.
```tsx
const steps: TourStepDetails[] = [
{
id: 'step-1',
type: 'wait',
effect({ next }) {
const button = document.querySelector('#button')
const listener = () => next()
button.addEventListener('click', listener)
return () => button.removeEventListener('click', listener)
},
},
]
```
## Styling guide
Ensure the `box-sizing` is set to `border-box` for the means of measuring the tour target.
```css
* {
box-sizing: border-box;
}
```
Ensure the `body` has a `position` of `relative`.
```css
body {
position: relative;
}
```
## API Reference
### Root
#### Props
**`tour`**
Type: `UseTourReturn`
Required: true
Default Value: `undefined`
Description: undefined
**`immediate`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Whether to synchronize the present change immediately or defer it to the next frame
**`lazyMount`**
Type: `boolean`
Required: false
Default Value: `false`
Description: Whether to enable lazy mounting
**`onExitComplete`**
Type: `VoidFunction`
Required: false
Default Value: `undefined`
Description: Function called when the animation ends in the closed state
**`present`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Whether the node is present (controlled by the user)
**`unmountOnExit`**
Type: `boolean`
Required: false
Default Value: `false`
Description: Whether to unmount on exit.
### ActionTrigger
#### Props
**`action`**
Type: `StepAction`
Required: true
Default Value: `undefined`
Description: undefined
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
#### Data Attributes
**`data-scope`**: tour
**`data-part`**: action-trigger
**`data-type`**: The type of the item
**`data-disabled`**: Present when disabled
### Arrow
#### Props
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
### ArrowTip
#### Props
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
### Backdrop
#### Props
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
#### Data Attributes
**`data-scope`**: tour
**`data-part`**: backdrop
**`data-state`**: "open" | "closed"
**`data-type`**: The type of the item
### CloseTrigger
#### Props
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
#### Data Attributes
**`data-scope`**: tour
**`data-part`**: close-trigger
**`data-type`**: The type of the item
### Content
#### Props
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
#### Data Attributes
**`data-scope`**: tour
**`data-part`**: content
**`data-state`**: "open" | "closed"
**`data-type`**: The type of the item
**`data-placement`**: The placement of the content
**`data-step`**:
### Control
#### Props
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
### Description
#### Props
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
#### Data Attributes
**`data-scope`**: tour
**`data-part`**: description
**`data-placement`**: The placement of the description
### Positioner
#### Props
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
#### Data Attributes
**`data-scope`**: tour
**`data-part`**: positioner
**`data-type`**: The type of the item
**`data-placement`**: The placement of the positioner
### ProgressText
#### Props
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
### Spotlight
#### Props
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
### Title
#### Props
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
#### Data Attributes
**`data-scope`**: tour
**`data-part`**: title
**`data-placement`**: The placement of the title
# Tour (SOLID)
## Features
- Support for different step types such as "dialog", "floating", "tooltip" or "wait"
- Support for customizable content per step
- Wait steps for waiting for a specific selector to appear on the page before showing the next step
- Flexible positioning of the tour dialog per step
- Progress tracking shows users their progress through the tour
## Anatomy
To set up the tour correctly, it's essential to understand its anatomy and the naming of its parts.
> Each part includes a `data-part` attribute to help identify them in the DOM.
## Steps
### Using step types
The tour machine supports different types of steps, allowing you to create a diverse and interactive tour experience.
The available step types are defined in the `StepType` type:
- `tooltip`: Displays the step content as a tooltip, typically positioned near the target element.
- `dialog`: Shows the step content in a modal dialog centered on screen, useful for starting or ending the tour. This
usually don't have a `target` defined.
- `floating`: Presents the step content as a floating element, which can be positioned flexibly on the screen. This
usually don't have a `target` defined.
- `wait`: A special type that waits for a specific condition before proceeding to the next step.
```tsx
const steps: TourStepDetails[] = [
{
id: 'step-1',
type: 'tooltip',
placement: 'top-start',
target: () => document.querySelector('#target-1'),
title: 'Tooltip Step',
description: 'This is a tooltip step',
},
{
id: 'step-2',
type: 'dialog',
title: 'Dialog Step',
description: 'This is a dialog step',
},
{
id: 'step-3',
type: 'floating',
placement: 'top-start',
title: 'Floating Step',
description: 'This is a floating step',
},
{
id: 'step-4',
type: 'wait',
title: 'Wait Step',
description: 'This is a wait step',
effect({ next }) {
// do something and go next
// you can also return a cleanup
},
},
]
```
### Configuring actions
Every step supports a list of actions that are rendered in the step footer.Use the `actions` property to define each
action.
```tsx
const steps: TourStepDetails[] = [
{
id: 'step-1',
type: 'dialog',
title: 'Dialog Step',
description: 'This is a dialog step',
actions: [{ label: 'Show me a tour!', action: 'next' }],
},
]
```
### Changing tooltip placement
Use the `placement` property to define the placement of the tooltip.
```tsx {5}
const steps: TourStepDetails[] = [
{
id: 'step-1',
type: 'tooltip',
placement: 'top-start',
// ...
},
]
```
### Hiding the arrow
Set `arrow: false` in the step property to hide the tooltip arrow. This is only useful for tooltip steps.
```tsx {5}
const steps: TourStepDetails[] = [
{
id: 'step-1',
type: 'tooltip',
arrow: false,
},
]
```
### Hiding the backdrop
Set `backdrop: false` in the step property to hide the backdrop. This applies to all step types except the `wait` step.
```tsx {5}
const steps: TourStepDetails[] = [
{
id: 'step-1',
type: 'dialog',
backdrop: false,
},
]
```
### Step Effects
Step effects are functions that are called before a step is opened. They are useful for adding custom logic to a step.
This function provides the following methods:
- `next()`: Call this method to move to the next step.
- `show()`: Call this method to show the current step.
- `update(details: StepDetails)`: Call this method to update the details of the current step (say, after data has been
fetched).
```tsx
const steps: TourStepDetails[] = [
{
id: 'step-1',
type: 'tooltip',
effect({ next, show, update }) {
fetchData().then((res) => {
// update the step details
update({ title: res.title })
// then show show the step
show()
})
return () => {
// cleanup fetch data
}
},
},
]
```
### Wait Steps
Wait steps are useful when you need to wait for a specific condition before proceeding to the next step.
Use the step `effect` function to perform an action and then call `next()` to move to the next step.
> **Note:** You cannot call `show()` in a wait step.
```tsx
const steps: TourStepDetails[] = [
{
id: 'step-1',
type: 'wait',
effect({ next }) {
const button = document.querySelector('#button')
const listener = () => next()
button.addEventListener('click', listener)
return () => button.removeEventListener('click', listener)
},
},
]
```
## Styling guide
Ensure the `box-sizing` is set to `border-box` for the means of measuring the tour target.
```css
* {
box-sizing: border-box;
}
```
Ensure the `body` has a `position` of `relative`.
```css
body {
position: relative;
}
```
## API Reference
### Root
#### Props
**`tour`**
Type: `UseTourReturn`
Required: true
Default Value: `undefined`
Description: undefined
**`immediate`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Whether to synchronize the present change immediately or defer it to the next frame
**`lazyMount`**
Type: `boolean`
Required: false
Default Value: `false`
Description: Whether to enable lazy mounting
**`onExitComplete`**
Type: `VoidFunction`
Required: false
Default Value: `undefined`
Description: Function called when the animation ends in the closed state
**`present`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Whether the node is present (controlled by the user)
**`unmountOnExit`**
Type: `boolean`
Required: false
Default Value: `false`
Description: Whether to unmount on exit.
### ActionTrigger
#### Props
**`action`**
Type: `StepAction`
Required: true
Default Value: `undefined`
Description: undefined
**`asChild`**
Type: `(props: ParentProps<'button'>) => Element`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
#### Data Attributes
**`data-scope`**: tour
**`data-part`**: action-trigger
**`data-type`**: The type of the item
**`data-disabled`**: Present when disabled
### Arrow
#### Props
**`asChild`**
Type: `(props: ParentProps<'div'>) => Element`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
### ArrowTip
#### Props
**`asChild`**
Type: `(props: ParentProps<'div'>) => Element`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
### Backdrop
#### Props
**`asChild`**
Type: `(props: ParentProps<'div'>) => Element`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
#### Data Attributes
**`data-scope`**: tour
**`data-part`**: backdrop
**`data-state`**: "open" | "closed"
**`data-type`**: The type of the item
### CloseTrigger
#### Props
**`asChild`**
Type: `(props: ParentProps<'button'>) => Element`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
#### Data Attributes
**`data-scope`**: tour
**`data-part`**: close-trigger
**`data-type`**: The type of the item
### Content
#### Props
**`asChild`**
Type: `(props: ParentProps<'div'>) => Element`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
#### Data Attributes
**`data-scope`**: tour
**`data-part`**: content
**`data-state`**: "open" | "closed"
**`data-type`**: The type of the item
**`data-placement`**: The placement of the content
**`data-step`**:
### Control
#### Props
**`asChild`**
Type: `(props: ParentProps<'div'>) => Element`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
### Description
#### Props
**`asChild`**
Type: `(props: ParentProps<'div'>) => Element`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
#### Data Attributes
**`data-scope`**: tour
**`data-part`**: description
**`data-placement`**: The placement of the description
### Positioner
#### Props
**`asChild`**
Type: `(props: ParentProps<'div'>) => Element`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
#### Data Attributes
**`data-scope`**: tour
**`data-part`**: positioner
**`data-type`**: The type of the item
**`data-placement`**: The placement of the positioner
### ProgressText
#### Props
**`asChild`**
Type: `(props: ParentProps<'div'>) => Element`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
### Spotlight
#### Props
**`asChild`**
Type: `(props: ParentProps<'div'>) => Element`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
### Title
#### Props
**`asChild`**
Type: `(props: ParentProps<'h2'>) => Element`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
#### Data Attributes
**`data-scope`**: tour
**`data-part`**: title
**`data-placement`**: The placement of the title
# Tour (VUE)
## Features
- Support for different step types such as "dialog", "floating", "tooltip" or "wait"
- Support for customizable content per step
- Wait steps for waiting for a specific selector to appear on the page before showing the next step
- Flexible positioning of the tour dialog per step
- Progress tracking shows users their progress through the tour
## Anatomy
To set up the tour correctly, it's essential to understand its anatomy and the naming of its parts.
> Each part includes a `data-part` attribute to help identify them in the DOM.
## Steps
### Using step types
The tour machine supports different types of steps, allowing you to create a diverse and interactive tour experience.
The available step types are defined in the `StepType` type:
- `tooltip`: Displays the step content as a tooltip, typically positioned near the target element.
- `dialog`: Shows the step content in a modal dialog centered on screen, useful for starting or ending the tour. This
usually don't have a `target` defined.
- `floating`: Presents the step content as a floating element, which can be positioned flexibly on the screen. This
usually don't have a `target` defined.
- `wait`: A special type that waits for a specific condition before proceeding to the next step.
```tsx
const steps: TourStepDetails[] = [
{
id: 'step-1',
type: 'tooltip',
placement: 'top-start',
target: () => document.querySelector('#target-1'),
title: 'Tooltip Step',
description: 'This is a tooltip step',
},
{
id: 'step-2',
type: 'dialog',
title: 'Dialog Step',
description: 'This is a dialog step',
},
{
id: 'step-3',
type: 'floating',
placement: 'top-start',
title: 'Floating Step',
description: 'This is a floating step',
},
{
id: 'step-4',
type: 'wait',
title: 'Wait Step',
description: 'This is a wait step',
effect({ next }) {
// do something and go next
// you can also return a cleanup
},
},
]
```
### Configuring actions
Every step supports a list of actions that are rendered in the step footer.Use the `actions` property to define each
action.
```tsx
const steps: TourStepDetails[] = [
{
id: 'step-1',
type: 'dialog',
title: 'Dialog Step',
description: 'This is a dialog step',
actions: [{ label: 'Show me a tour!', action: 'next' }],
},
]
```
### Changing tooltip placement
Use the `placement` property to define the placement of the tooltip.
```tsx {5}
const steps: TourStepDetails[] = [
{
id: 'step-1',
type: 'tooltip',
placement: 'top-start',
// ...
},
]
```
### Hiding the arrow
Set `arrow: false` in the step property to hide the tooltip arrow. This is only useful for tooltip steps.
```tsx {5}
const steps: TourStepDetails[] = [
{
id: 'step-1',
type: 'tooltip',
arrow: false,
},
]
```
### Hiding the backdrop
Set `backdrop: false` in the step property to hide the backdrop. This applies to all step types except the `wait` step.
```tsx {5}
const steps: TourStepDetails[] = [
{
id: 'step-1',
type: 'dialog',
backdrop: false,
},
]
```
### Step Effects
Step effects are functions that are called before a step is opened. They are useful for adding custom logic to a step.
This function provides the following methods:
- `next()`: Call this method to move to the next step.
- `show()`: Call this method to show the current step.
- `update(details: StepDetails)`: Call this method to update the details of the current step (say, after data has been
fetched).
```tsx
const steps: TourStepDetails[] = [
{
id: 'step-1',
type: 'tooltip',
effect({ next, show, update }) {
fetchData().then((res) => {
// update the step details
update({ title: res.title })
// then show show the step
show()
})
return () => {
// cleanup fetch data
}
},
},
]
```
### Wait Steps
Wait steps are useful when you need to wait for a specific condition before proceeding to the next step.
Use the step `effect` function to perform an action and then call `next()` to move to the next step.
> **Note:** You cannot call `show()` in a wait step.
```tsx
const steps: TourStepDetails[] = [
{
id: 'step-1',
type: 'wait',
effect({ next }) {
const button = document.querySelector('#button')
const listener = () => next()
button.addEventListener('click', listener)
return () => button.removeEventListener('click', listener)
},
},
]
```
## Styling guide
Ensure the `box-sizing` is set to `border-box` for the means of measuring the tour target.
```css
* {
box-sizing: border-box;
}
```
Ensure the `body` has a `position` of `relative`.
```css
body {
position: relative;
}
```
## API Reference
### Root
#### Props
**`tour`**
Type: `TourApi`
Required: true
Default Value: `undefined`
Description: undefined
**`lazyMount`**
Type: `boolean`
Required: false
Default Value: `false`
Description: Whether to enable lazy mounting
**`unmountOnExit`**
Type: `boolean`
Required: false
Default Value: `false`
Description: Whether to unmount on exit.
#### Emits
**`focusOutside`**
Type: `[event: FocusOutsideEvent]`
Description: Function called when the focus is moved outside the component
**`interactOutside`**
Type: `[event: InteractOutsideEvent]`
Description: Function called when an interaction happens outside the component
**`pointerDownOutside`**
Type: `[event: PointerDownOutsideEvent]`
Description: Function called when the pointer is pressed down outside the component
**`statusChange`**
Type: `[details: StatusChangeDetails]`
Description: Callback when the tour is opened or closed
**`stepChange`**
Type: `[details: StepChangeDetails]`
Description: Callback when the highlighted step changes
**`stepsChange`**
Type: `[details: { steps: StepDetails[] }]`
Description: Callback when the steps change
### ActionTrigger
#### Props
**`action`**
Type: `StepAction`
Required: true
Default Value: `undefined`
Description: undefined
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
#### Data Attributes
**`data-scope`**: tour
**`data-part`**: action-trigger
**`data-type`**: The type of the item
**`data-disabled`**: Present when disabled
### Arrow
#### Props
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
### ArrowTip
#### Props
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
### Backdrop
#### Props
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
#### Data Attributes
**`data-scope`**: tour
**`data-part`**: backdrop
**`data-state`**: "open" | "closed"
**`data-type`**: The type of the item
### CloseTrigger
#### Props
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
#### Data Attributes
**`data-scope`**: tour
**`data-part`**: close-trigger
**`data-type`**: The type of the item
### Content
#### Props
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
#### Data Attributes
**`data-scope`**: tour
**`data-part`**: content
**`data-state`**: "open" | "closed"
**`data-type`**: The type of the item
**`data-placement`**: The placement of the content
**`data-step`**:
### Control
#### Props
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
### Description
#### Props
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
#### Data Attributes
**`data-scope`**: tour
**`data-part`**: description
**`data-placement`**: The placement of the description
### Positioner
#### Props
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
#### Data Attributes
**`data-scope`**: tour
**`data-part`**: positioner
**`data-type`**: The type of the item
**`data-placement`**: The placement of the positioner
### ProgressText
#### Props
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
### Spotlight
#### Props
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
### Title
#### Props
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
#### Data Attributes
**`data-scope`**: tour
**`data-part`**: title
**`data-placement`**: The placement of the title
# Tree View (REACT)
## Anatomy
To set up the tree view component correctly, you'll need to understand its anatomy and how we name its parts.
> Each part includes a `data-part` attribute to help identify them in the DOM.
## Examples
Learn how to use the `TreeView` component in your project. Let's take a look at the most basic example:
```tsx
import { TreeView, createTreeCollection } from '@ark-ui/react/tree-view'
import { CheckSquareIcon, ChevronRightIcon, FileIcon, FolderIcon } from 'lucide-react'
interface Node {
id: string
name: string
children?: Node[]
}
const collection = createTreeCollection({
nodeToValue: (node) => node.id,
nodeToString: (node) => node.name,
rootNode: {
id: 'ROOT',
name: '',
children: [
{
id: 'node_modules',
name: 'node_modules',
children: [
{ id: 'node_modules/zag-js', name: 'zag-js' },
{ id: 'node_modules/pandacss', name: 'panda' },
{
id: 'node_modules/@types',
name: '@types',
children: [
{ id: 'node_modules/@types/react', name: 'react' },
{ id: 'node_modules/@types/react-dom', name: 'react-dom' },
],
},
],
},
{
id: 'src',
name: 'src',
children: [
{ id: 'src/app.tsx', name: 'app.tsx' },
{ id: 'src/index.ts', name: 'index.ts' },
],
},
{ id: 'panda.config', name: 'panda.config.ts' },
{ id: 'package.json', name: 'package.json' },
{ id: 'renovate.json', name: 'renovate.json' },
{ id: 'readme.md', name: 'README.md' },
],
},
})
export const Basic = () => {
return (
Tree
{collection.rootNode.children?.map((node, index) => )}
)
}
const TreeNode = (props: TreeView.NodeProviderProps) => {
const { node, indexPath } = props
return (
{node.children ? (
{node.name}
{node.children.map((child, index) => (
))}
) : (
{node.name}
)}
)
}
```
### Using the Root Provider
The `RootProvider` component provides a context for the tree-view. It accepts the value of the `useTree-view` hook. You
can leverage it to access the component state and methods from outside the tree-view.
```tsx
import { TreeView, createTreeCollection, useTreeView } from '@ark-ui/react/tree-view'
import { CheckSquareIcon, ChevronRightIcon, FileIcon, FolderIcon } from 'lucide-react'
interface Node {
id: string
name: string
children?: Node[]
}
const collection = createTreeCollection({
nodeToValue: (node) => node.id,
nodeToString: (node) => node.name,
rootNode: {
id: 'ROOT',
name: '',
children: [
{
id: 'node_modules',
name: 'node_modules',
children: [
{ id: 'node_modules/zag-js', name: 'zag-js' },
{ id: 'node_modules/pandacss', name: 'panda' },
{
id: 'node_modules/@types',
name: '@types',
children: [
{ id: 'node_modules/@types/react', name: 'react' },
{ id: 'node_modules/@types/react-dom', name: 'react-dom' },
],
},
],
},
{
id: 'src',
name: 'src',
children: [
{ id: 'src/app.tsx', name: 'app.tsx' },
{ id: 'src/index.ts', name: 'index.ts' },
],
},
{ id: 'panda.config', name: 'panda.config.ts' },
{ id: 'package.json', name: 'package.json' },
{ id: 'renovate.json', name: 'renovate.json' },
{ id: 'readme.md', name: 'README.md' },
],
},
})
export const RootProvider = () => {
const treeView = useTreeView({ collection })
return (
Tree
{collection.rootNode.children?.map((node, index) => )}
)
}
const TreeNode = (props: TreeView.NodeProviderProps) => {
const { node, indexPath } = props
return (
{node.children ? (
{node.name}
{node.children.map((child, index) => (
))}
) : (
{node.name}
)}
)
}
```
> If you're using the `RootProvider` component, you don't need to use the `Root` component.
## API Reference
### Root
#### Props
**`collection`**
Type: `TreeCollection`
Required: true
Default Value: `undefined`
Description: The collection of tree nodes
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
**`defaultExpandedValue`**
Type: `string[]`
Required: false
Default Value: `undefined`
Description: The initial expanded node ids when rendered.
Use when you don't need to control the expanded node ids.
**`defaultSelectedValue`**
Type: `string[]`
Required: false
Default Value: `undefined`
Description: The initial selected node ids when rendered.
Use when you don't need to control the selected node ids.
**`expandedValue`**
Type: `string[]`
Required: false
Default Value: `undefined`
Description: The controlled expanded node ids
**`expandOnClick`**
Type: `boolean`
Required: false
Default Value: `true`
Description: Whether clicking on a branch should open it or not
**`focusedValue`**
Type: `string`
Required: false
Default Value: `undefined`
Description: The id of the focused node
**`ids`**
Type: `Partial<{ root: string; tree: string; label: string; node(value: string): string }>`
Required: false
Default Value: `undefined`
Description: The ids of the tree elements. Useful for composition.
**`lazyMount`**
Type: `boolean`
Required: false
Default Value: `false`
Description: Whether to enable lazy mounting
**`onExpandedChange`**
Type: `(details: ExpandedChangeDetails) => void`
Required: false
Default Value: `undefined`
Description: Called when the tree is opened or closed
**`onFocusChange`**
Type: `(details: FocusChangeDetails) => void`
Required: false
Default Value: `undefined`
Description: Called when the focused node changes
**`onSelectionChange`**
Type: `(details: SelectionChangeDetails) => void`
Required: false
Default Value: `undefined`
Description: Called when the selection changes
**`selectedValue`**
Type: `string[]`
Required: false
Default Value: `undefined`
Description: The controlled selected node ids
**`selectionMode`**
Type: `'multiple' | 'single'`
Required: false
Default Value: `"single"`
Description: Whether the tree supports multiple selection
- "single": only one node can be selected
- "multiple": multiple nodes can be selected
**`typeahead`**
Type: `boolean`
Required: false
Default Value: `true`
Description: Whether the tree supports typeahead search
**`unmountOnExit`**
Type: `boolean`
Required: false
Default Value: `false`
Description: Whether to unmount on exit.
### BranchContent
#### Props
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
#### Data Attributes
**`data-scope`**: tree-view
**`data-part`**: branch-content
**`data-state`**: "open" | "closed"
**`data-depth`**: The depth of the item
**`data-path`**: The path of the item
**`data-value`**: The value of the item
### BranchControl
#### Props
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
#### Data Attributes
**`data-scope`**: tree-view
**`data-part`**: branch-control
**`data-path`**: The path of the item
**`data-state`**: "open" | "closed"
**`data-disabled`**: Present when disabled
**`data-selected`**: Present when selected
**`data-focus`**: Present when focused
**`data-value`**: The value of the item
**`data-depth`**: The depth of the item
### BranchIndentGuide
#### Props
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
#### Data Attributes
**`data-scope`**: tree-view
**`data-part`**: branch-indent-guide
**`data-depth`**: The depth of the item
### BranchIndicator
#### Props
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
#### Data Attributes
**`data-scope`**: tree-view
**`data-part`**: branch-indicator
**`data-state`**: "open" | "closed"
**`data-disabled`**: Present when disabled
**`data-selected`**: Present when selected
**`data-focus`**: Present when focused
### Branch
#### Props
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
#### Data Attributes
**`data-scope`**: tree-view
**`data-part`**: branch
**`data-depth`**: The depth of the item
**`data-branch`**:
**`data-value`**: The value of the item
**`data-path`**: The path of the item
**`data-selected`**: Present when selected
**`data-state`**: "open" | "closed"
**`data-disabled`**: Present when disabled
### BranchText
#### Props
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
#### Data Attributes
**`data-scope`**: tree-view
**`data-part`**: branch-text
**`data-disabled`**: Present when disabled
**`data-state`**: "open" | "closed"
### BranchTrigger
#### Props
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
#### Data Attributes
**`data-scope`**: tree-view
**`data-part`**: branch-trigger
**`data-disabled`**: Present when disabled
**`data-state`**: "open" | "closed"
**`data-value`**: The value of the item
### ItemIndicator
#### Props
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
#### Data Attributes
**`data-scope`**: tree-view
**`data-part`**: item-indicator
**`data-disabled`**: Present when disabled
**`data-selected`**: Present when selected
**`data-focus`**: Present when focused
### Item
#### Props
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
#### Data Attributes
**`data-scope`**: tree-view
**`data-part`**: item
**`data-path`**: The path of the item
**`data-value`**: The value of the item
**`data-focus`**: Present when focused
**`data-selected`**: Present when selected
**`data-disabled`**: Present when disabled
**`data-depth`**: The depth of the item
### ItemText
#### Props
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
#### Data Attributes
**`data-scope`**: tree-view
**`data-part`**: item-text
**`data-disabled`**: Present when disabled
**`data-selected`**: Present when selected
**`data-focus`**: Present when focused
### Label
#### Props
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
### NodeProvider
#### Props
**`indexPath`**
Type: `number[]`
Required: true
Default Value: `undefined`
Description: The index path of the tree node
**`node`**
Type: `NonNullable`
Required: false
Default Value: `undefined`
Description: The tree node
### RootProvider
#### Props
**`value`**
Type: `UseTreeViewReturn`
Required: true
Default Value: `undefined`
Description: undefined
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
**`lazyMount`**
Type: `boolean`
Required: false
Default Value: `false`
Description: Whether to enable lazy mounting
**`unmountOnExit`**
Type: `boolean`
Required: false
Default Value: `false`
Description: Whether to unmount on exit.
### Tree
#### Props
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
## Accessibility
Complies with the [Tree View WAI-ARIA design pattern](https://www.w3.org/WAI/ARIA/apg/patterns/treeview/).
### Keyboard Support
**`Tab`**
Description: Moves focus to the tree view, placing the first tree view item in focus.
**`Enter + Space`**
Description: Selects the item or branch node
**`ArrowDown`**
Description: Moves focus to the next node
**`ArrowUp`**
Description: Moves focus to the previous node
**`ArrowRight`**
Description: When focus is on a closed branch node, opens the branch. When focus is on an open branch node, moves focus to the first item node.
**`ArrowLeft`**
Description: When focus is on an open branch node, closes the node. When focus is on an item or branch node, moves focus to its parent branch node.
**`Home`**
Description: Moves focus to first node without opening or closing a node.
**`End`**
Description: Moves focus to the last node that can be focused without expanding any nodes that are closed.
**`a-z + A-Z`**
Description: Focus moves to the next node with a name that starts with the typed character. The search logic ignores nodes that are descendants of closed branch.
**`*`**
Description: Expands all sibling nodes that are at the same depth as the focused node.
**`Shift + ArrowDown`**
Description: Moves focus to and toggles the selection state of the next node.
**`Shift + ArrowUp`**
Description: Moves focus to and toggles the selection state of the previous node.
**`Ctrl + A`**
Description: Selects all nodes in the tree. If all nodes are selected, unselects all nodes.
# Tree View (SOLID)
## Anatomy
To set up the tree view component correctly, you'll need to understand its anatomy and how we name its parts.
> Each part includes a `data-part` attribute to help identify them in the DOM.
## Examples
Learn how to use the `TreeView` component in your project. Let's take a look at the most basic example:
```tsx
import { TreeView, createTreeCollection } from '@ark-ui/solid/tree-view'
import { CheckSquareIcon, ChevronRightIcon, FileIcon, FolderIcon } from 'lucide-solid'
import { For, Show } from 'solid-js'
interface Node {
id: string
name: string
children?: Node[]
}
const collection = createTreeCollection({
nodeToValue: (node) => node.id,
nodeToString: (node) => node.name,
rootNode: {
id: 'ROOT',
name: '',
children: [
{
id: 'node_modules',
name: 'node_modules',
children: [
{ id: 'node_modules/zag-js', name: 'zag-js' },
{ id: 'node_modules/pandacss', name: 'panda' },
{
id: 'node_modules/@types',
name: '@types',
children: [
{ id: 'node_modules/@types/react', name: 'react' },
{ id: 'node_modules/@types/react-dom', name: 'react-dom' },
],
},
],
},
{
id: 'src',
name: 'src',
children: [
{ id: 'src/app.tsx', name: 'app.tsx' },
{ id: 'src/index.ts', name: 'index.ts' },
],
},
{ id: 'panda.config', name: 'panda.config.ts' },
{ id: 'package.json', name: 'package.json' },
{ id: 'renovate.json', name: 'renovate.json' },
{ id: 'readme.md', name: 'README.md' },
],
},
})
export const Basic = () => {
return (
Tree{(node, index) => }
)
}
const TreeNode = (props: TreeView.NodeProviderProps) => {
const { node, indexPath } = props
return (
{node.name}
}
>
{node.name}
{(child, index) => }
)
}
```
### Using the Root Provider
The `RootProvider` component provides a context for the tree-view. It accepts the value of the `useTree-view` hook. You
can leverage it to access the component state and methods from outside the tree-view.
```tsx
import { TreeView, createTreeCollection, useTreeView } from '@ark-ui/solid/tree-view'
import { CheckSquareIcon, ChevronRightIcon, FileIcon, FolderIcon } from 'lucide-solid'
import { For, Show } from 'solid-js'
interface Node {
id: string
name: string
children?: Node[]
}
const collection = createTreeCollection({
nodeToValue: (node) => node.id,
nodeToString: (node) => node.name,
rootNode: {
id: 'ROOT',
name: '',
children: [
{
id: 'node_modules',
name: 'node_modules',
children: [
{ id: 'node_modules/zag-js', name: 'zag-js' },
{ id: 'node_modules/pandacss', name: 'panda' },
{
id: 'node_modules/@types',
name: '@types',
children: [
{ id: 'node_modules/@types/react', name: 'react' },
{ id: 'node_modules/@types/react-dom', name: 'react-dom' },
],
},
],
},
{
id: 'src',
name: 'src',
children: [
{ id: 'src/app.tsx', name: 'app.tsx' },
{ id: 'src/index.ts', name: 'index.ts' },
],
},
{ id: 'panda.config', name: 'panda.config.ts' },
{ id: 'package.json', name: 'package.json' },
{ id: 'renovate.json', name: 'renovate.json' },
{ id: 'readme.md', name: 'README.md' },
],
},
})
export const RootProvider = () => {
const treeView = useTreeView({ collection })
return (
Tree{(node, index) => }
)
}
const TreeNode = (props: TreeView.NodeProviderProps) => {
const { node, indexPath } = props
return (
{node.name}
}
>
{node.name}
{(child, index) => }
)
}
```
> If you're using the `RootProvider` component, you don't need to use the `Root` component.
## API Reference
### Root
#### Props
**`collection`**
Type: `TreeCollection`
Required: true
Default Value: `undefined`
Description: The collection of tree nodes
**`asChild`**
Type: `(props: ParentProps<'div'>) => Element`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
**`defaultExpandedValue`**
Type: `string[]`
Required: false
Default Value: `undefined`
Description: The initial expanded node ids when rendered.
Use when you don't need to control the expanded node ids.
**`defaultSelectedValue`**
Type: `string[]`
Required: false
Default Value: `undefined`
Description: The initial selected node ids when rendered.
Use when you don't need to control the selected node ids.
**`expandedValue`**
Type: `string[]`
Required: false
Default Value: `undefined`
Description: The controlled expanded node ids
**`expandOnClick`**
Type: `boolean`
Required: false
Default Value: `true`
Description: Whether clicking on a branch should open it or not
**`focusedValue`**
Type: `string`
Required: false
Default Value: `undefined`
Description: The id of the focused node
**`ids`**
Type: `Partial<{ root: string; tree: string; label: string; node(value: string): string }>`
Required: false
Default Value: `undefined`
Description: The ids of the tree elements. Useful for composition.
**`lazyMount`**
Type: `boolean`
Required: false
Default Value: `false`
Description: Whether to enable lazy mounting
**`onExpandedChange`**
Type: `(details: ExpandedChangeDetails) => void`
Required: false
Default Value: `undefined`
Description: Called when the tree is opened or closed
**`onFocusChange`**
Type: `(details: FocusChangeDetails) => void`
Required: false
Default Value: `undefined`
Description: Called when the focused node changes
**`onSelectionChange`**
Type: `(details: SelectionChangeDetails) => void`
Required: false
Default Value: `undefined`
Description: Called when the selection changes
**`selectedValue`**
Type: `string[]`
Required: false
Default Value: `undefined`
Description: The controlled selected node ids
**`selectionMode`**
Type: `'multiple' | 'single'`
Required: false
Default Value: `"single"`
Description: Whether the tree supports multiple selection
- "single": only one node can be selected
- "multiple": multiple nodes can be selected
**`typeahead`**
Type: `boolean`
Required: false
Default Value: `true`
Description: Whether the tree supports typeahead search
**`unmountOnExit`**
Type: `boolean`
Required: false
Default Value: `false`
Description: Whether to unmount on exit.
### BranchContent
#### Props
**`asChild`**
Type: `(props: ParentProps<'div'>) => Element`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
#### Data Attributes
**`data-scope`**: tree-view
**`data-part`**: branch-content
**`data-state`**: "open" | "closed"
**`data-depth`**: The depth of the item
**`data-path`**: The path of the item
**`data-value`**: The value of the item
### BranchControl
#### Props
**`asChild`**
Type: `(props: ParentProps<'div'>) => Element`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
#### Data Attributes
**`data-scope`**: tree-view
**`data-part`**: branch-control
**`data-path`**: The path of the item
**`data-state`**: "open" | "closed"
**`data-disabled`**: Present when disabled
**`data-selected`**: Present when selected
**`data-focus`**: Present when focused
**`data-value`**: The value of the item
**`data-depth`**: The depth of the item
### BranchIndentGuide
#### Props
**`asChild`**
Type: `(props: ParentProps<'div'>) => Element`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
#### Data Attributes
**`data-scope`**: tree-view
**`data-part`**: branch-indent-guide
**`data-depth`**: The depth of the item
### BranchIndicator
#### Props
**`asChild`**
Type: `(props: ParentProps<'div'>) => Element`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
#### Data Attributes
**`data-scope`**: tree-view
**`data-part`**: branch-indicator
**`data-state`**: "open" | "closed"
**`data-disabled`**: Present when disabled
**`data-selected`**: Present when selected
**`data-focus`**: Present when focused
### Branch
#### Props
**`asChild`**
Type: `(props: ParentProps<'div'>) => Element`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
#### Data Attributes
**`data-scope`**: tree-view
**`data-part`**: branch
**`data-depth`**: The depth of the item
**`data-branch`**:
**`data-value`**: The value of the item
**`data-path`**: The path of the item
**`data-selected`**: Present when selected
**`data-state`**: "open" | "closed"
**`data-disabled`**: Present when disabled
### BranchText
#### Props
**`asChild`**
Type: `(props: ParentProps<'span'>) => Element`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
#### Data Attributes
**`data-scope`**: tree-view
**`data-part`**: branch-text
**`data-disabled`**: Present when disabled
**`data-state`**: "open" | "closed"
### BranchTrigger
#### Props
**`asChild`**
Type: `(props: ParentProps<'div'>) => Element`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
#### Data Attributes
**`data-scope`**: tree-view
**`data-part`**: branch-trigger
**`data-disabled`**: Present when disabled
**`data-state`**: "open" | "closed"
**`data-value`**: The value of the item
### ItemIndicator
#### Props
**`asChild`**
Type: `(props: ParentProps<'div'>) => Element`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
#### Data Attributes
**`data-scope`**: tree-view
**`data-part`**: item-indicator
**`data-disabled`**: Present when disabled
**`data-selected`**: Present when selected
**`data-focus`**: Present when focused
### Item
#### Props
**`asChild`**
Type: `(props: ParentProps<'div'>) => Element`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
#### Data Attributes
**`data-scope`**: tree-view
**`data-part`**: item
**`data-path`**: The path of the item
**`data-value`**: The value of the item
**`data-focus`**: Present when focused
**`data-selected`**: Present when selected
**`data-disabled`**: Present when disabled
**`data-depth`**: The depth of the item
### ItemText
#### Props
**`asChild`**
Type: `(props: ParentProps<'span'>) => Element`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
#### Data Attributes
**`data-scope`**: tree-view
**`data-part`**: item-text
**`data-disabled`**: Present when disabled
**`data-selected`**: Present when selected
**`data-focus`**: Present when focused
### Label
#### Props
**`asChild`**
Type: `(props: ParentProps<'label'>) => Element`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
### NodeProvider
#### Props
**`indexPath`**
Type: `number[]`
Required: true
Default Value: `undefined`
Description: The index path of the tree node
**`node`**
Type: `NonNullable`
Required: false
Default Value: `undefined`
Description: The tree node
### RootProvider
#### Props
**`value`**
Type: `UseTreeViewReturn`
Required: true
Default Value: `undefined`
Description: undefined
**`asChild`**
Type: `(props: ParentProps<'div'>) => Element`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
**`lazyMount`**
Type: `boolean`
Required: false
Default Value: `false`
Description: Whether to enable lazy mounting
**`unmountOnExit`**
Type: `boolean`
Required: false
Default Value: `false`
Description: Whether to unmount on exit.
### Tree
#### Props
**`asChild`**
Type: `(props: ParentProps<'div'>) => Element`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
## Accessibility
Complies with the [Tree View WAI-ARIA design pattern](https://www.w3.org/WAI/ARIA/apg/patterns/treeview/).
### Keyboard Support
**`Tab`**
Description: Moves focus to the tree view, placing the first tree view item in focus.
**`Enter + Space`**
Description: Selects the item or branch node
**`ArrowDown`**
Description: Moves focus to the next node
**`ArrowUp`**
Description: Moves focus to the previous node
**`ArrowRight`**
Description: When focus is on a closed branch node, opens the branch. When focus is on an open branch node, moves focus to the first item node.
**`ArrowLeft`**
Description: When focus is on an open branch node, closes the node. When focus is on an item or branch node, moves focus to its parent branch node.
**`Home`**
Description: Moves focus to first node without opening or closing a node.
**`End`**
Description: Moves focus to the last node that can be focused without expanding any nodes that are closed.
**`a-z + A-Z`**
Description: Focus moves to the next node with a name that starts with the typed character. The search logic ignores nodes that are descendants of closed branch.
**`*`**
Description: Expands all sibling nodes that are at the same depth as the focused node.
**`Shift + ArrowDown`**
Description: Moves focus to and toggles the selection state of the next node.
**`Shift + ArrowUp`**
Description: Moves focus to and toggles the selection state of the previous node.
**`Ctrl + A`**
Description: Selects all nodes in the tree. If all nodes are selected, unselects all nodes.
# Tree View (VUE)
## Anatomy
To set up the tree view component correctly, you'll need to understand its anatomy and how we name its parts.
> Each part includes a `data-part` attribute to help identify them in the DOM.
## Examples
Learn how to use the `TreeView` component in your project. Let's take a look at the most basic example:
```vue
Tree
```
### Using the Root Provider
The `RootProvider` component provides a context for the tree-view. It accepts the value of the `useTree-view` hook. You
can leverage it to access the component state and methods from outside the tree-view.
```vue
Example not found```
> If you're using the `RootProvider` component, you don't need to use the `Root` component.
## API Reference
### Root
#### Props
**`collection`**
Type: `TreeCollection`
Required: true
Default Value: `undefined`
Description: The collection of tree nodes
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
**`defaultExpandedValue`**
Type: `string[]`
Required: false
Default Value: `undefined`
Description: The initial expanded node ids when rendered.
Use when you don't need to control the expanded node ids.
**`defaultSelectedValue`**
Type: `string[]`
Required: false
Default Value: `undefined`
Description: The initial selected node ids when rendered.
Use when you don't need to control the selected node ids.
**`expandedValue`**
Type: `string[]`
Required: false
Default Value: `undefined`
Description: The controlled expanded node ids
**`expandOnClick`**
Type: `boolean`
Required: false
Default Value: `true`
Description: Whether clicking on a branch should open it or not
**`focusedValue`**
Type: `string`
Required: false
Default Value: `undefined`
Description: The id of the focused node
**`id`**
Type: `string`
Required: false
Default Value: `undefined`
Description: The unique identifier of the machine.
**`ids`**
Type: `Partial<{ root: string; tree: string; label: string; node(value: string): string }>`
Required: false
Default Value: `undefined`
Description: The ids of the tree elements. Useful for composition.
**`lazyMount`**
Type: `boolean`
Required: false
Default Value: `false`
Description: Whether to enable lazy mounting
**`selectedValue`**
Type: `string[]`
Required: false
Default Value: `undefined`
Description: The controlled selected node ids
**`selectionMode`**
Type: `'multiple' | 'single'`
Required: false
Default Value: `"single"`
Description: Whether the tree supports multiple selection
- "single": only one node can be selected
- "multiple": multiple nodes can be selected
**`typeahead`**
Type: `boolean`
Required: false
Default Value: `true`
Description: Whether the tree supports typeahead search
**`unmountOnExit`**
Type: `boolean`
Required: false
Default Value: `false`
Description: Whether to unmount on exit.
### BranchContent
#### Props
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
#### Data Attributes
**`data-scope`**: tree-view
**`data-part`**: branch-content
**`data-state`**: "open" | "closed"
**`data-depth`**: The depth of the item
**`data-path`**: The path of the item
**`data-value`**: The value of the item
### BranchControl
#### Props
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
#### Data Attributes
**`data-scope`**: tree-view
**`data-part`**: branch-control
**`data-path`**: The path of the item
**`data-state`**: "open" | "closed"
**`data-disabled`**: Present when disabled
**`data-selected`**: Present when selected
**`data-focus`**: Present when focused
**`data-value`**: The value of the item
**`data-depth`**: The depth of the item
### BranchIndentGuide
#### Props
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
#### Data Attributes
**`data-scope`**: tree-view
**`data-part`**: branch-indent-guide
**`data-depth`**: The depth of the item
### BranchIndicator
#### Props
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
#### Data Attributes
**`data-scope`**: tree-view
**`data-part`**: branch-indicator
**`data-state`**: "open" | "closed"
**`data-disabled`**: Present when disabled
**`data-selected`**: Present when selected
**`data-focus`**: Present when focused
### Branch
#### Props
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
#### Data Attributes
**`data-scope`**: tree-view
**`data-part`**: branch
**`data-depth`**: The depth of the item
**`data-branch`**:
**`data-value`**: The value of the item
**`data-path`**: The path of the item
**`data-selected`**: Present when selected
**`data-state`**: "open" | "closed"
**`data-disabled`**: Present when disabled
### BranchText
#### Props
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
#### Data Attributes
**`data-scope`**: tree-view
**`data-part`**: branch-text
**`data-disabled`**: Present when disabled
**`data-state`**: "open" | "closed"
### BranchTrigger
#### Props
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
#### Data Attributes
**`data-scope`**: tree-view
**`data-part`**: branch-trigger
**`data-disabled`**: Present when disabled
**`data-state`**: "open" | "closed"
**`data-value`**: The value of the item
### ItemIndicator
#### Props
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
#### Data Attributes
**`data-scope`**: tree-view
**`data-part`**: item-indicator
**`data-disabled`**: Present when disabled
**`data-selected`**: Present when selected
**`data-focus`**: Present when focused
### Item
#### Props
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
#### Data Attributes
**`data-scope`**: tree-view
**`data-part`**: item
**`data-path`**: The path of the item
**`data-value`**: The value of the item
**`data-focus`**: Present when focused
**`data-selected`**: Present when selected
**`data-disabled`**: Present when disabled
**`data-depth`**: The depth of the item
### ItemText
#### Props
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
#### Data Attributes
**`data-scope`**: tree-view
**`data-part`**: item-text
**`data-disabled`**: Present when disabled
**`data-selected`**: Present when selected
**`data-focus`**: Present when focused
### Label
#### Props
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
### NodeProvider
#### Props
**`indexPath`**
Type: `number[]`
Required: true
Default Value: `undefined`
Description: The index path of the tree node
**`node`**
Type: `NonNullable`
Required: false
Default Value: `undefined`
Description: The tree node
### RootProvider
#### Props
**`value`**
Type: `TreeViewApi`
Required: true
Default Value: `undefined`
Description: undefined
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
**`lazyMount`**
Type: `boolean`
Required: false
Default Value: `false`
Description: Whether to enable lazy mounting
**`unmountOnExit`**
Type: `boolean`
Required: false
Default Value: `false`
Description: Whether to unmount on exit.
### Tree
#### Props
**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
## Accessibility
Complies with the [Tree View WAI-ARIA design pattern](https://www.w3.org/WAI/ARIA/apg/patterns/treeview/).
### Keyboard Support
**`Tab`**
Description: Moves focus to the tree view, placing the first tree view item in focus.
**`Enter + Space`**
Description: Selects the item or branch node
**`ArrowDown`**
Description: Moves focus to the next node
**`ArrowUp`**
Description: Moves focus to the previous node
**`ArrowRight`**
Description: When focus is on a closed branch node, opens the branch. When focus is on an open branch node, moves focus to the first item node.
**`ArrowLeft`**
Description: When focus is on an open branch node, closes the node. When focus is on an item or branch node, moves focus to its parent branch node.
**`Home`**
Description: Moves focus to first node without opening or closing a node.
**`End`**
Description: Moves focus to the last node that can be focused without expanding any nodes that are closed.
**`a-z + A-Z`**
Description: Focus moves to the next node with a name that starts with the typed character. The search logic ignores nodes that are descendants of closed branch.
**`*`**
Description: Expands all sibling nodes that are at the same depth as the focused node.
**`Shift + ArrowDown`**
Description: Moves focus to and toggles the selection state of the next node.
**`Shift + ArrowUp`**
Description: Moves focus to and toggles the selection state of the previous node.
**`Ctrl + A`**
Description: Selects all nodes in the tree. If all nodes are selected, unselects all nodes.
# UTILITIES
---
# Download Trigger (REACT)
## Motivation
The `DownloadTrigger` component provides a convenient way to programmatically trigger file downloads in web
applications. It handles the complexities of downloading files, whether they are URLs, Blobs, or other data types.
## Examples
### Basic
Pass the data you want to download to the `data` prop, and specify the `fileName` and `mimeType` of the file.
```tsx
import { DownloadTrigger } from '@ark-ui/react/download-trigger'
export const Basic = () => {
return (
Download txt
)
}
```
### Download SVG
Here's an example of how to download an SVG file.
```tsx
import { DownloadTrigger } from '@ark-ui/react/download-trigger'
export const Svg = () => {
return (
Download SVG
)
}
```
### Promise
You can also trigger downloads from a promise that returns a `Blob`, `File`, or `string`.
```tsx
import { DownloadTrigger } from '@ark-ui/react/download-trigger'
export const WithPromise = () => {
const fetchImage = async () => {
const response = await fetch('https://picsum.photos/200/300')
return response.blob()
}
return (
Download Image
)
}
```
## API Reference
# Download Trigger (SOLID)
## Motivation
The `DownloadTrigger` component provides a convenient way to programmatically trigger file downloads in web
applications. It handles the complexities of downloading files, whether they are URLs, Blobs, or other data types.
## Examples
### Basic
Pass the data you want to download to the `data` prop, and specify the `fileName` and `mimeType` of the file.
```tsx
import { DownloadTrigger } from '@ark-ui/solid/download-trigger'
export const Basic = () => {
return (
Download txt
)
}
```
### Download SVG
Here's an example of how to download an SVG file.
```tsx
import { DownloadTrigger } from '@ark-ui/solid/download-trigger'
export const Svg = () => {
return (
Download SVG
)
}
```
### Promise
You can also trigger downloads from a promise that returns a `Blob`, `File`, or `string`.
```tsx
import { DownloadTrigger } from '@ark-ui/solid/download-trigger'
export const WithPromise = () => {
const fetchImage = async () => {
const response = await fetch('https://picsum.photos/200/300')
return response.blob()
}
return (
Download Image
)
}
```
## API Reference
# Download Trigger (VUE)
## Motivation
The `DownloadTrigger` component provides a convenient way to programmatically trigger file downloads in web
applications. It handles the complexities of downloading files, whether they are URLs, Blobs, or other data types.
## Examples
### Basic
Pass the data you want to download to the `data` prop, and specify the `fileName` and `mimeType` of the file.
```vue
Download txt
```
### Download SVG
Here's an example of how to download an SVG file.
```vue
Download SVG
```
### Promise
You can also trigger downloads from a promise that returns a `Blob`, `File`, or `string`.
```vue
Download Image
```
## API Reference
# Environment (REACT)
## Motivation
We use [Zag.js](https://zagjs.com/overview/composition#custom-window-environment) internally, which relies on DOM query
methods like `document.querySelectorAll` and `document.getElementById`. In custom environments like iframes, Shadow DOM,
or Electron, these methods might not work as expected.
To handle this, Ark UI includes the `EnvironmentProvider`, allowing you to set the appropriate root node or document,
ensuring correct DOM queries.
## Setup
To support custom environments like an iframe, Shadow DOM or Electron, render the `EnvironmentProvider` component to
provide the environment context to all Ark UI components.
```tsx
import { EnvironmentProvider } from '@ark-ui/react/environment'
import Frame from 'react-frame-component'
export const App = () => {
return (
{/* Your App */}
)
}
```
### Usage in iframe
The `EnvironmentProvider` component will automatically detect the current environment and set the correct environment
context. However, you can also manually set the `Document` like shown in this React example below:
```jsx
import Frame, { FrameContextConsumer } from 'react-frame-component'
import { EnvironmentProvider } from '@ark-ui/react'
export const App = () => (
{({ document }) => {/* Your App */}}
)
```
### Usage in Shadow DOM
Here's an example of how to set the `EnvironmentProvider`'s value with Shadow DOM in Solid.js `Portal` component.
```jsx
import { EnvironmentProvider } from '@ark-ui/react'
import { Index, Portal } from 'solid-js/web'
export const App = () => {
let portalNode
return (
portalNode?.shadowRoot ?? document}>{/* Your App */}
)
}
```
## Context
Use the `useEnvironmentContext` hook to access the `RootNode`, `Document`, and `Window`.
```tsx
import { useEnvironmentContext } from '@ark-ui/react/environment'
export const Usage = () => {
const { getRootNode } = useEnvironmentContext()
return
{JSON.stringify(getRootNode(), null, 2)}
}
```
## API Reference
### EnvironmentProvider
#### Props
**`value`**
Type: `RootNode | (() => RootNode)`
Required: false
Default Value: `undefined`
Description: undefined
# Environment (SOLID)
## Motivation
We use [Zag.js](https://zagjs.com/overview/composition#custom-window-environment) internally, which relies on DOM query
methods like `document.querySelectorAll` and `document.getElementById`. In custom environments like iframes, Shadow DOM,
or Electron, these methods might not work as expected.
To handle this, Ark UI includes the `EnvironmentProvider`, allowing you to set the appropriate root node or document,
ensuring correct DOM queries.
## Setup
To support custom environments like an iframe, Shadow DOM or Electron, render the `EnvironmentProvider` component to
provide the environment context to all Ark UI components.
```tsx
import { EnvironmentProvider } from '@ark-ui/solid/environment'
export const App = () => {
return (
)
}
```
### Usage in iframe
The `EnvironmentProvider` component will automatically detect the current environment and set the correct environment
context. However, you can also manually set the `Document` like shown in this React example below:
```jsx
import Frame, { FrameContextConsumer } from 'react-frame-component'
import { EnvironmentProvider } from '@ark-ui/react'
export const App = () => (
{({ document }) => {/* Your App */}}
)
```
### Usage in Shadow DOM
Here's an example of how to set the `EnvironmentProvider`'s value with Shadow DOM in Solid.js `Portal` component.
```jsx
import { EnvironmentProvider } from '@ark-ui/react'
import { Index, Portal } from 'solid-js/web'
export const App = () => {
let portalNode
return (
portalNode?.shadowRoot ?? document}>{/* Your App */}
)
}
```
## Context
Use the `useEnvironmentContext` hook to access the `RootNode`, `Document`, and `Window`.
```tsx
import { useEnvironmentContext } from '../use-environment-context'
export const Usage = () => {
const environment = useEnvironmentContext()
return
}
```
## API Reference
### EnvironmentProvider
#### Props
**`value`**
Type: `RootNode | (() => RootNode)`
Required: false
Default Value: `undefined`
Description: undefined
# Environment (VUE)
## Motivation
We use [Zag.js](https://zagjs.com/overview/composition#custom-window-environment) internally, which relies on DOM query
methods like `document.querySelectorAll` and `document.getElementById`. In custom environments like iframes, Shadow DOM,
or Electron, these methods might not work as expected.
To handle this, Ark UI includes the `EnvironmentProvider`, allowing you to set the appropriate root node or document,
ensuring correct DOM queries.
## Setup
To support custom environments like an iframe, Shadow DOM or Electron, render the `EnvironmentProvider` component to
provide the environment context to all Ark UI components.
```vue
```
### Usage in iframe
The `EnvironmentProvider` component will automatically detect the current environment and set the correct environment
context. However, you can also manually set the `Document` like shown in this React example below:
```jsx
import Frame, { FrameContextConsumer } from 'react-frame-component'
import { EnvironmentProvider } from '@ark-ui/react'
export const App = () => (
{({ document }) => {/* Your App */}}
)
```
### Usage in Shadow DOM
Here's an example of how to set the `EnvironmentProvider`'s value with Shadow DOM in Solid.js `Portal` component.
```jsx
import { EnvironmentProvider } from '@ark-ui/react'
import { Index, Portal } from 'solid-js/web'
export const App = () => {
let portalNode
return (
portalNode?.shadowRoot ?? document}>{/* Your App */}
)
}
```
## Context
Use the `useEnvironmentContext` hook to access the `RootNode`, `Document`, and `Window`.
```vue
```
## API Reference
### EnvironmentProvider
#### Props
**`value`**
Type: `RootNode | (() => RootNode)`
Required: false
Default Value: `undefined`
Description: undefined
# Focus Trap (REACT)
## Motivation
Focus trapping is essential for modal interfaces and other interactive elements that require user attention.
The `FocusTrap` component helps maintain accessibility by ensuring keyboard focus remains within a designated container
until explicitly released.
## Examples
```tsx
import { FocusTrap } from '@ark-ui/react/focus-trap'
import { useState } from 'react'
export const Basic = () => {
const [trapped, setTrapped] = useState(false)
return (
<>
>
)
}
```
### Autofocus
The focus trap respects elements with the `autofocus` attribute.
```tsx
import { FocusTrap } from '@ark-ui/react/focus-trap'
import { useRef, useState } from 'react'
export const Autofocus = () => {
const [trapped, setTrapped] = useState(false)
const toggle = () => setTrapped((c) => !c)
const buttonRef = useRef(null)
const getButtonNode = () => {
const node = buttonRef.current
if (!node) throw new Error('Button not found')
return node
}
return (
{trapped && (
{/* biome-ignore lint/a11y/noAutofocus: */}
)}
)
}
```
### Initial Focus
Use the `initialFocus` prop to set the element that should receive initial focus when the trap is activated.
```tsx
import { FocusTrap } from '@ark-ui/react/focus-trap'
import { useRef, useState } from 'react'
export const InitialFocus = () => {
const [trapped, setTrapped] = useState(false)
const toggle = () => setTrapped((c) => !c)
const inputRef = useRef(null)
return (
inputRef.current}>
)
}
```
## API Reference
# Focus Trap (SOLID)
## Motivation
Focus trapping is essential for modal interfaces and other interactive elements that require user attention.
The `FocusTrap` component helps maintain accessibility by ensuring keyboard focus remains within a designated container
until explicitly released.
## Examples
```tsx
import { FocusTrap } from '@ark-ui/solid/focus-trap'
import { createSignal } from 'solid-js'
export const Basic = () => {
const [trapped, setTrapped] = createSignal(false)
return (
<>
>
)
}
```
### Autofocus
The focus trap respects elements with the `autofocus` attribute.
```tsx
import { FocusTrap } from '@ark-ui/solid/focus-trap'
import { Show, createSignal } from 'solid-js'
export const Autofocus = () => {
const [trapped, setTrapped] = createSignal(false)
let buttonRef!: HTMLButtonElement
return (
)
}
```
### Initial Focus
Use the `initialFocus` prop to set the element that should receive initial focus when the trap is activated.
```tsx
import { FocusTrap } from '@ark-ui/solid/focus-trap'
import { createSignal } from 'solid-js'
export const InitialFocus = () => {
const [trapped, setTrapped] = createSignal(false)
const toggle = () => setTrapped((v) => !v)
let inputRef!: HTMLInputElement
return (
inputRef}>
)
}
```
## API Reference
# Focus Trap (VUE)
## Motivation
Focus trapping is essential for modal interfaces and other interactive elements that require user attention.
The `FocusTrap` component helps maintain accessibility by ensuring keyboard focus remains within a designated container
until explicitly released.
## Examples
```vue
```
### Autofocus
The focus trap respects elements with the `autofocus` attribute.
```vue
```
### Initial Focus
Use the `initialFocus` prop to set the element that should receive initial focus when the trap is activated.
```vue
```
## API Reference
# Format Byte (REACT)
## Usage
The byte formatting component extends the number formatting capabilities to handle byte-specific formatting, including
automatic unit conversion and display options.
```jsx
import { Format } from '@ark-ui/react'
```
## Examples
### Basic
Use the `Format.Byte` component to format a byte value with default options.
```tsx
import { Format } from '@ark-ui/react'
export const ByteBasic = () => {
return (
File size:
)
}
```
### Sizes
Use the `sizes` prop to specify custom byte sizes for formatting.
```tsx
import { Format } from '@ark-ui/react'
export const ByteSizes = () => {
const byteSizes = [50, 5000, 5000000, 5000000000]
return (
{byteSizes.map((size, index) => (
))}
)
}
```
### Locale
Use the `locale` prop to format the byte value according to a specific locale.
```tsx
import { Format, LocaleProvider } from '@ark-ui/react'
export const ByteWithLocale = () => {
const locales = ['de-DE', 'zh-CN']
const value = 1450.45
return (
{locales.map((locale) => (
))}
)
}
```
### Unit
Use the `unit` prop to specify the unit of the byte value.
```tsx
import { Format } from '@ark-ui/react'
export const ByteWithUnit = () => {
const value = 1450.45
const unit = 'bit'
return (
File size:
)
}
```
### Unit Display
Use the `unitDisplay` prop to specify the display of the unit.
```tsx
import { Format } from '@ark-ui/react'
export const ByteWithUnitDisplay = () => {
const value = 50345.53
const unitDisplays = ['narrow', 'short', 'long'] as const
return (
{unitDisplays.map((unitDisplay) => (
))}
)
}
```
# Format Byte (SOLID)
## Usage
The byte formatting component extends the number formatting capabilities to handle byte-specific formatting, including
automatic unit conversion and display options.
```jsx
import { Format } from '@ark-ui/react'
```
## Examples
### Basic
Use the `Format.Byte` component to format a byte value with default options.
```tsx
import { Format } from '@ark-ui/solid/format'
export const ByteBasic = () => {
return (
File size:
)
}
```
### Sizes
Use the `sizes` prop to specify custom byte sizes for formatting.
```tsx
import { Format } from '@ark-ui/solid/format'
import { For } from 'solid-js'
export const ByteSizes = () => {
const byteSizes = [50, 5000, 5000000, 5000000000]
return (
{(size) => (
)}
)
}
```
### Locale
Use the `locale` prop to format the byte value according to a specific locale.
```tsx
import { Format } from '@ark-ui/solid/format'
import { LocaleProvider } from '@ark-ui/solid/locale'
import { For } from 'solid-js'
export const ByteWithLocale = () => {
const locales = ['de-DE', 'zh-CN']
const value = 1450.45
return (
{(locale) => (
)}
)
}
```
### Unit
Use the `unit` prop to specify the unit of the byte value.
```tsx
import { Format } from '@ark-ui/solid/format'
export const ByteWithUnit = () => {
const value = 1450.45
const unit = 'bit'
return (
File size:
)
}
```
### Unit Display
Use the `unitDisplay` prop to specify the display of the unit.
```tsx
import { Format } from '@ark-ui/solid/format'
import { For } from 'solid-js'
export const ByteWithUnitDisplay = () => {
const value = 50345.53
const unitDisplays = ['narrow', 'short', 'long'] as const
return (
{(unitDisplay) => }
)
}
```
# Format Byte (VUE)
## Usage
The byte formatting component extends the number formatting capabilities to handle byte-specific formatting, including
automatic unit conversion and display options.
```jsx
import { Format } from '@ark-ui/react'
```
## Examples
### Basic
Use the `Format.Byte` component to format a byte value with default options.
```vue
File size:
```
### Sizes
Use the `sizes` prop to specify custom byte sizes for formatting.
```vue
```
### Locale
Use the `locale` prop to format the byte value according to a specific locale.
```vue
```
### Unit
Use the `unit` prop to specify the unit of the byte value.
```vue
File size:
```
### Unit Display
Use the `unitDisplay` prop to specify the display of the unit.
```vue
```
# Format Number (REACT)
## Usage
The number formatting logic is handled by the native `Intl.NumberFormat` API and smartly cached to avoid performance
issues when using the same locale and options.
```jsx
import { Format } from '@ark-ui/react'
```
## Examples
### Basic
Use the `Format.Number` component to format a number with default options.
```tsx
import { Format } from '@ark-ui/react/format'
export const NumberBasic = () => {
return
}
```
### Percentage
Use the `style="percent"` prop to format the number as a percentage.
```tsx
import { Format } from '@ark-ui/react/format'
export const NumberWithPercentage = () => {
return
}
```
### Currency
Use the `style="currency"` prop along with the `currency` prop to format the number as a currency.
```tsx
import { Format } from '@ark-ui/react/format'
export const NumberWithCurrency = () => {
return
}
```
### Locale
Use the `locale` prop to format the number according to a specific locale.
```tsx
import { Format } from '@ark-ui/react/format'
import { LocaleProvider } from '@ark-ui/react/locale'
export const NumberWithLocale = () => {
return (
)
}
```
### Unit
Use the `style="unit"` prop along with the `unit` prop to format the number with a specific unit.
```tsx
import { Format } from '@ark-ui/react/format'
export const NumberWithUnit = () => {
return
}
```
### Compact Notation
Use the `notation="compact"` prop to format the number in compact notation.
```tsx
import { Format } from '@ark-ui/react/format'
export const NumberWithCompact = () => {
return
}
```
# Format Number (SOLID)
## Usage
The number formatting logic is handled by the native `Intl.NumberFormat` API and smartly cached to avoid performance
issues when using the same locale and options.
```jsx
import { Format } from '@ark-ui/react'
```
## Examples
### Basic
Use the `Format.Number` component to format a number with default options.
```tsx
import { Format } from '@ark-ui/solid/format'
export const NumberBasic = () => {
return
}
```
### Percentage
Use the `style="percent"` prop to format the number as a percentage.
```tsx
import { Format } from '@ark-ui/solid/format'
export const NumberWithPercentage = () => {
return
}
```
### Currency
Use the `style="currency"` prop along with the `currency` prop to format the number as a currency.
```tsx
import { Format } from '@ark-ui/solid/format'
export const NumberWithCurrency = () => {
return
}
```
### Locale
Use the `locale` prop to format the number according to a specific locale.
```tsx
import { Format } from '@ark-ui/solid/format'
import { LocaleProvider } from '@ark-ui/solid/locale'
export const NumberWithLocale = () => {
return (
)
}
```
### Unit
Use the `style="unit"` prop along with the `unit` prop to format the number with a specific unit.
```tsx
import { Format } from '@ark-ui/solid/format'
export const NumberWithUnit = () => {
return
}
```
### Compact Notation
Use the `notation="compact"` prop to format the number in compact notation.
```tsx
import { Format } from '@ark-ui/solid/format'
export const NumberWithCompact = () => {
return
}
```
# Format Number (VUE)
## Usage
The number formatting logic is handled by the native `Intl.NumberFormat` API and smartly cached to avoid performance
issues when using the same locale and options.
```jsx
import { Format } from '@ark-ui/react'
```
## Examples
### Basic
Use the `Format.Number` component to format a number with default options.
```vue
```
### Percentage
Use the `style="percent"` prop to format the number as a percentage.
```vue
```
### Currency
Use the `style="currency"` prop along with the `currency` prop to format the number as a currency.
```vue
```
### Locale
Use the `locale` prop to format the number according to a specific locale.
```vue
```
### Unit
Use the `style="unit"` prop along with the `unit` prop to format the number with a specific unit.
```vue
```
### Compact Notation
Use the `notation="compact"` prop to format the number in compact notation.
```vue
```
# Frame (REACT)
## Usage
The `Frame` component is used to render a component in an iframe.
- Tracks the size of the content and exposes them via css variables.
- Support for `head` prop to inject scripts and styles.
- Support for mount and unmount callbacks.
```jsx
import { Frame } from '@ark-ui/react'
```
## Examples
### Basic
Wrap your component in the `Frame` component to render it in an iframe.
```tsx
import { Frame } from '@ark-ui/react/frame'
export const Basic = () => {
return (
{'body { background-color: #f0f0f0; }'}}
>
Hello from inside the frame!
This content is rendered within our custom frame component using a Portal.
)
}
```
### Injecting Script
Using the `onMount` prop, you can inject a script into the iframe.
```tsx
import { Frame } from '@ark-ui/react/frame'
import { useRef } from 'react'
export const Script = () => {
const ref = useRef(null)
return (
{
const doc = ref.current?.contentDocument
if (!doc) return
const script = doc.createElement('script')
script.innerHTML = 'console.log("Hello from inside the frame!")'
doc.body.appendChild(script)
}}
style={{ border: '1px solid #ccc', width: '100%', height: 'var(--height)' }}
>
Hello from inside the frame!
This content is rendered within our custom frame component using a Portal.
)
}
```
### Custom src doc
Use the `srcDoc` prop to specify the HTML content of the page to use in the iframe.
```tsx
import { Frame } from '@ark-ui/react/frame'
const srcDoc = `
`
export const SrcDoc = () => {
return (
Hello from inside the frame!
This content is rendered within our custom frame component using a Portal.
The frame has custom initial content, including Font Awesome and Open Sans font.
)
}
```
# Frame (SOLID)
## Usage
The `Frame` component is used to render a component in an iframe.
- Tracks the size of the content and exposes them via css variables.
- Support for `head` prop to inject scripts and styles.
- Support for mount and unmount callbacks.
```jsx
import { Frame } from '@ark-ui/react'
```
## Examples
### Basic
Wrap your component in the `Frame` component to render it in an iframe.
```tsx
import { Frame } from '@ark-ui/solid/frame'
export const Basic = () => {
return (
{'body { background-color: #f0f0f0; }'}}
>
Hello from inside the frame!
This content is rendered within our custom frame component using a Portal.
)
}
```
### Injecting Script
Using the `onMount` prop, you can inject a script into the iframe.
```tsx
import { Frame } from '@ark-ui/solid/frame'
export const Script = () => {
let ref: HTMLIFrameElement | undefined
return (
{
const doc = ref?.contentDocument
if (!doc) return
const script = doc.createElement('script')
script.innerHTML = 'console.log("Hello from inside the frame!")'
doc.body.appendChild(script)
}}
style={{ border: '1px solid #ccc', width: '100%', height: 'var(--height)' }}
>
Hello from inside the frame!
This content is rendered within our custom frame component using a Portal.
)
}
```
### Custom src doc
Use the `srcDoc` prop to specify the HTML content of the page to use in the iframe.
```tsx
import { Frame } from '@ark-ui/solid/frame'
const srcDoc = `
`
export const SrcDoc = () => {
return (
Hello from inside the frame!
This content is rendered within our custom frame component using a Portal.
The frame has custom initial content, including Font Awesome and Open Sans font.
)
}
```
# Frame (VUE)
## Usage
The `Frame` component is used to render a component in an iframe.
- Tracks the size of the content and exposes them via css variables.
- Support for `head` prop to inject scripts and styles.
- Support for mount and unmount callbacks.
```jsx
import { Frame } from '@ark-ui/react'
```
## Examples
### Basic
Wrap your component in the `Frame` component to render it in an iframe.
```vue
Hello from inside the frame!
This content is rendered within our custom frame component using a Portal.
body { background-color: #f0f0f0; }
```
### Injecting Script
Using the `onMount` prop, you can inject a script into the iframe.
```vue
Hello from inside the frame!
This content is rendered within our custom frame component using a Portal.
```
### Custom src doc
Use the `srcDoc` prop to specify the HTML content of the page to use in the iframe.
```vue
Hello from inside the frame!
This content is rendered within our custom frame component using a Portal.
```
# Highlight (REACT)
## Usage
The Highlight component takes a `text` prop containing the full text and a `query` prop specifying the text to
highlight. It then renders the text with highlighted portions wrapped in `` tags.
```tsx
import { Highlight } from '@ark-ui/react/highlight'
export const Basic = () => {
return (
)
}
```
### Multiple Queries
You can highlight multiple terms by passing an array of strings to the `query` prop.
```tsx
import { Highlight } from '@ark-ui/react/highlight'
export const Multiple = () => {
return (
)
}
```
### Case Sensitivity
By default, the highlighting is case-sensitive. Use the `ignoreCase` prop to make it case-insensitive.
```tsx
import { Highlight } from '@ark-ui/react/highlight'
export const IgnoreCase = () => (
)
```
### Match All
By default, the Highlight component matches the first occurrence of the query. To highlight all occurrences of the
query, set the `matchAll` prop to `true`.
```tsx
import { Highlight } from '@ark-ui/react/highlight'
export const MatchAll = () => (
Match All
Match First Occurrence Only
)
```
## API Reference
### Highlight
#### Props
**`query`**
Type: `string | string[]`
Required: true
Default Value: `undefined`
Description: The query to highlight in the text
**`text`**
Type: `string`
Required: true
Default Value: `undefined`
Description: The text to highlight
**`ignoreCase`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Whether to ignore case while matching
**`matchAll`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Whether to match multiple instances of the query
## Customization
The Highlight component wraps matched text in `` tags.
```tsx
```
Style the `mark` tags using CSS to customize the appearance of highlighted text.
```css
.highlighted-text {
background-color: yellow;
}
```
# Highlight (SOLID)
## Usage
The Highlight component takes a `text` prop containing the full text and a `query` prop specifying the text to
highlight. It then renders the text with highlighted portions wrapped in `` tags.
```tsx
import { Highlight } from '@ark-ui/solid/highlight'
export const Basic = () => {
return (
)
}
```
### Multiple Queries
You can highlight multiple terms by passing an array of strings to the `query` prop.
```tsx
import { Highlight } from '@ark-ui/solid/highlight'
export const Multiple = () => {
return (
)
}
```
### Case Sensitivity
By default, the highlighting is case-sensitive. Use the `ignoreCase` prop to make it case-insensitive.
```tsx
import { Highlight } from '@ark-ui/solid/highlight'
export const IgnoreCase = () => (
)
```
### Match All
By default, the Highlight component matches the first occurrence of the query. To highlight all occurrences of the
query, set the `matchAll` prop to `true`.
```tsx
import { Highlight } from '@ark-ui/solid/highlight'
export const MatchAll = () => (
Match All
Match First Occurrence Only
)
```
## API Reference
### Highlight
#### Props
**`query`**
Type: `string | string[]`
Required: true
Default Value: `undefined`
Description: The query to highlight in the text
**`text`**
Type: `string`
Required: true
Default Value: `undefined`
Description: The text to highlight
**`ignoreCase`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Whether to ignore case while matching
**`matchAll`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Whether to match multiple instances of the query
## Customization
The Highlight component wraps matched text in `` tags.
```tsx
```
Style the `mark` tags using CSS to customize the appearance of highlighted text.
```css
.highlighted-text {
background-color: yellow;
}
```
# Highlight (VUE)
## Usage
The Highlight component takes a `text` prop containing the full text and a `query` prop specifying the text to
highlight. It then renders the text with highlighted portions wrapped in `` tags.
```vue
```
### Multiple Queries
You can highlight multiple terms by passing an array of strings to the `query` prop.
```vue
```
### Case Sensitivity
By default, the highlighting is case-sensitive. Use the `ignoreCase` prop to make it case-insensitive.
```vue
```
### Match All
By default, the Highlight component matches the first occurrence of the query. To highlight all occurrences of the
query, set the `matchAll` prop to `true`.
```vue
Match All
Match First Occurrence Only
```
## API Reference
### Highlight
#### Props
**`query`**
Type: `string | string[]`
Required: true
Default Value: `undefined`
Description: The query to highlight in the text
**`text`**
Type: `string`
Required: true
Default Value: `undefined`
Description: The text to highlight
**`ignoreCase`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Whether to ignore case while matching
**`matchAll`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Whether to match multiple instances of the query
## Customization
The Highlight component wraps matched text in `` tags.
```tsx
```
Style the `mark` tags using CSS to customize the appearance of highlighted text.
```css
.highlighted-text {
background-color: yellow;
}
```
# Locale (REACT)
## Setup
The `LocaleProvider` component sets the locale for your app, formatting dates, numbers, and other locale-specific data.
> **Note:** If no `LocaleProvider` is setup, the default locale for the app will be `en-US` and therefore the direction
> will be `ltr`.
```tsx
import { LocaleProvider } from '@ark-ui/react/locale'
export const App = () => {
return {/* Your App */}
}
```
## Usage
To access the current locale and direction settings, use the `useLocaleContext` hook.
```tsx
import { useLocaleContext } from '@ark-ui/react/locale'
export const Usage = () => {
const { locale, dir } = useLocaleContext()
return
{JSON.stringify({ locale, dir }, null, 2)}
}
```
## API Reference
### LocaleProvider
#### Props
**`locale`**
Type: `string`
Required: true
Default Value: `'en-US'`
Description: The locale to use for the application.
# Locale (SOLID)
## Setup
The `LocaleProvider` component sets the locale for your app, formatting dates, numbers, and other locale-specific data.
> **Note:** If no `LocaleProvider` is setup, the default locale for the app will be `en-US` and therefore the direction
> will be `ltr`.
```tsx
import { LocaleProvider } from '@ark-ui/solid/locale'
export const App = () => {
return {/* Your App */}
}
```
## Usage
To access the current locale and direction settings, use the `useLocaleContext` hook.
```tsx
import { useLocaleContext } from '@ark-ui/solid/locale'
export const Usage = () => {
const locale = useLocaleContext()
return
{JSON.stringify(locale(), null, 2)}
}
```
## API Reference
### LocaleProvider
#### Props
**`locale`**
Type: `string`
Required: true
Default Value: `'en-US'`
Description: The locale to use for the application.
# Locale (VUE)
## Setup
The `LocaleProvider` component sets the locale for your app, formatting dates, numbers, and other locale-specific data.
> **Note:** If no `LocaleProvider` is setup, the default locale for the app will be `en-US` and therefore the direction
> will be `ltr`.
```vue
```
## Usage
To access the current locale and direction settings, use the `useLocaleContext` hook.
```vue
{{ JSON.stringify(locale, null, 2) }}
```
## API Reference
### LocaleProvider
#### Props
**`locale`**
Type: `string`
Required: true
Default Value: `'en-US'`
Description: The locale to use for the application.
# Presence (REACT)
## Examples
By default the child component starts out as hidden and remains hidden after the `present` state is toggled off. This is
useful for situations where the element needs to be hidden initially and continue to stay hidden after its presence is
no longer required.
```tsx
import { Presence } from '@ark-ui/react/presence'
import { useState } from 'react'
export const Basic = () => {
const [present, setPresent] = useState(false)
return (
<>
Hidden and Hidden
>
)
}
```
### Lazy Mount
To delay the mounting of a child component until the `present` prop is set to true, use the `lazyMount` prop:
```tsx
import { Presence } from '@ark-ui/react/presence'
import { useState } from 'react'
export const LazyMount = () => {
const [present, setPresent] = useState(false)
return (
<>
Unmounted and Hidden
>
)
}
```
### Unmount on Exit
To remove the child component from the DOM when it's not present, use the `unmountOnExit` prop:
```tsx
import { Presence } from '@ark-ui/react/presence'
import { useState } from 'react'
export const UnmountOnExit = () => {
const [present, setPresent] = useState(false)
return (
<>
Hidden and Unmounted on Exit
>
)
}
```
### Combining Lazy Mount and Unmount on Exit
Both `lazyMount` and `unmountOnExit` can be combined for a component to be mounted only when it's present and to be
unmounted when it's no longer present:
```tsx
import { Presence } from '@ark-ui/react/presence'
import { useState } from 'react'
export const LazyMountAndUnmountOnExit = () => {
const [present, setPresent] = useState(false)
return (
<>
Lazy Mount and Unmounted on Exit
>
)
}
```
## API Reference
### Presence
#### Props
**`immediate`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Whether to synchronize the present change immediately or defer it to the next frame
**`onExitComplete`**
Type: `VoidFunction`
Required: false
Default Value: `undefined`
Description: Function called when the animation ends in the closed state
**`present`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Whether the node is present (controlled by the user)
# Presence (SOLID)
## Examples
By default the child component starts out as hidden and remains hidden after the `present` state is toggled off. This is
useful for situations where the element needs to be hidden initially and continue to stay hidden after its presence is
no longer required.
```tsx
import { Presence } from '@ark-ui/solid/presence'
import { createSignal } from 'solid-js'
export const Basic = () => {
const [present, setPresent] = createSignal(false)
return (
<>
Hidden and Hidden
>
)
}
```
### Lazy Mount
To delay the mounting of a child component until the `present` prop is set to true, use the `lazyMount` prop:
```tsx
import { Presence } from '@ark-ui/solid/presence'
import { createSignal } from 'solid-js'
export const LazyMount = () => {
const [present, setPresent] = createSignal(false)
return (
<>
Unmounted and Hidden
>
)
}
```
### Unmount on Exit
To remove the child component from the DOM when it's not present, use the `unmountOnExit` prop:
```tsx
import { Presence } from '@ark-ui/solid/presence'
import { createSignal } from 'solid-js'
export const UnmountOnExit = () => {
const [present, setPresent] = createSignal(false)
return (
<>
Hidden and Unmounted on Exit
>
)
}
```
### Combining Lazy Mount and Unmount on Exit
Both `lazyMount` and `unmountOnExit` can be combined for a component to be mounted only when it's present and to be
unmounted when it's no longer present:
```tsx
import { Presence } from '@ark-ui/solid/presence'
import { createSignal } from 'solid-js'
export const LazyMountAndUnmountOnExit = () => {
const [present, setPresent] = createSignal(false)
return (
<>
Lazy Mount and Unmounted on Exit
>
)
}
```
## API Reference
### Presence
#### Props
**`asChild`**
Type: `(props: ParentProps<'div'>) => Element`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.
**`immediate`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Whether to synchronize the present change immediately or defer it to the next frame
**`lazyMount`**
Type: `boolean`
Required: false
Default Value: `false`
Description: Whether to enable lazy mounting
**`onExitComplete`**
Type: `VoidFunction`
Required: false
Default Value: `undefined`
Description: Function called when the animation ends in the closed state
**`present`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Whether the node is present (controlled by the user)
**`unmountOnExit`**
Type: `boolean`
Required: false
Default Value: `false`
Description: Whether to unmount on exit.
# Presence (VUE)
## Examples
By default the child component starts out as hidden and remains hidden after the `present` state is toggled off. This is
useful for situations where the element needs to be hidden initially and continue to stay hidden after its presence is
no longer required.
```vue
Hidden and Hidden
```
### Lazy Mount
To delay the mounting of a child component until the `present` prop is set to true, use the `lazyMount` prop:
```vue
Hidden and Hidden
```
### Unmount on Exit
To remove the child component from the DOM when it's not present, use the `unmountOnExit` prop:
```vue
Hidden and Unmounted on Exit
```
### Combining Lazy Mount and Unmount on Exit
Both `lazyMount` and `unmountOnExit` can be combined for a component to be mounted only when it's present and to be
unmounted when it's no longer present:
```vue
Lazy Mount and Unmounted on Exit
```
## API Reference
### Presence
#### Props
**`immediate`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Whether to synchronize the present change immediately or defer it to the next frame
**`onExitComplete`**
Type: `VoidFunction`
Required: false
Default Value: `undefined`
Description: Function called when the animation ends in the closed state
**`present`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Whether the node is present (controlled by the user)
#### Emits
**`exitComplete`**
Type: `[]`
Description: Function called when the animation ends in the closed state