## How to use these docs
Vinicunca is a set of open source packages for building Vue and TypeScript applications. Each package has its own section on this site.
- **Pohon UI** (`pohon-ui`): styled, accessible Vue and Nuxt components built on Akar and UnoCSS. Use it for application UI: forms, tables, overlays, dashboards, docs and chat layouts.
- **Akar** (`akar`): unstyled, accessible Vue primitives (a fork of Reka UI). Use it to build your own design system, or when Pohon UI is too opinionated.
- **Perkakas** (`@vinicunca/perkakas`): typed data-first and data-last utility functions (a fork of Remeda). Use it instead of lodash or ramda.
- **Taman** (`create-taman`, `@vinicunca/taman-*`, `@vinicunca/request`): a full-stack Vue admin template with oRPC, better-auth, Drizzle and Cloudflare Workers.
- **ESLint Config** (`@vinicunca/eslint-config`): a flat ESLint config that also formats code. Use `vinicuncaESLint()` in `eslint.config.js`.
- **UnoCSS Preset** (`@vinicunca/unocss-preset`): `presetVinicunca()`, the UnoCSS preset every Vinicunca project uses, with fluid sizing, animations and scrollbars.
- **UnoCSS Variants** (`unocss-variants`): `uv()` for variants, slots and compound styles with UnoCSS, a port of Tailwind Variants.
How an agent should read this site:
- Read any documentation page as Markdown: prefix its path with `/raw` and add `.md` (`https://vinicunca.dev/raw/pohon/components/button.md`).
- Start from the Markdown sitemap at https://vinicunca.dev/sitemap.md, or the full documentation at https://vinicunca.dev/llms-full.txt.
- For Pohon UI conventions and component selection, load the agent skill at https://vinicunca.dev/.well-known/skills/pohon-ui/SKILL.md.
- For ESLint Config setup and the style rules it enforces, load the agent skill at https://vinicunca.dev/.well-known/skills/eslint-config/SKILL.md.
- For Taman project layout and the add-a-feature checklist, load the agent skill at https://vinicunca.dev/.well-known/skills/taman/SKILL.md.
- For UnoCSS Preset setup, fluid utilities and theme tokens, load the agent skill at https://vinicunca.dev/.well-known/skills/unocss-preset/SKILL.md.
- For Perkakas imports, pipe, and data-first versus data-last, load the agent skill at https://vinicunca.dev/.well-known/skills/perkakas/SKILL.md.
- For Akar composition (Root/Trigger/Content, asChild, data attributes), load the agent skill at https://vinicunca.dev/.well-known/skills/akar/SKILL.md.
- For UnoCSS Variants (`uv`, slots, compound variants, no class merging), load the agent skill at https://vinicunca.dev/.well-known/skills/unocss-variants/SKILL.md.
- For setting up or troubleshooting a Windows (WSL) dev machine, load the agent skill at https://vinicunca.dev/.well-known/skills/windows-dev/SKILL.md.
Entry points:
- [Pohon UI installation (Nuxt)](https://vinicunca.dev/raw/pohon/getting-started/installation/nuxt.md): Add Pohon UI to a Nuxt application
- [Pohon UI installation (Vue)](https://vinicunca.dev/raw/pohon/getting-started/installation/vue.md): Add Pohon UI to a Vue application with Vite
- [Pohon UI agent skill](https://vinicunca.dev/.well-known/skills/pohon-ui/SKILL.md): Conventions, component selection and layout recipes
- [ESLint Config](https://vinicunca.dev/raw/eslint/getting-started.md): Install vinicuncaESLint and set up the editor
- [ESLint Config agent skill](https://vinicunca.dev/.well-known/skills/eslint-config/SKILL.md): Factory options and the style conventions it enforces
- [Taman](https://vinicunca.dev/raw/taman/getting-started.md): Create a Taman project and run it locally
- [Taman agent skill](https://vinicunca.dev/.well-known/skills/taman/SKILL.md): Where code goes and the add-a-feature checklist
- [UnoCSS Preset agent skill](https://vinicunca.dev/.well-known/skills/unocss-preset/SKILL.md): presetVinicunca options, fluid utilities and theme tokens
- [Perkakas](https://vinicunca.dev/raw/perkakas/getting-started.md): Install Perkakas and the function reference
- [Perkakas agent skill](https://vinicunca.dev/.well-known/skills/perkakas/SKILL.md): Data-first and data-last, pipe, and common functions
- [Akar](https://vinicunca.dev/raw/akar/overview.md): Install Akar and the component anatomy
- [Akar agent skill](https://vinicunca.dev/.well-known/skills/akar/SKILL.md): When to use Akar, composition, and data attributes
- [UnoCSS Variants](https://vinicunca.dev/raw/unocss-variants/getting-started.md): uv() variants, slots, and the no-merge layer setup
- [UnoCSS Variants agent skill](https://vinicunca.dev/.well-known/skills/unocss-variants/SKILL.md): uv API, slots, compound variants, and the no-merge caveat
- [Markdown sitemap](https://vinicunca.dev/sitemap.md): Every page on the site, as Markdown links
# Vinicunca
> Documentation for every @vinicunca package.
## How to use these docs
Vinicunca is a set of open source packages for building Vue and TypeScript applications. Each package has its own section on this site.
- **Pohon UI** (`pohon-ui`): styled, accessible Vue and Nuxt components built on Akar and UnoCSS. Use it for application UI: forms, tables, overlays, dashboards, docs and chat layouts.
- **Akar** (`akar`): unstyled, accessible Vue primitives (a fork of Reka UI). Use it to build your own design system, or when Pohon UI is too opinionated.
- **Perkakas** (`@vinicunca/perkakas`): typed data-first and data-last utility functions (a fork of Remeda). Use it instead of lodash or ramda.
- **Taman** (`create-taman`, `@vinicunca/taman-*`, `@vinicunca/request`): a full-stack Vue admin template with oRPC, better-auth, Drizzle and Cloudflare Workers.
- **ESLint Config** (`@vinicunca/eslint-config`): a flat ESLint config that also formats code. Use `vinicuncaESLint()` in `eslint.config.js`.
- **UnoCSS Preset** (`@vinicunca/unocss-preset`): `presetVinicunca()`, the UnoCSS preset every Vinicunca project uses, with fluid sizing, animations and scrollbars.
- **UnoCSS Variants** (`unocss-variants`): `uv()` for variants, slots and compound styles with UnoCSS, a port of Tailwind Variants.
How an agent should read this site:
- Read any documentation page as Markdown: prefix its path with `/raw` and add `.md` (`https://vinicunca.dev/raw/pohon/components/button.md`).
- Start from the Markdown sitemap at https://vinicunca.dev/sitemap.md, or the full documentation at https://vinicunca.dev/llms-full.txt.
- For Pohon UI conventions and component selection, load the agent skill at https://vinicunca.dev/.well-known/skills/pohon-ui/SKILL.md.
- For ESLint Config setup and the style rules it enforces, load the agent skill at https://vinicunca.dev/.well-known/skills/eslint-config/SKILL.md.
- For Taman project layout and the add-a-feature checklist, load the agent skill at https://vinicunca.dev/.well-known/skills/taman/SKILL.md.
- For UnoCSS Preset setup, fluid utilities and theme tokens, load the agent skill at https://vinicunca.dev/.well-known/skills/unocss-preset/SKILL.md.
- For Perkakas imports, pipe, and data-first versus data-last, load the agent skill at https://vinicunca.dev/.well-known/skills/perkakas/SKILL.md.
- For Akar composition (Root/Trigger/Content, asChild, data attributes), load the agent skill at https://vinicunca.dev/.well-known/skills/akar/SKILL.md.
- For UnoCSS Variants (`uv`, slots, compound variants, no class merging), load the agent skill at https://vinicunca.dev/.well-known/skills/unocss-variants/SKILL.md.
- For setting up or troubleshooting a Windows (WSL) dev machine, load the agent skill at https://vinicunca.dev/.well-known/skills/windows-dev/SKILL.md.
Entry points:
- [Pohon UI installation (Nuxt)](https://vinicunca.dev/raw/pohon/getting-started/installation/nuxt.md): Add Pohon UI to a Nuxt application
- [Pohon UI installation (Vue)](https://vinicunca.dev/raw/pohon/getting-started/installation/vue.md): Add Pohon UI to a Vue application with Vite
- [Pohon UI agent skill](https://vinicunca.dev/.well-known/skills/pohon-ui/SKILL.md): Conventions, component selection and layout recipes
- [ESLint Config](https://vinicunca.dev/raw/eslint/getting-started.md): Install vinicuncaESLint and set up the editor
- [ESLint Config agent skill](https://vinicunca.dev/.well-known/skills/eslint-config/SKILL.md): Factory options and the style conventions it enforces
- [Taman](https://vinicunca.dev/raw/taman/getting-started.md): Create a Taman project and run it locally
- [Taman agent skill](https://vinicunca.dev/.well-known/skills/taman/SKILL.md): Where code goes and the add-a-feature checklist
- [UnoCSS Preset agent skill](https://vinicunca.dev/.well-known/skills/unocss-preset/SKILL.md): presetVinicunca options, fluid utilities and theme tokens
- [Perkakas](https://vinicunca.dev/raw/perkakas/getting-started.md): Install Perkakas and the function reference
- [Perkakas agent skill](https://vinicunca.dev/.well-known/skills/perkakas/SKILL.md): Data-first and data-last, pipe, and common functions
- [Akar](https://vinicunca.dev/raw/akar/overview.md): Install Akar and the component anatomy
- [Akar agent skill](https://vinicunca.dev/.well-known/skills/akar/SKILL.md): When to use Akar, composition, and data attributes
- [UnoCSS Variants](https://vinicunca.dev/raw/unocss-variants/getting-started.md): uv() variants, slots, and the no-merge layer setup
- [UnoCSS Variants agent skill](https://vinicunca.dev/.well-known/skills/unocss-variants/SKILL.md): uv API, slots, compound variants, and the no-merge caveat
- [Markdown sitemap](https://vinicunca.dev/sitemap.md): Every page on the site, as Markdown links
## Packages
- [Akar](https://vinicunca.dev/raw/akar/overview.md): Unstyled, accessible Vue primitives for building design systems.
- [Pohon UI](https://vinicunca.dev/raw/pohon/getting-started.md): A Vue and Nuxt component library styled with UnoCSS, built on Akar.
- [Taman](https://vinicunca.dev/raw/taman/getting-started.md): A full-stack Vue admin template with oRPC, better-auth and Cloudflare.
- [Perkakas](https://vinicunca.dev/raw/perkakas/getting-started.md): A typed, data-first and data-last utility library for TypeScript.
- [ESLint Config](https://vinicunca.dev/raw/eslint/getting-started.md): Vinicunca's flat ESLint config with formatting, TypeScript, Vue and more.
- [UnoCSS Preset](https://vinicunca.dev/raw/unocss-preset/getting-started.md): The Vinicunca UnoCSS preset: fluid sizing, animations, scrollbars and more.
- [UnoCSS Variants](https://vinicunca.dev/raw/unocss-variants/getting-started.md): Variants, slots and compound styles for UnoCSS, a port of Tailwind Variants.
- [Windows Dev Setup](https://vinicunca.dev/raw/windows-dev/guide.md): Set up a web development environment on Windows with WSL.
## Links
- Website:
Click me
{{ error }}
Submitted as "{{ submittedUsername }}".
Dimensions
Make changes to your account here. Click save when you're done.
Change your password here. After saving, you'll be logged out.
Start time is unavailable
End time is unavailable
Business hours: 8:00 AM - 6:00 PM
Minutes increment by 15
Try navigating with Tab, Arrow keys, and typing numbers. Focus moves automatically between segments.
{{ error }}
Select the start and end times for your meeting. Use Tab to navigate between fields.
Dimensions
Tab to focus
Read our [Composition](https://vinicunca.dev/akar/guides/composition) guide for more details. |
| `collapsible` | `false` | `boolean` | When type is "single", allows closing content when clicking trigger for an open item.
When type is "multiple", this prop has no effect. |
| `defaultValue` | | `T` | The default active value of the item(s).
Use when you do not need to control the state of the item(s). |
| `dir` | `"ltr"` | `"ltr" \| "rtl"` | The reading direction of the accordion when applicable. If omitted, assumes LTR (left-to-right) reading mode. |
| `disabled` | `false` | `boolean` | When `true`, prevents the user from interacting with the accordion and all its items |
| `modelValue` | | `T` | The controlled value of the active item(s).
Use this when you need to control the state of the items. Can be binded with `v-model` |
| `orientation` | `"vertical"` | `"vertical" \| "horizontal"` | The orientation of the accordion. |
| `type` | | `"single" \| "multiple"` | Determines whether a "single" or "multiple" items can be selected at a time.
This prop will overwrite the inferred type from `modelValue` and `defaultValue`. |
| `unmountOnHide` | `true` | `boolean` | When `true`, the element will be unmounted on closed state. |
**Events**
| Event | Payload | Description |
| --- | --- | --- |
| `update:modelValue` | `value: (ExplicitType extends "single" ? string : string[])` | Event handler called when the expanded state of an item changes |
**Slots**
| Slot | Payload | Description |
| --- | --- | --- |
| `modelValue` | `AcceptableValue \| AcceptableValue[]` | Current active value |
[AccordionRoot.vue source](https://github.com/vinicunca/akar/blob/v2.0.20/packages/core/src/Accordion/AccordionRoot.vue)
| Data attribute | Value |
| --- | --- |
| `[data-orientation]` | "vertical" \\| "horizontal" |
### Item
Contains all the parts of a collapsible section.
**Props**
| Prop | Default | Type | Description |
| --- | --- | --- | --- |
| `as` | `"div"` | `AsTag \| Component` | The element or component this component should render as. Can be overwritten by `asChild`. |
| `asChild` | | `boolean` | Change the default rendered element for the one passed as a child, merging their props and behavior.
Read our [Composition](https://vinicunca.dev/akar/guides/composition) guide for more details. |
| `disabled` | `false` | `boolean` | Whether or not an accordion item is disabled from user interaction.
When `true`, prevents the user from interacting with the item. |
| `unmountOnHide` | | `boolean` | When `true`, the element will be unmounted on closed state. |
| `value*` | | `string` | A string value for the accordion item. All items within an accordion should use a unique value. |
**Slots**
| Slot | Payload | Description |
| --- | --- | --- |
| `open` | `boolean` | Current open state |
[AccordionItem.vue source](https://github.com/vinicunca/akar/blob/v2.0.20/packages/core/src/Accordion/AccordionItem.vue)
| Data attribute | Value |
| --- | --- |
| `[data-state]` | "open" \\| "closed" |
| `[data-disabled]` | Present when disabled |
| `[data-orientation]` | "vertical" \\| "horizontal" |
### Header
Wraps an `AccordionTrigger`. Use the `asChild` prop to update it to the appropriate heading level for your page.
**Props**
| Prop | Default | Type | Description |
| --- | --- | --- | --- |
| `as` | `"h3"` | `AsTag \| Component` | The element or component this component should render as. Can be overwritten by `asChild`. |
| `asChild` | | `boolean` | Change the default rendered element for the one passed as a child, merging their props and behavior.
Read our [Composition](https://vinicunca.dev/akar/guides/composition) guide for more details. |
[AccordionHeader.vue source](https://github.com/vinicunca/akar/blob/v2.0.20/packages/core/src/Accordion/AccordionHeader.vue)
| Data attribute | Value |
| --- | --- |
| `[data-state]` | "open" \\| "closed" |
| `[data-disabled]` | Present when disabled |
| `[data-orientation]` | "vertical" \\| "horizontal" |
### Trigger
Toggles the collapsed state of its associated item. It should be nested inside of an `AccordionHeader`.
**Props**
| Prop | Default | Type | Description |
| --- | --- | --- | --- |
| `as` | `"div"` | `AsTag \| Component` | The element or component this component should render as. Can be overwritten by `asChild`. |
| `asChild` | | `boolean` | Change the default rendered element for the one passed as a child, merging their props and behavior.
Read our [Composition](https://vinicunca.dev/akar/guides/composition) guide for more details. |
[AccordionTrigger.vue source](https://github.com/vinicunca/akar/blob/v2.0.20/packages/core/src/Accordion/AccordionTrigger.vue)
| Data attribute | Value |
| --- | --- |
| `[data-state]` | "open" \\| "closed" |
| `[data-disabled]` | Present when disabled |
| `[data-orientation]` | "vertical" \\| "horizontal" |
### Content
Contains the collapsible content for an item.
**Props**
| Prop | Default | Type | Description |
| --- | --- | --- | --- |
| `as` | `"div"` | `AsTag \| Component` | The element or component this component should render as. Can be overwritten by `asChild`. |
| `asChild` | | `boolean` | Change the default rendered element for the one passed as a child, merging their props and behavior.
Read our [Composition](https://vinicunca.dev/akar/guides/composition) guide for more details. |
| `forceMount` | | `boolean` | Used to force mounting when more control is needed. Useful when
controlling animation with Vue animation libraries. |
[AccordionContent.vue source](https://github.com/vinicunca/akar/blob/v2.0.20/packages/core/src/Accordion/AccordionContent.vue)
| Data attribute | Value |
| --- | --- |
| `[data-state]` | "open" \\| "closed" |
| `[data-disabled]` | Present when disabled |
| `[data-orientation]` | "vertical" \\| "horizontal" |
| CSS variable | Description |
| --- | --- |
| `--akar-accordion-content-width` | The width of the content when it opens/closes |
| `--akar-accordion-content-height` | The height of the content when it opens/closes |
## Examples
### Expanded by default
Use the `defaultValue` prop to define the open item by default.
```vue
Useful for SEO or when you want to improve performance by not remounting the component on every open. |
**Events**
| Event | Payload | Description |
| --- | --- | --- |
| `update:open` | `value: boolean` | Event handler called when the open state of the dialog changes. |
**Slots**
| Slot | Payload | Description |
| --- | --- | --- |
| `open` | `boolean` | Current open state |
| `close` | `(): void` | Close the dialog |
[AlertDialogRoot.vue source](https://github.com/vinicunca/akar/blob/v2.0.20/packages/core/src/AlertDialog/AlertDialogRoot.vue)
### Trigger
A button that opens the dialog.
**Props**
| Prop | Default | Type | Description |
| --- | --- | --- | --- |
| `as` | `"button"` | `AsTag \| Component` | The element or component this component should render as. Can be overwritten by `asChild`. |
| `asChild` | | `boolean` | Change the default rendered element for the one passed as a child, merging their props and behavior.
Read our [Composition](https://vinicunca.dev/akar/guides/composition) guide for more details. |
[AlertDialogTrigger.vue source](https://github.com/vinicunca/akar/blob/v2.0.20/packages/core/src/AlertDialog/AlertDialogTrigger.vue)
| Data attribute | Value |
| --- | --- |
| `[data-state]` | "open" \\| "closed" |
### Portal
When used, portals your overlay and content parts into the `body`.
**Props**
| Prop | Default | Type | Description |
| --- | --- | --- | --- |
| `defer` | | `boolean` | Defer the resolving of a Teleport target until other parts of the
application have mounted (requires Vue 3.5.0+)
[reference](https://vuejs.org/guide/built-ins/teleport.html#deferred-teleport) |
| `disabled` | | `boolean` | Disable teleport and render the component inline
[reference](https://vuejs.org/guide/built-ins/teleport.html#disabling-teleport) |
| `forceMount` | | `boolean` | Used to force mounting when more control is needed. Useful when
controlling animation with Vue animation libraries. |
| `to` | | `string \| HTMLElement` | Vue native teleport component prop `:to`
[reference](https://vuejs.org/guide/built-ins/teleport.html#basic-usage) |
[AlertDialogPortal.vue source](https://github.com/vinicunca/akar/blob/v2.0.20/packages/core/src/AlertDialog/AlertDialogPortal.vue)
### Overlay
A layer that covers the inert portion of the view when the dialog is open.
**Props**
| Prop | Default | Type | Description |
| --- | --- | --- | --- |
| `as` | `"div"` | `AsTag \| Component` | The element or component this component should render as. Can be overwritten by `asChild`. |
| `asChild` | | `boolean` | Change the default rendered element for the one passed as a child, merging their props and behavior.
Read our [Composition](https://vinicunca.dev/akar/guides/composition) guide for more details. |
| `forceMount` | | `boolean` | Used to force mounting when more control is needed. Useful when
controlling animation with Vue animation libraries. |
[AlertDialogOverlay.vue source](https://github.com/vinicunca/akar/blob/v2.0.20/packages/core/src/AlertDialog/AlertDialogOverlay.vue)
| Data attribute | Value |
| --- | --- |
| `[data-state]` | "open" \\| "closed" |
### Content
Contains content to be rendered when the dialog is open.
**Props**
| Prop | Default | Type | Description |
| --- | --- | --- | --- |
| `as` | `"div"` | `AsTag \| Component` | The element or component this component should render as. Can be overwritten by `asChild`. |
| `asChild` | | `boolean` | Change the default rendered element for the one passed as a child, merging their props and behavior.
Read our [Composition](https://vinicunca.dev/akar/guides/composition) guide for more details. |
| `disableOutsidePointerEvents` | | `boolean` | When `true`, hover/focus/click interactions will be disabled on elements outside
the `DismissableLayer`. Users will need to click twice on outside elements to
interact with them: once to close the `DismissableLayer`, and again to trigger the element. |
| `forceMount` | | `boolean` | Used to force mounting when more control is needed. Useful when
controlling animation with Vue animation libraries. |
**Events**
| Event | Payload | Description |
| --- | --- | --- |
| `closeAutoFocus` | `event: Event` | Event handler called when auto-focusing on close.
Can be prevented. |
| `escapeKeyDown` | `event: KeyboardEvent` | Event handler called when the escape key is down.
Can be prevented. |
| `focusOutside` | `event: FocusOutsideEvent` | Event handler called when the focus moves outside of the `DismissableLayer`.
Can be prevented. |
| `interactOutside` | `event: PointerDownOutsideEvent \| FocusOutsideEvent` | Event handler called when an interaction happens outside the `DismissableLayer`.
Specifically, when a `pointerdown` event happens outside or focus moves outside of it.
Can be prevented. |
| `openAutoFocus` | `event: Event` | Event handler called when auto-focusing on open.
Can be prevented. |
| `pointerDownOutside` | `event: PointerDownOutsideEvent` | Event handler called when a `pointerdown` event happens outside of the `DismissableLayer`.
Can be prevented. |
[AlertDialogContent.vue source](https://github.com/vinicunca/akar/blob/v2.0.20/packages/core/src/AlertDialog/AlertDialogContent.vue)
| Data attribute | Value |
| --- | --- |
| `[data-state]` | "open" \\| "closed" |
### Cancel
A button that closes the dialog. This button should be distinguished visually from `AlertDialogAction` buttons.
**Props**
| Prop | Default | Type | Description |
| --- | --- | --- | --- |
| `as` | `"button"` | `AsTag \| Component` | The element or component this component should render as. Can be overwritten by `asChild`. |
| `asChild` | | `boolean` | Change the default rendered element for the one passed as a child, merging their props and behavior.
Read our [Composition](https://vinicunca.dev/akar/guides/composition) guide for more details. |
[AlertDialogCancel.vue source](https://github.com/vinicunca/akar/blob/v2.0.20/packages/core/src/AlertDialog/AlertDialogCancel.vue)
### Action
A button that closes the dialog. These buttons should be distinguished visually from the `AlertDialogCancel` button.
**Props**
| Prop | Default | Type | Description |
| --- | --- | --- | --- |
| `as` | `"button"` | `AsTag \| Component` | The element or component this component should render as. Can be overwritten by `asChild`. |
| `asChild` | | `boolean` | Change the default rendered element for the one passed as a child, merging their props and behavior.
Read our [Composition](https://vinicunca.dev/akar/guides/composition) guide for more details. |
[AlertDialogAction.vue source](https://github.com/vinicunca/akar/blob/v2.0.20/packages/core/src/AlertDialog/AlertDialogAction.vue)
### Title
An accessible name to be announced when the dialog is opened. Alternatively, you can provide `aria-label` or `aria-labelledby` to `AlertDialogContent` and exclude this component.
**Props**
| Prop | Default | Type | Description |
| --- | --- | --- | --- |
| `as` | `"h2"` | `AsTag \| Component` | The element or component this component should render as. Can be overwritten by `asChild`. |
| `asChild` | | `boolean` | Change the default rendered element for the one passed as a child, merging their props and behavior.
Read our [Composition](https://vinicunca.dev/akar/guides/composition) guide for more details. |
[AlertDialogTitle.vue source](https://github.com/vinicunca/akar/blob/v2.0.20/packages/core/src/AlertDialog/AlertDialogTitle.vue)
### Description
An accessible description to be announced when the dialog is opened. Alternatively, you can provide `aria-describedby` to `AlertDialogContent` and exclude this component.
**Props**
| Prop | Default | Type | Description |
| --- | --- | --- | --- |
| `as` | `"p"` | `AsTag \| Component` | The element or component this component should render as. Can be overwritten by `asChild`. |
| `asChild` | | `boolean` | Change the default rendered element for the one passed as a child, merging their props and behavior.
Read our [Composition](https://vinicunca.dev/akar/guides/composition) guide for more details. |
[AlertDialogDescription.vue source](https://github.com/vinicunca/akar/blob/v2.0.20/packages/core/src/AlertDialog/AlertDialogDescription.vue)
## Examples
### Close after asynchronous form submission
Use the controlled props to programmatically close the Alert Dialog after an async operation has completed.
```vue
Read our [Composition](https://vinicunca.dev/akar/guides/composition) guide for more details. |
| `ratio` | `1` | `number` | The desired ratio. Eg: 16/9 |
**Slots**
| Slot | Payload | Description |
| --- | --- | --- |
| `aspect` | `number` | Current aspect ratio (in %) |
[AspectRatio.vue source](https://github.com/vinicunca/akar/blob/v2.0.20/packages/core/src/AspectRatio/AspectRatio.vue)
---
- [GitHub](https://github.com/vinicunca/akar/blob/v2.0.20/packages/core/src/AspectRatio)
- [npm](https://www.npmjs.com/package/akar)
# Autocomplete
> An input with suggestions that allows free-form text entry. Unlike Combobox, the value is the input text itself rather than a selected item.
`````vue [index.vue]
Read our [Composition](/akar/guides/composition) guide for more details. |
| `defaultOpen` | | `boolean` | The open state of the autocomplete when it is initially rendered. Use when you do not need to control its open state. |
| `defaultValue` | | `string` | The value of the autocomplete when initially rendered. Use when you do not need to control the state. |
| `dir` | | `"ltr" \| "rtl"` | The reading direction of the autocomplete when applicable. |
| `disabled` | | `boolean` | When `true`, prevents the user from interacting with autocomplete |
| `highlightOnHover` | `true` | `boolean` | When `true`, hover over item will trigger highlight |
| `ignoreFilter` | | `boolean` | When `true`, disable the default filters |
| `modelValue` | | `string` | The controlled value of the Autocomplete (the input text). Can be bound with `v-model`. |
| `name` | | `string` | The name of the field. Submitted with its owning form as part of a name/value pair. |
| `open` | | `boolean` | The controlled open state of the Autocomplete. Can be bound with `v-model:open`. |
| `openOnClick` | `false` | `boolean` | Whether to open the autocomplete when the input is clicked |
| `openOnFocus` | `false` | `boolean` | Whether to open the autocomplete when the input is focused |
| `required` | | `boolean` | When `true`, indicates that the user must set the value before the owning form can be submitted. |
| `resetSearchTermOnBlur` | `false` | `boolean` | Whether to reset the searchTerm when the Autocomplete input blurred |
**Events**
| Event | Payload | Description |
| --- | --- | --- |
| `highlight` | `payload: { ref: HTMLElement; value: string; }` | Event handler when highlighted element changes. |
| `update:modelValue` | `value: string` | Event handler called when the value changes. |
| `update:open` | `value: boolean` | Event handler called when the open state of the autocomplete changes. |
**Slots**
| Slot | Payload | Description |
| --- | --- | --- |
| `open` | `boolean` | Current open state |
| `modelValue` | `string` | Current active value |
[AutocompleteRoot.vue source](https://github.com/vinicunca/akar/blob/v2.0.20/packages/core/src/Autocomplete/AutocompleteRoot.vue)
### Anchor
Used as an anchor if you set `AutocompleteContent`'s position to `popper`.
**Props**
| Prop | Default | Type | Description |
| --- | --- | --- | --- |
| `as` | `"div"` | `AsTag \| Component` | The element or component this component should render as. Can be overwritten by `asChild`. |
| `asChild` | | `boolean` | Change the default rendered element for the one passed as a child, merging their props and behavior.
Read our [Composition](/akar/guides/composition) guide for more details. |
| `reference` | | `ReferenceElement` | The reference (or anchor) element that is being referred to for positioning.
If not provided will use the current component as anchor. |
[ComboboxAnchor.vue source](https://github.com/vinicunca/akar/blob/v2.0.20/packages/core/src/Combobox/ComboboxAnchor.vue)
### Input
The input component to search through the autocomplete items. Typing updates the `modelValue` directly.
**Props**
| Prop | Default | Type | Description |
| --- | --- | --- | --- |
| `as` | `"input"` | `AsTag \| Component` | The element or component this component should render as. Can be overwritten by `asChild`. |
| `asChild` | | `boolean` | Change the default rendered element for the one passed as a child, merging their props and behavior.
Read our [Composition](/akar/guides/composition) guide for more details. |
| `autoFocus` | | `boolean` | Focus on element when mounted. |
| `disabled` | | `boolean` | When `true`, prevents the user from interacting with item |
| `modelValue` | | `string` | The controlled value of the filter. Can be binded with v-model. |
**Events**
| Event | Payload | Description |
| --- | --- | --- |
| `update:modelValue` | `string` | |
[AutocompleteInput.vue source](https://github.com/vinicunca/akar/blob/v2.0.20/packages/core/src/Autocomplete/AutocompleteInput.vue)
### Trigger
The button that toggles the Autocomplete Content.
**Props**
| Prop | Default | Type | Description |
| --- | --- | --- | --- |
| `as` | `"button"` | `AsTag \| Component` | The element or component this component should render as. Can be overwritten by `asChild`. |
| `asChild` | | `boolean` | Change the default rendered element for the one passed as a child, merging their props and behavior.
Read our [Composition](/akar/guides/composition) guide for more details. |
| `disabled` | | `boolean` | When `true`, prevents the user from interacting with item |
[ComboboxTrigger.vue source](https://github.com/vinicunca/akar/blob/v2.0.20/packages/core/src/Combobox/ComboboxTrigger.vue)
| Data attribute | Value |
| --- | --- |
| `[data-state]` | "open" \\| "closed" |
| `[data-disabled]` | Present when disabled |
### Cancel
The button that clears the input text and resets the value.
**Props**
| Prop | Default | Type | Description |
| --- | --- | --- | --- |
| `as` | `"button"` | `AsTag \| Component` | The element or component this component should render as. Can be overwritten by `asChild`. |
| `asChild` | | `boolean` | Change the default rendered element for the one passed as a child, merging their props and behavior.
Read our [Composition](/akar/guides/composition) guide for more details. |
[ComboboxCancel.vue source](https://github.com/vinicunca/akar/blob/v2.0.20/packages/core/src/Combobox/ComboboxCancel.vue)
### Empty
Shown when none of the items match the query.
**Props**
| Prop | Default | Type | Description |
| --- | --- | --- | --- |
| `as` | `"div"` | `AsTag \| Component` | The element or component this component should render as. Can be overwritten by `asChild`. |
| `asChild` | | `boolean` | Change the default rendered element for the one passed as a child, merging their props and behavior.
Read our [Composition](/akar/guides/composition) guide for more details. |
[ComboboxEmpty.vue source](https://github.com/vinicunca/akar/blob/v2.0.20/packages/core/src/Combobox/ComboboxEmpty.vue)
### Portal
When used, portals the content part into the `body`.
You need to set `position="popper"` for `AutocompleteContent` to make sure the position was automatically computed similar to `Popover` or `DropdownMenu`.
**Props**
| Prop | Default | Type | Description |
| --- | --- | --- | --- |
| `defer` | | `boolean` | Defer the resolving of a Teleport target until other parts of the
application have mounted (requires Vue 3.5.0+)
[reference](https://vuejs.org/guide/built-ins/teleport.html#deferred-teleport) |
| `disabled` | | `boolean` | Disable teleport and render the component inline
[reference](https://vuejs.org/guide/built-ins/teleport.html#disabling-teleport) |
| `forceMount` | | `boolean` | Used to force mounting when more control is needed. Useful when
controlling animation with Vue animation libraries. |
| `to` | | `string \| HTMLElement` | Vue native teleport component prop `:to`
[reference](https://vuejs.org/guide/built-ins/teleport.html#basic-usage) |
[ComboboxPortal.vue source](https://github.com/vinicunca/akar/blob/v2.0.20/packages/core/src/Combobox/ComboboxPortal.vue)
### Content
The component that pops out when the autocomplete is open.
> [!NOTE]
>
> Defer mounting with `forceMount` / [`Presence`](https://vinicunca.dev/akar/utilities/presence). See the [animation guide](https://vinicunca.dev/akar/guides/animation).
**Props**
| Prop | Default | Type | Description |
| --- | --- | --- | --- |
| `align` | `"center"` | `"start" \| "center" \| "end"` | The preferred alignment against the trigger.
May change when collisions occur. |
| `alignFlip` | `true` | `boolean` | Flip alignment when colliding with boundary.
May only occur when `prioritizePosition` is true. |
| `alignOffset` | `0` | `number` | An offset in pixels from the `start` or `end` alignment options. |
| `arrowPadding` | `0` | `number` | The padding between the arrow and the edges of the content.
If your content has border-radius, this will prevent it from
overflowing the corners. |
| `as` | `"div"` | `AsTag \| Component` | The element or component this component should render as. Can be overwritten by `asChild`. |
| `asChild` | | `boolean` | Change the default rendered element for the one passed as a child, merging their props and behavior.
Read our [Composition](/akar/guides/composition) guide for more details. |
| `avoidCollisions` | `true` | `boolean` | When `true`, overrides the side and align preferences
to prevent collisions with boundary edges. |
| `bodyLock` | | `boolean` | The document.body will be lock, and scrolling will be disabled. |
| `collisionBoundary` | `[]` | `Element \| (Element \| null)[] \| null` | The element used as the collision boundary. By default
this is the viewport, though you can provide additional
element(s) to be included in this check. |
| `collisionPadding` | `0` | `number \| Partial
detection should occur. Accepts a number (same for all sides),
or a partial padding object, for example: { top: 20, left: 20 }. |
| `dir` | | `"ltr" \| "rtl"` | The reading direction of the popper content when applicable.
If omitted, inherits globally from `ConfigProvider` or assumes LTR (left-to-right) reading mode. |
| `disableOutsidePointerEvents` | | `boolean` | When `true`, hover/focus/click interactions will be disabled on elements outside
the `DismissableLayer`. Users will need to click twice on outside elements to
interact with them: once to close the `DismissableLayer`, and again to trigger the element. |
| `disableUpdateOnLayoutShift` | `false` | `boolean` | Whether to disable the update position for the content when the layout shifted. |
| `forceMount` | | `boolean` | Used to force mounting when more control is needed. Useful when
controlling animation with Vue animation libraries. |
| `hideShiftedArrow` | `true` | `boolean` | When `true`, hides the arrow when it cannot be centered
to the reference element. |
| `hideWhenDetached` | `false` | `boolean` | Whether to hide the content when the trigger becomes fully occluded. |
| `hideWhenEmpty` | `false` | `boolean` | When `true`, hides the content when there are no items matching the filter. |
| `memoDependencies` | | `unknown[]` | Reactive dependencies that should invalidate the memoized content subtree. |
| `position` | | `"inline" \| "popper"` | The positioning mode to use,
`inline` is the default and you can control the position using CSS.
`popper` positions content in the same way as our other primitives, for example `Popover` or `DropdownMenu`. |
| `positionStrategy` | | `"fixed" \| "absolute"` | The type of CSS position property to use. |
| `present` | | `boolean` | Whether this kept-mounted content is currently visible. |
| `prioritizePosition` | `false` | `boolean` | Force content to be position within the viewport.
Might overlap the reference element, which may not be desired. |
| `reference` | | `ReferenceElement` | The custom element or virtual element that will be set as the reference
to position the floating element.
If provided, it will replace the default anchor element. |
| `side` | `"bottom"` | `"top" \| "right" \| "bottom" \| "left"` | The preferred side of the trigger to render against when open.
Will be reversed when collisions occur and avoidCollisions
is enabled. |
| `sideFlip` | `true` | `boolean` | Flip to the opposite side when colliding with boundary. |
| `sideOffset` | `0` | `number` | The distance in pixels from the trigger. |
| `sticky` | `"partial"` | `"partial" \| "always"` | The sticky behavior on the align axis. `partial` will keep the
content in the boundary as long as the trigger is at least partially
in the boundary whilst "always" will keep the content in the boundary
regardless. |
| `updatePositionStrategy` | `'optimized'` | `"always" \| "optimized"` | Strategy to update the position of the floating element on every animation frame. |
**Events**
| Event | Payload | Description |
| --- | --- | --- |
| `escapeKeyDown` | `event: KeyboardEvent` | Event handler called when the escape key is down.
Can be prevented. |
| `focusOutside` | `event: FocusOutsideEvent` | Event handler called when the focus moves outside of the `DismissableLayer`.
Can be prevented. |
| `interactOutside` | `event: PointerDownOutsideEvent \| FocusOutsideEvent` | Event handler called when an interaction happens outside the `DismissableLayer`.
Specifically, when a `pointerdown` event happens outside or focus moves outside of it.
Can be prevented. |
| `pointerDownOutside` | `event: PointerDownOutsideEvent` | Event handler called when a `pointerdown` event happens outside of the `DismissableLayer`.
Can be prevented. |
[ComboboxContent.vue source](https://github.com/vinicunca/akar/blob/v2.0.20/packages/core/src/Combobox/ComboboxContent.vue)
| Data attribute | Value |
| --- | --- |
| `[data-state]` | "open" \\| "closed" |
| `[data-side]` | "left" \\| "right" \\| "bottom" \\| "top" |
| `[data-align]` | "start" \\| "end" \\| "center" |
| `[data-empty]` | Present when there are no items matching the filter |
| CSS variable | Description |
| --- | --- |
| `--akar-combobox-content-transform-origin` | The `transform-origin` computed from the content and arrow positions/offsets. Only present when `position="popper"`. |
| `--akar-combobox-content-available-width` | The remaining width between the trigger and the boundary edge. Only present when `position="popper"`. |
| `--akar-combobox-content-available-height` | The remaining height between the trigger and the boundary edge. Only present when `position="popper"`. |
| `--akar-combobox-trigger-width` | The width of the trigger. Only present when `position="popper"`. |
| `--akar-combobox-trigger-height` | The height of the trigger. Only present when `position="popper"`. |
### Viewport
The scrolling viewport that contains all of the items.
**Props**
| Prop | Default | Type | Description |
| --- | --- | --- | --- |
| `as` | `"div"` | `AsTag \| Component` | The element or component this component should render as. Can be overwritten by `asChild`. |
| `asChild` | | `boolean` | Change the default rendered element for the one passed as a child, merging their props and behavior.
Read our [Composition](/akar/guides/composition) guide for more details. |
| `nonce` | | `string` | Will add `nonce` attribute to the style tag which can be used by Content Security Policy.
If omitted, inherits globally from `ConfigProvider`. |
[ComboboxViewport.vue source](https://github.com/vinicunca/akar/blob/v2.0.20/packages/core/src/Combobox/ComboboxViewport.vue)
### Item
The component that contains the autocomplete items. When selected, the item's string value fills the input.
**Props**
| Prop | Default | Type | Description |
| --- | --- | --- | --- |
| `as` | `"div"` | `AsTag \| Component` | The element or component this component should render as. Can be overwritten by `asChild`. |
| `asChild` | | `boolean` | Change the default rendered element for the one passed as a child, merging their props and behavior.
Read our [Composition](/akar/guides/composition) guide for more details. |
| `disabled` | | `boolean` | When `true`, prevents the user from interacting with the item. |
| `textValue` | | `string` | A string representation of the item contents.
If the children are not plain text, then the `textValue` prop must also be set to a plain text representation, which will be used for autocomplete in the ComboBox. |
| `value*` | | `T` | The value given as data when submitted with a `name`. |
**Events**
| Event | Payload | Description |
| --- | --- | --- |
| `select` | `event: SelectEvent
It can be prevented by calling `event.preventDefault`. |
**Slots**
| Slot | Payload | Description |
| --- | --- | --- |
| `selected` | `boolean` | Whether the item is currently selected |
[ComboboxItem.vue source](https://github.com/vinicunca/akar/blob/v2.0.20/packages/core/src/Combobox/ComboboxItem.vue)
| Data attribute | Value |
| --- | --- |
| `[data-state]` | "checked" \\| "unchecked" |
| `[data-highlighted]` | Present when highlighted |
| `[data-disabled]` | Present when disabled |
### Group
Used to group multiple items. Use in conjunction with `AutocompleteLabel` to ensure good accessibility via automatic labelling.
**Props**
| Prop | Default | Type | Description |
| --- | --- | --- | --- |
| `as` | `"div"` | `AsTag \| Component` | The element or component this component should render as. Can be overwritten by `asChild`. |
| `asChild` | | `boolean` | Change the default rendered element for the one passed as a child, merging their props and behavior.
Read our [Composition](/akar/guides/composition) guide for more details. |
[ComboboxGroup.vue source](https://github.com/vinicunca/akar/blob/v2.0.20/packages/core/src/Combobox/ComboboxGroup.vue)
### Label
Used to render the label of a group. It won't be focusable using arrow keys.
**Props**
| Prop | Default | Type | Description |
| --- | --- | --- | --- |
| `as` | `"div"` | `AsTag \| Component` | The element or component this component should render as. Can be overwritten by `asChild`. |
| `asChild` | | `boolean` | Change the default rendered element for the one passed as a child, merging their props and behavior.
Read our [Composition](/akar/guides/composition) guide for more details. |
| `for` | | `string` | |
[ComboboxLabel.vue source](https://github.com/vinicunca/akar/blob/v2.0.20/packages/core/src/Combobox/ComboboxLabel.vue)
### Separator
Used to visually separate items in the Autocomplete.
**Props**
| Prop | Default | Type | Description |
| --- | --- | --- | --- |
| `as` | `"div"` | `AsTag \| Component` | The element or component this component should render as. Can be overwritten by `asChild`. |
| `asChild` | | `boolean` | Change the default rendered element for the one passed as a child, merging their props and behavior.
Read our [Composition](/akar/guides/composition) guide for more details. |
[ComboboxSeparator.vue source](https://github.com/vinicunca/akar/blob/v2.0.20/packages/core/src/Combobox/ComboboxSeparator.vue)
### Arrow
An optional arrow element to render alongside the content. This can be used to help visually link the trigger with the `AutocompleteContent`. Must be rendered inside `AutocompleteContent`. Only available when `position` is set to `popper`.
**Props**
| Prop | Default | Type | Description |
| --- | --- | --- | --- |
| `as` | `"svg"` | `AsTag \| Component` | The element or component this component should render as. Can be overwritten by `asChild`. |
| `asChild` | | `boolean` | Change the default rendered element for the one passed as a child, merging their props and behavior.
Read our [Composition](/akar/guides/composition) guide for more details. |
| `height` | `5` | `number` | The height of the arrow in pixels. |
| `rounded` | `false` | `boolean` | When `true`, render the rounded version of arrow. Do not work with `as`/`asChild` |
| `width` | `10` | `number` | The width of the arrow in pixels. |
[ComboboxArrow.vue source](https://github.com/vinicunca/akar/blob/v2.0.20/packages/core/src/Combobox/ComboboxArrow.vue)
### Virtualizer
Virtual container to achieve list virtualization.
See the [virtualization guide](https://vinicunca.dev/akar/guides/virtualization.md) for more general info on virtualization.
**Props**
| Prop | Default | Type | Description |
| --- | --- | --- | --- |
| `estimateSize` | | `number \| ((index: number) => number)` | Estimated size (in px) of each item |
| `options*` | | `T` | List of items |
| `overscan` | | `number` | Number of items rendered outside the visible area |
| `textContent` | | `((option: T) => string)` | Text content for each item to achieve type-ahead feature |
**Slots**
| Slot | Payload | Description |
| --- | --- | --- |
| `option` | `T` | |
| `virtualizer` | `Virtualizer
Read our [Composition](https://vinicunca.dev/akar/guides/composition) guide for more details. |
[AvatarRoot.vue source](https://github.com/vinicunca/akar/blob/v2.0.20/packages/core/src/Avatar/AvatarRoot.vue)
### Image
The image to render. By default it will only render when it has loaded. You can use the `@loadingStatusChange` handler if you need more control.
**Props**
| Prop | Default | Type | Description |
| --- | --- | --- | --- |
| `as` | `"img"` | `AsTag \| Component` | The element or component this component should render as. Can be overwritten by `asChild`. |
| `asChild` | | `boolean` | Change the default rendered element for the one passed as a child, merging their props and behavior.
Read our [Composition](https://vinicunca.dev/akar/guides/composition) guide for more details. |
| `crossOrigin` | | `"" \| "anonymous" \| "use-credentials"` | |
| `referrerPolicy` | | `"" \| "no-referrer" \| "no-referrer-when-downgrade" \| "origin" \| "origin-when-cross-origin" \| "same-origin" \| "strict-origin" \| "strict-origin-when-cross-origin" \| "unsafe-url"` | |
| `src*` | | `string` | |
**Events**
| Event | Payload | Description |
| --- | --- | --- |
| `loadingStatusChange` | `value: ImageLoadingStatus` | A callback providing information about the loading status of the image.
This is useful in case you want to control more precisely what to render as the image is loading. |
[AvatarImage.vue source](https://github.com/vinicunca/akar/blob/v2.0.20/packages/core/src/Avatar/AvatarImage.vue)
### Fallback
An element that renders when the image hasn't loaded. This means whilst it's loading, or if there was an error. If you notice a flash during loading, you can provide a `delayMs` prop to delay its rendering so it only renders for those with slower connections. For more control, use the `@loadingStatusChange` emit on `AvatarImage`.
**Props**
| Prop | Default | Type | Description |
| --- | --- | --- | --- |
| `as` | `"span"` | `AsTag \| Component` | The element or component this component should render as. Can be overwritten by `asChild`. |
| `asChild` | | `boolean` | Change the default rendered element for the one passed as a child, merging their props and behavior.
Read our [Composition](https://vinicunca.dev/akar/guides/composition) guide for more details. |
| `delayMs` | | `number` | Useful for delaying rendering so it only appears for those with slower connections. |
[AvatarFallback.vue source](https://github.com/vinicunca/akar/blob/v2.0.20/packages/core/src/Avatar/AvatarFallback.vue)
## Examples
### Clickable Avatar with tooltip
You can compose the Avatar with a [Tooltip](https://vinicunca.dev/akar/components/tooltip) to display extra information.
```vue
Read our [Composition](/akar/guides/composition) guide for more details. |
| `calendarLabel` | | `string` | The accessible label for the calendar |
| `defaultPlaceholder` | | `DateValue` | The default placeholder date |
| `defaultValue` | | `DateValue` | The default value for the calendar |
| `dir` | | `"ltr" \| "rtl"` | The reading direction of the calendar when applicable.
If omitted, inherits globally from `ConfigProvider` or assumes LTR (left-to-right) reading mode. |
| `disabled` | `false` | `boolean` | Whether the calendar is disabled |
| `disableDaysOutsideCurrentView` | `false` | `boolean` | Whether or not to disable days outside the current view. |
| `fixedWeeks` | `false` | `boolean` | Whether or not to always display 6 weeks in the calendar |
| `initialFocus` | `false` | `boolean` | If true, the calendar will focus the selected day, today, or the first day of the month depending on what is visible when the calendar is mounted |
| `isDateDisabled` | | `Matcher` | A function that returns whether or not a date is disabled |
| `isDateUnavailable` | | `Matcher` | A function that returns whether or not a date is unavailable |
| `locale` | | `string` | The locale to use for formatting dates |
| `maxValue` | | `DateValue` | The maximum date that can be selected |
| `minValue` | | `DateValue` | The minimum date that can be selected |
| `modelValue` | | `DateValue \| DateValue[] \| null` | The controlled selected date value of the calendar. Can be bound as `v-model`. |
| `multiple` | `false` | `boolean` | Whether multiple dates can be selected |
| `nextPage` | | `((placeholder: DateValue) => DateValue)` | A function that returns the next page of the calendar. It receives the current placeholder as an argument inside the component. |
| `numberOfMonths` | `1` | `number` | The number of months to display at once |
| `pagedNavigation` | `false` | `boolean` | This property causes the previous and next buttons to navigate by the number of months displayed at once, rather than one month |
| `placeholder` | | `DateValue` | The placeholder date, which is used to determine what month to display when no date is selected |
| `preventDeselect` | `false` | `boolean` | Whether or not to prevent the user from deselecting a date without selecting another date first |
| `prevPage` | | `((placeholder: DateValue) => DateValue)` | A function that returns the previous page of the calendar. It receives the current placeholder as an argument inside the component. |
| `readonly` | `false` | `boolean` | Whether the calendar is readonly |
| `weekdayFormat` | `"narrow"` | `"narrow" \| "short" \| "long"` | The format to use for the weekday strings provided via the weekdays slot prop |
| `weekStartsOn` | | `0 \| 1 \| 2 \| 3 \| 4 \| 5 \| 6` | The day of the week to start the calendar on |
**Events**
| Event | Payload | Description |
| --- | --- | --- |
| `update:modelValue` | `date: DateValue` | Event handler called whenever the model value changes |
| `update:placeholder` | `date: DateValue` | Event handler called whenever the placeholder value changes |
**Slots**
| Slot | Payload | Description |
| --- | --- | --- |
| `date` | `DateValue` | The current date of the placeholder |
| `grid` | `Grid
Read our [Composition](/akar/guides/composition) guide for more details. |
[CalendarHeader.vue source](https://github.com/vinicunca/akar/blob/v2.0.20/packages/core/src/Calendar/CalendarHeader.vue)
### Prev Button
Calendar navigation button. It navigates the calendar one month/year/decade in the past based on the current calendar view.
**Props**
| Prop | Default | Type | Description |
| --- | --- | --- | --- |
| `as` | `"button"` | `AsTag \| Component` | The element or component this component should render as. Can be overwritten by `asChild`. |
| `asChild` | | `boolean` | Change the default rendered element for the one passed as a child, merging their props and behavior.
Read our [Composition](/akar/guides/composition) guide for more details. |
| `prevPage` | | `((placeholder: DateValue) => DateValue)` | The function to be used for the prev page. Overwrites the `prevPage` function set on the `CalendarRoot`. |
**Slots**
| Slot | Payload | Description |
| --- | --- | --- |
| `disabled` | `boolean` | Current disable state |
[CalendarPrev.vue source](https://github.com/vinicunca/akar/blob/v2.0.20/packages/core/src/Calendar/CalendarPrev.vue)
| Data attribute | Value |
| --- | --- |
| `[data-disabled]` | Present when disabled |
### Next Button
Calendar navigation button. It navigates the calendar one month/year/decade in the future based on the current calendar view.
**Props**
| Prop | Default | Type | Description |
| --- | --- | --- | --- |
| `as` | `"button"` | `AsTag \| Component` | The element or component this component should render as. Can be overwritten by `asChild`. |
| `asChild` | | `boolean` | Change the default rendered element for the one passed as a child, merging their props and behavior.
Read our [Composition](/akar/guides/composition) guide for more details. |
| `nextPage` | | `((placeholder: DateValue) => DateValue)` | The function to be used for the next page. Overwrites the `nextPage` function set on the `CalendarRoot`. |
**Slots**
| Slot | Payload | Description |
| --- | --- | --- |
| `disabled` | `boolean` | Current disable state |
[CalendarNext.vue source](https://github.com/vinicunca/akar/blob/v2.0.20/packages/core/src/Calendar/CalendarNext.vue)
| Data attribute | Value |
| --- | --- |
| `[data-disabled]` | Present when disabled |
### Heading
Heading for displaying the current month and year
**Props**
| Prop | Default | Type | Description |
| --- | --- | --- | --- |
| `as` | `"div"` | `AsTag \| Component` | The element or component this component should render as. Can be overwritten by `asChild`. |
| `asChild` | | `boolean` | Change the default rendered element for the one passed as a child, merging their props and behavior.
Read our [Composition](/akar/guides/composition) guide for more details. |
**Slots**
| Slot | Payload | Description |
| --- | --- | --- |
| `headingValue` | `string` | Current month and year |
[CalendarHeading.vue source](https://github.com/vinicunca/akar/blob/v2.0.20/packages/core/src/Calendar/CalendarHeading.vue)
| Data attribute | Value |
| --- | --- |
| `[data-disabled]` | Present when disabled |
### Grid
Container for wrapping the calendar grid.
**Props**
| Prop | Default | Type | Description |
| --- | --- | --- | --- |
| `as` | `"table"` | `AsTag \| Component` | The element or component this component should render as. Can be overwritten by `asChild`. |
| `asChild` | | `boolean` | Change the default rendered element for the one passed as a child, merging their props and behavior.
Read our [Composition](/akar/guides/composition) guide for more details. |
[CalendarGrid.vue source](https://github.com/vinicunca/akar/blob/v2.0.20/packages/core/src/Calendar/CalendarGrid.vue)
| Data attribute | Value |
| --- | --- |
| `[data-readonly]` | Present when readonly |
| `[data-disabled]` | Present when disabled |
### Grid Head
Container for wrapping the grid head.
**Props**
| Prop | Default | Type | Description |
| --- | --- | --- | --- |
| `as` | `"thead"` | `AsTag \| Component` | The element or component this component should render as. Can be overwritten by `asChild`. |
| `asChild` | | `boolean` | Change the default rendered element for the one passed as a child, merging their props and behavior.
Read our [Composition](/akar/guides/composition) guide for more details. |
[CalendarGridHead.vue source](https://github.com/vinicunca/akar/blob/v2.0.20/packages/core/src/Calendar/CalendarGridHead.vue)
### Grid Body
Container for wrapping the grid body.
**Props**
| Prop | Default | Type | Description |
| --- | --- | --- | --- |
| `as` | `"tbody"` | `AsTag \| Component` | The element or component this component should render as. Can be overwritten by `asChild`. |
| `asChild` | | `boolean` | Change the default rendered element for the one passed as a child, merging their props and behavior.
Read our [Composition](/akar/guides/composition) guide for more details. |
[CalendarGridBody.vue source](https://github.com/vinicunca/akar/blob/v2.0.20/packages/core/src/Calendar/CalendarGridBody.vue)
### Grid Row
Container for wrapping the grid row.
**Props**
| Prop | Default | Type | Description |
| --- | --- | --- | --- |
| `as` | `"tr"` | `AsTag \| Component` | The element or component this component should render as. Can be overwritten by `asChild`. |
| `asChild` | | `boolean` | Change the default rendered element for the one passed as a child, merging their props and behavior.
Read our [Composition](/akar/guides/composition) guide for more details. |
[CalendarGridRow.vue source](https://github.com/vinicunca/akar/blob/v2.0.20/packages/core/src/Calendar/CalendarGridRow.vue)
### Head Cell
Container for wrapping the head cell. Used for displaying the week days.
**Props**
| Prop | Default | Type | Description |
| --- | --- | --- | --- |
| `as` | `"th"` | `AsTag \| Component` | The element or component this component should render as. Can be overwritten by `asChild`. |
| `asChild` | | `boolean` | Change the default rendered element for the one passed as a child, merging their props and behavior.
Read our [Composition](/akar/guides/composition) guide for more details. |
[CalendarHeadCell.vue source](https://github.com/vinicunca/akar/blob/v2.0.20/packages/core/src/Calendar/CalendarHeadCell.vue)
### Cell
Container for wrapping the calendar cells.
**Props**
| Prop | Default | Type | Description |
| --- | --- | --- | --- |
| `as` | `"td"` | `AsTag \| Component` | The element or component this component should render as. Can be overwritten by `asChild`. |
| `asChild` | | `boolean` | Change the default rendered element for the one passed as a child, merging their props and behavior.
Read our [Composition](/akar/guides/composition) guide for more details. |
| `date*` | | `DateValue` | The date value for the cell |
[CalendarCell.vue source](https://github.com/vinicunca/akar/blob/v2.0.20/packages/core/src/Calendar/CalendarCell.vue)
| Data attribute | Value |
| --- | --- |
| `[data-disabled]` | Present when disabled |
### Cell Trigger
Interactable container for displaying the cell dates. Clicking it selects the date.
**Props**
| Prop | Default | Type | Description |
| --- | --- | --- | --- |
| `as` | `"div"` | `AsTag \| Component` | The element or component this component should render as. Can be overwritten by `asChild`. |
| `asChild` | | `boolean` | Change the default rendered element for the one passed as a child, merging their props and behavior.
Read our [Composition](/akar/guides/composition) guide for more details. |
| `day*` | | `DateValue` | The date value provided to the cell trigger |
| `month*` | | `DateValue` | The month in which the cell is rendered |
**Slots**
| Slot | Payload | Description |
| --- | --- | --- |
| `dayValue` | `string` | Current day |
| `disabled` | `boolean` | Current disable state |
| `selected` | `boolean` | Current selected state |
| `today` | `boolean` | Current today state |
| `outsideView` | `boolean` | Current outside view state |
| `outsideVisibleView` | `boolean` | Current outside visible view state |
| `unavailable` | `boolean` | Current unavailable state |
[CalendarCellTrigger.vue source](https://github.com/vinicunca/akar/blob/v2.0.20/packages/core/src/Calendar/CalendarCellTrigger.vue)
| Data attribute | Value |
| --- | --- |
| `[data-selected]` | Present when selected |
| `[data-value]` | The ISO string value of the date. |
| `[data-disabled]` | Present when disabled |
| `[data-unavailable]` | Present when unavailable |
| `[data-today]` | Present when today |
| `[data-outside-view]` | Present when the date is outside the current month it is displayed in. |
| `[data-outside-visible-view]` | Present when the date is outside the months that are visible on the calendar. |
| `[data-focused]` | Present when focused |
## Examples
### Calendar with Year Incrementation
This example showcases a calendar which allows incrementing the year.
```vue [index.vue]
Read our [Composition](https://vinicunca.dev/akar/guides/composition) guide for more details. |
| `defaultValue` | | `T \| "indeterminate"` | The value of the checkbox when it is initially rendered. Use when you do not need to control its value. |
| `disabled` | | `boolean` | When `true`, prevents the user from interacting with the checkbox |
| `falseValue` | `(() => false) as unknown as undefined` | `T` | The value used when the checkbox is unchecked. Defaults to `false`. |
| `id` | | `string` | Id of the element |
| `modelValue` | | `null \| T \| "indeterminate"` | The controlled value of the checkbox. Can be binded with v-model. |
| `name` | | `string` | The name of the field. Submitted with its owning form as part of a name/value pair. |
| `required` | | `boolean` | When `true`, indicates that the user must set the value before the owning form can be submitted. |
| `trueValue` | `(() => true) as unknown as undefined` | `T` | The value used when the checkbox is checked. Defaults to `true`. |
| `value` | `"on"` | `AcceptableValue` | The value given as data when submitted with a `name`. |
**Events**
| Event | Payload | Description |
| --- | --- | --- |
| `update:modelValue` | `value: T \| "indeterminate"` | Event handler called when the value of the checkbox changes. |
**Slots**
| Slot | Payload | Description |
| --- | --- | --- |
| `modelValue` | `T \| "indeterminate"` | Current value |
| `state` | `false \| true \| "indeterminate"` | Current state |
[CheckboxRoot.vue source](https://github.com/vinicunca/akar/blob/v2.0.20/packages/core/src/Checkbox/CheckboxRoot.vue)
| Data attribute | Value |
| --- | --- |
| `[data-state]` | "checked" \\| "unchecked" \\| "indeterminate" |
| `[data-disabled]` | Present when disabled |
### Indicator
Renders when the checkbox is in a checked or indeterminate state. You can style this element directly, or you can use it as a wrapper to put an icon into, or both.
> [!NOTE]
>
> Defer mounting with `forceMount` / [`Presence`](https://vinicunca.dev/akar/utilities/presence). See the [animation guide](https://vinicunca.dev/akar/guides/animation).
**Props**
| Prop | Default | Type | Description |
| --- | --- | --- | --- |
| `as` | `"span"` | `AsTag \| Component` | The element or component this component should render as. Can be overwritten by `asChild`. |
| `asChild` | | `boolean` | Change the default rendered element for the one passed as a child, merging their props and behavior.
Read our [Composition](https://vinicunca.dev/akar/guides/composition) guide for more details. |
| `forceMount` | | `boolean` | Used to force mounting when more control is needed. Useful when
controlling animation with Vue animation libraries. |
[CheckboxIndicator.vue source](https://github.com/vinicunca/akar/blob/v2.0.20/packages/core/src/Checkbox/CheckboxIndicator.vue)
| Data attribute | Value |
| --- | --- |
| `[data-state]` | "checked" \\| "unchecked" \\| "indeterminate" |
| `[data-disabled]` | Present when disabled |
### Group Root
Wrapper around `CheckboxRoot` to support array of `modelValue`
**Props**
| Prop | Default | Type | Description |
| --- | --- | --- | --- |
| `as` | `"div"` | `AsTag \| Component` | The element or component this component should render as. Can be overwritten by `asChild`. |
| `asChild` | | `boolean` | Change the default rendered element for the one passed as a child, merging their props and behavior.
Read our [Composition](https://vinicunca.dev/akar/guides/composition) guide for more details. |
| `defaultValue` | | `T[]` | The value of the checkbox when it is initially rendered. Use when you do not need to control its value. |
| `dir` | | `"ltr" \| "rtl"` | The direction of navigation between items. |
| `disabled` | | `boolean` | When `true`, prevents the user from interacting with the checkboxes |
| `loop` | `false` | `boolean` | Whether keyboard navigation should loop around |
| `max` | | `number \| null` | The maximum number of values that can be selected. Once reached, the unchecked
checkboxes get `aria-disabled` but stay focusable, so consider telling users
about the limit. Style them with `[aria-disabled="true"]`. |
| `modelValue` | | `T[]` | The controlled value of the checkbox. Can be binded with v-model. |
| `name` | | `string` | The name of the field. Submitted with its owning form as part of a name/value pair. |
| `orientation` | | `"vertical" \| "horizontal"` | The orientation of the group.
Mainly so arrow navigation is done accordingly (left & right vs. up & down) |
| `required` | | `boolean` | When `true`, indicates that the user must set the value before the owning form can be submitted. |
| `rovingFocus` | `true` | `boolean` | When `false`, navigating through the items using arrow keys will be disabled. |
**Events**
| Event | Payload | Description |
| --- | --- | --- |
| `update:modelValue` | `value: T[]` | Event handler called when the value of the checkbox changes. |
[CheckboxGroupRoot.vue source](https://github.com/vinicunca/akar/blob/v2.0.20/packages/core/src/Checkbox/CheckboxGroupRoot.vue)
## Examples
### Custom Values
Use the `trueValue` and `falseValue` props to specify custom values for the checked and unchecked states instead of the default `true`/`false`.
```vue
Read our [Composition](https://vinicunca.dev/akar/guides/composition) guide for more details. |
| `defaultOpen` | `false` | `boolean` | The open state of the collapsible when it is initially rendered.
Use when you do not need to control its open state. |
| `disabled` | | `boolean` | When `true`, prevents the user from interacting with the collapsible. |
| `open` | | `boolean` | The controlled open state of the collapsible. Can be binded with `v-model`. |
| `unmountOnHide` | `true` | `boolean` | When `true`, the element will be unmounted on closed state. |
**Events**
| Event | Payload | Description |
| --- | --- | --- |
| `update:open` | `value: boolean` | Event handler called when the open state of the collapsible changes. |
**Slots**
| Slot | Payload | Description |
| --- | --- | --- |
| `open` | `boolean` | Current open state |
[CollapsibleRoot.vue source](https://github.com/vinicunca/akar/blob/v2.0.20/packages/core/src/Collapsible/CollapsibleRoot.vue)
| Data attribute | Value |
| --- | --- |
| `[data-state]` | "open" \\| "closed" |
| `[data-disabled]` | Present when disabled |
### Trigger
The button that toggles the collapsible
**Props**
| Prop | Default | Type | Description |
| --- | --- | --- | --- |
| `as` | `"button"` | `AsTag \| Component` | The element or component this component should render as. Can be overwritten by `asChild`. |
| `asChild` | | `boolean` | Change the default rendered element for the one passed as a child, merging their props and behavior.
Read our [Composition](https://vinicunca.dev/akar/guides/composition) guide for more details. |
[CollapsibleTrigger.vue source](https://github.com/vinicunca/akar/blob/v2.0.20/packages/core/src/Collapsible/CollapsibleTrigger.vue)
| Data attribute | Value |
| --- | --- |
| `[data-state]` | "open" \\| "closed" |
| `[data-disabled]` | Present when disabled |
### Content
The component that contains the collapsible content.
> [!NOTE]
>
> Defer mounting with `forceMount` / [`Presence`](https://vinicunca.dev/akar/utilities/presence). See the [animation guide](https://vinicunca.dev/akar/guides/animation).
**Props**
| Prop | Default | Type | Description |
| --- | --- | --- | --- |
| `as` | `"div"` | `AsTag \| Component` | The element or component this component should render as. Can be overwritten by `asChild`. |
| `asChild` | | `boolean` | Change the default rendered element for the one passed as a child, merging their props and behavior.
Read our [Composition](https://vinicunca.dev/akar/guides/composition) guide for more details. |
| `forceMount` | | `boolean` | Used to force mounting when more control is needed. Useful when
controlling animation with Vue animation libraries. |
**Events**
| Event | Payload | Description |
| --- | --- | --- |
| `contentFound` | `(void)?` | |
[CollapsibleContent.vue source](https://github.com/vinicunca/akar/blob/v2.0.20/packages/core/src/Collapsible/CollapsibleContent.vue)
| Data attribute | Value |
| --- | --- |
| `[data-state]` | "open" \\| "closed" |
| `[data-disabled]` | Present when disabled |
| CSS variable | Description |
| --- | --- |
| `--akar-collapsible-content-width` | The width of the content when it opens/closes |
| `--akar-collapsible-content-height` | The height of the content when it opens/closes |
## Examples
### Animating content size
Use the `--akar-collapsible-content-width` and/or `--akar-collapsible-content-height` CSS variables to animate the size of the content when it opens/closes. Here's a demo:
```vue
// index.vue
Read our [Composition](/akar/guides/composition) guide for more details. |
| `colorSpace` | `"hsl"` | `"hsl" \| "rgb" \| "hsb"` | The color space to operate in. |
| `defaultValue` | `"#ff0000"` | `string \| Color` | The default color value (uncontrolled). |
| `disabled` | `false` | `boolean` | When `true`, prevents the user from interacting with the area. |
| `modelValue` | | `string \| Color` | The color value (controlled). Can be a hex string or Color object. |
| `name` | | `string` | The name of the field. Submitted with its owning form as part of a name/value pair. |
| `required` | | `boolean` | When `true`, indicates that the user must set the value before the owning form can be submitted. |
| `xChannel` | `"hue"` | `"hue" \| "saturation" \| "red" \| "green" \| "blue" \| "alpha" \| "lightness" \| "brightness"` | Color channel for the horizontal (x) axis. |
| `xName` | | `string` | The name of the x channel input element for form submission. |
| `yChannel` | `"saturation"` | `"hue" \| "saturation" \| "red" \| "green" \| "blue" \| "alpha" \| "lightness" \| "brightness"` | Color channel for the vertical (y) axis. |
| `yName` | | `string` | The name of the y channel input element for form submission. |
**Events**
| Event | Payload | Description |
| --- | --- | --- |
| `change` | `value: string` | |
| `changeEnd` | `value: string` | |
| `update:color` | `value: Color` | |
| `update:modelValue` | `value: string` | |
**Slots**
| Slot | Payload | Description |
| --- | --- | --- |
| `style` | `CSSProperties` | CSS styles for the color area background gradient |
[ColorAreaRoot.vue source](https://github.com/vinicunca/akar/blob/v2.0.20/packages/core/src/ColorArea/ColorAreaRoot.vue)
### ColorAreaArea
The interactive area component where users can select color values by clicking or dragging.
**Props**
| Prop | Default | Type | Description |
| --- | --- | --- | --- |
| `as` | `"div"` | `AsTag \| Component` | The element or component this component should render as. Can be overwritten by `asChild`. |
| `asChild` | | `boolean` | Change the default rendered element for the one passed as a child, merging their props and behavior.
Read our [Composition](/akar/guides/composition) guide for more details. |
[ColorAreaArea.vue source](https://github.com/vinicunca/akar/blob/v2.0.20/packages/core/src/ColorArea/ColorAreaArea.vue)
### ColorAreaThumb
The draggable thumb component that indicates the current position in the color area.
**Props**
| Prop | Default | Type | Description |
| --- | --- | --- | --- |
| `as` | `"span"` | `AsTag \| Component` | The element or component this component should render as. Can be overwritten by `asChild`. |
| `asChild` | | `boolean` | Change the default rendered element for the one passed as a child, merging their props and behavior.
Read our [Composition](/akar/guides/composition) guide for more details. |
[ColorAreaThumb.vue source](https://github.com/vinicunca/akar/blob/v2.0.20/packages/core/src/ColorArea/ColorAreaThumb.vue)
## Examples
### HSL Saturation/Lightness
A common use case for color area is selecting saturation and lightness in HSL color space.
```vue
Read our [Composition](/akar/guides/composition) guide for more details. |
| `channel` | | `"hue" \| "saturation" \| "red" \| "green" \| "blue" \| "alpha" \| "lightness" \| "brightness"` | The color channel to display. If not provided, displays hex value. |
| `colorSpace` | `"hsl"` | `"hsl" \| "rgb" \| "hsb"` | The color space to operate in when displaying a channel. |
| `defaultValue` | `"#000000"` | `string \| Color` | The default color value (uncontrolled). |
| `disabled` | `false` | `boolean` | When `true`, prevents the user from interacting with the field. |
| `disableWheelChange` | `false` | `boolean` | When `true`, prevents the value from changing on wheel scroll. |
| `locale` | | `string` | The locale to use for number formatting. |
| `modelValue` | | `string \| Color` | The color value (controlled). Can be a hex string or Color object. |
| `name` | | `string` | The name of the field. Submitted with its owning form as part of a name/value pair. |
| `placeholder` | | `string` | Placeholder text when the field is empty. |
| `readonly` | `false` | `boolean` | When `true`, the field is read-only. |
| `required` | | `boolean` | When `true`, indicates that the user must set the value before the owning form can be submitted. |
| `step` | | `number` | Custom step value for increment/decrement. Defaults to channel step or 1 for hex. |
**Events**
| Event | Payload | Description |
| --- | --- | --- |
| `update:color` | `value: Color` | |
| `update:modelValue` | `value: string` | |
[ColorFieldRoot.vue source](https://github.com/vinicunca/akar/blob/v2.0.20/packages/core/src/ColorField/ColorFieldRoot.vue)
### ColorFieldInput
The input element for entering color values.
**Props**
| Prop | Default | Type | Description |
| --- | --- | --- | --- |
| `as` | `"input"` | `AsTag \| Component` | The element or component this component should render as. Can be overwritten by `asChild`. |
| `asChild` | | `boolean` | Change the default rendered element for the one passed as a child, merging their props and behavior.
Read our [Composition](/akar/guides/composition) guide for more details. |
[ColorFieldInput.vue source](https://github.com/vinicunca/akar/blob/v2.0.20/packages/core/src/ColorField/ColorFieldInput.vue)
## Examples
### Hex Color Input
Basic hex color input field.
```vue
Read our [Composition](/akar/guides/composition) guide for more details. |
| `channel*` | | `"hue" \| "saturation" \| "red" \| "green" \| "blue" \| "alpha" \| "lightness" \| "brightness"` | The color channel that this slider manipulates. |
| `colorSpace` | `"hsl"` | `"hsl" \| "rgb" \| "hsb"` | The color space to operate in. |
| `defaultValue` | `"#000000"` | `string \| Color` | The default color value (uncontrolled). |
| `dir` | | `"ltr" \| "rtl"` | The reading direction of the slider. |
| `disabled` | `false` | `boolean` | When `true`, prevents the user from interacting with the slider. |
| `inverted` | `false` | `boolean` | Whether the slider is visually inverted. |
| `modelValue` | | `string \| Color` | The color value (controlled). Can be a hex string or Color object. |
| `name` | | `string` | The name of the field. Submitted with its owning form as part of a name/value pair. |
| `orientation` | `"horizontal"` | `"vertical" \| "horizontal"` | The orientation of the slider. |
| `required` | | `boolean` | When `true`, indicates that the user must set the value before the owning form can be submitted. |
| `step` | | `number` | Custom step value for increment/decrement. Defaults to the channel's natural step. |
**Events**
| Event | Payload | Description |
| --- | --- | --- |
| `change` | `value: string` | |
| `changeEnd` | `value: string` | |
| `update:color` | `value: Color` | |
| `update:modelValue` | `value: string \| Color` | |
[ColorSliderRoot.vue source](https://github.com/vinicunca/akar/blob/v2.0.20/packages/core/src/ColorSlider/ColorSliderRoot.vue)
### ColorSliderTrack
The track component that displays the color gradient background.
**Props**
| Prop | Default | Type | Description |
| --- | --- | --- | --- |
| `as` | `"span"` | `AsTag \| Component` | The element or component this component should render as. Can be overwritten by `asChild`. |
| `asChild` | | `boolean` | Change the default rendered element for the one passed as a child, merging their props and behavior.
Read our [Composition](/akar/guides/composition) guide for more details. |
[ColorSliderTrack.vue source](https://github.com/vinicunca/akar/blob/v2.0.20/packages/core/src/ColorSlider/ColorSliderTrack.vue)
### ColorSliderThumb
The draggable thumb component for selecting values.
**Props**
| Prop | Default | Type | Description |
| --- | --- | --- | --- |
| `as` | `"span"` | `AsTag \| Component` | The element or component this component should render as. Can be overwritten by `asChild`. |
| `asChild` | | `boolean` | Change the default rendered element for the one passed as a child, merging their props and behavior.
Read our [Composition](/akar/guides/composition) guide for more details. |
**Slots**
| Slot | Payload | Description |
| --- | --- | --- |
| `channelName` | `string` | The display name of the current channel |
| `channelValue` | `number` | The current numeric value of the channel |
[ColorSliderThumb.vue source](https://github.com/vinicunca/akar/blob/v2.0.20/packages/core/src/ColorSlider/ColorSliderThumb.vue)
## Examples
### Hue Slider
A horizontal hue slider in HSL color space.
```vue
Read our [Composition](/akar/guides/composition) guide for more details. |
| `color` | `""` | `string \| Color` | The color to display in the swatch as a hex string or Color object.
Example: `#16a372`, `#ff5733`, or `{ space: 'hsl', h: 120, s: 100, l: 50, alpha: 1 }`. |
| `label` | | `string` | Optional accessible label for the color. If omitted, the color name will be derived from the color value. |
**Slots**
| Slot | Payload | Description |
| --- | --- | --- |
| `color` | `string` | |
| `alpha` | `number` | |
[ColorSwatch.vue source](https://github.com/vinicunca/akar/blob/v2.0.20/packages/core/src/ColorSwatch/ColorSwatch.vue)
---
- [GitHub](https://github.com/vinicunca/akar/blob/v2.0.20/packages/core/src/ColorSwatch)
- [npm](https://www.npmjs.com/package/akar)
# Color Swatch Picker
> A component that allows users to select from a set of predefined colors, often used for themes or branding.
`````vue [index.vue]
Read our [Composition](/akar/guides/composition) guide for more details. |
| `defaultValue` | | `string \| string[]` | The value of the listbox when initially rendered. Use when you do not need to control the state of the Listbox |
| `dir` | `"ltr"` | `"ltr" \| "rtl"` | The reading direction of the listbox when applicable.
If omitted, inherits globally from `ConfigProvider` or assumes LTR (left-to-right) reading mode. |
| `disabled` | `false` | `boolean` | When `true`, prevents the user from interacting with listbox |
| `highlightOnHover` | | `boolean` | When `true`, hover over item will trigger highlight |
| `modelValue` | | `string \| string[]` | The controlled value of the listbox. Can be binded with `v-model`. |
| `multiple` | | `boolean` | Whether multiple options can be selected or not. |
| `name` | | `string` | The name of the field. Submitted with its owning form as part of a name/value pair. |
| `orientation` | `"horizontal"` | `"vertical" \| "horizontal"` | The orientation of the listbox.
Mainly so arrow navigation is done accordingly (left & right vs. up & down) |
| `required` | | `boolean` | When `true`, indicates that the user must set the value before the owning form can be submitted. |
| `selectionBehavior` | `'toggle'` | `"replace" \| "toggle"` | How multiple selection should behave in the collection. |
**Events**
| Event | Payload | Description |
| --- | --- | --- |
| `entryFocus` | `event: CustomEvent
Read our [Composition](/akar/guides/composition) guide for more details. |
| `disabled` | | `boolean` | When `true`, prevents the user from interacting with the item. |
| `value*` | | `string` | The color to display in the swatch as a hex string.
Example: `#16a372` or `#ff5733`. |
**Events**
| Event | Payload | Description |
| --- | --- | --- |
| `select` | `event: SelectEvent
It can be prevented by calling `event.preventDefault`. |
**Slots**
| Slot | Payload | Description |
| --- | --- | --- |
| `selected` | `boolean` | Whether the item is currently selected |
[ColorSwatchPickerItem.vue source](https://github.com/vinicunca/akar/blob/v2.0.20/packages/core/src/ColorSwatchPicker/ColorSwatchPickerItem.vue)
### ColorSwatchPickerItemSwatch
The component that displays the color swatch within an item.
**Props**
| Prop | Default | Type | Description |
| --- | --- | --- | --- |
| `as` | `"div"` | `AsTag \| Component` | The element or component this component should render as. Can be overwritten by `asChild`. |
| `asChild` | | `boolean` | Change the default rendered element for the one passed as a child, merging their props and behavior.
Read our [Composition](/akar/guides/composition) guide for more details. |
| `label` | | `string` | Optional accessible label for the color. If omitted, the color name will be derived from the color value. |
[ColorSwatchPickerItemSwatch.vue source](https://github.com/vinicunca/akar/blob/v2.0.20/packages/core/src/ColorSwatchPicker/ColorSwatchPickerItemSwatch.vue)
### ColorSwatchPickerItemIndicator
The component that indicates the selected color swatch within an item.
**Props**
| Prop | Default | Type | Description |
| --- | --- | --- | --- |
| `as` | `"div"` | `AsTag \| Component` | The element or component this component should render as. Can be overwritten by `asChild`. |
| `asChild` | | `boolean` | Change the default rendered element for the one passed as a child, merging their props and behavior.
Read our [Composition](/akar/guides/composition) guide for more details. |
| `forceMount` | | `boolean` | Used to force mounting when more control is needed. Useful when
controlling animation with Vue animation libraries. |
[ColorSwatchPickerItemIndicator.vue source](https://github.com/vinicunca/akar/blob/v2.0.20/packages/core/src/ColorSwatchPicker/ColorSwatchPickerItemIndicator.vue)
---
- [GitHub](https://github.com/vinicunca/akar/blob/v2.0.20/packages/core/src/ColorSwatchPicker)
- [npm](https://www.npmjs.com/package/akar)
# Combobox
> Choose from a list of suggested values with full keyboard support.
```vue [index.vue]
Read our [Composition](https://vinicunca.dev/akar/guides/composition) guide for more details. |
| `by` | | `string \| ((a: T, b: T) => boolean)` | Use this to compare objects by a particular field, or pass your own comparison function for complete control over how objects are compared. |
| `defaultOpen` | | `boolean` | The open state of the combobox when it is initially rendered.
Use when you do not need to control its open state. |
| `defaultValue` | | `T \| T[]` | The value of the listbox when initially rendered. Use when you do not need to control the state of the Listbox |
| `dir` | | `"ltr" \| "rtl"` | The reading direction of the listbox when applicable.
If omitted, inherits globally from `ConfigProvider` or assumes LTR (left-to-right) reading mode. |
| `disabled` | | `boolean` | When `true`, prevents the user from interacting with listbox |
| `highlightOnHover` | `true` | `boolean` | When `true`, hover over item will trigger highlight |
| `ignoreFilter` | | `boolean` | When `true`, disable the default filters |
| `modelValue` | | `T \| T[]` | The controlled value of the listbox. Can be binded with `v-model`. |
| `multiple` | | `boolean` | Whether multiple options can be selected or not. |
| `name` | | `string` | The name of the field. Submitted with its owning form as part of a name/value pair. |
| `open` | | `boolean` | The controlled open state of the Combobox. Can be binded with `v-model:open`. |
| `openOnClick` | `false` | `boolean` | Whether to open the combobox when the input is clicked |
| `openOnFocus` | `false` | `boolean` | Whether to open the combobox when the input is focused |
| `required` | | `boolean` | When `true`, indicates that the user must set the value before the owning form can be submitted. |
| `resetModelValueOnClear` | `false` | `boolean` | When `true` the `modelValue` will be reset to `null` (or `[]` if `multiple`) |
| `resetSearchTermOnBlur` | `true` | `boolean` | Whether to reset the searchTerm when the Combobox input blurred |
| `resetSearchTermOnSelect` | `true` | `boolean` | Whether to reset the searchTerm when the Combobox value is selected |
| `unmountOnHide` | `true` | `boolean` | When set to `false`, the Combobox content will not be unmounted when closed, but instead hidden with CSS.
Useful when you want to improve performance by not remounting the content on every open. |
**Events**
| Event | Payload | Description |
| --- | --- | --- |
| `highlight` | `payload: { ref: HTMLElement; value: T; }` | Event handler when highlighted element changes. |
| `update:modelValue` | `value: T` | Event handler called when the value changes. |
| `update:open` | `value: boolean` | Event handler called when the open state of the combobox changes. |
**Slots**
| Slot | Payload | Description |
| --- | --- | --- |
| `open` | `boolean` | Current open state |
| `modelValue` | `T \| T[]` | Current active value |
[ComboboxRoot.vue source](https://github.com/vinicunca/akar/blob/v2.0.20/packages/core/src/Combobox/ComboboxRoot.vue)
### Anchor
Used as an anchor if you set `ComboboxContent`'s position to `popper`.
**Props**
| Prop | Default | Type | Description |
| --- | --- | --- | --- |
| `as` | `"div"` | `AsTag \| Component` | The element or component this component should render as. Can be overwritten by `asChild`. |
| `asChild` | | `boolean` | Change the default rendered element for the one passed as a child, merging their props and behavior.
Read our [Composition](https://vinicunca.dev/akar/guides/composition) guide for more details. |
| `reference` | | `ReferenceElement` | The reference (or anchor) element that is being referred to for positioning.
If not provided will use the current component as anchor. |
[ComboboxAnchor.vue source](https://github.com/vinicunca/akar/blob/v2.0.20/packages/core/src/Combobox/ComboboxAnchor.vue)
### Input
The input component to search through the combobox items.
**Props**
| Prop | Default | Type | Description |
| --- | --- | --- | --- |
| `as` | `"input"` | `AsTag \| Component` | The element or component this component should render as. Can be overwritten by `asChild`. |
| `asChild` | | `boolean` | Change the default rendered element for the one passed as a child, merging their props and behavior.
Read our [Composition](https://vinicunca.dev/akar/guides/composition) guide for more details. |
| `autoFocus` | | `boolean` | Focus on element when mounted. |
| `disabled` | | `boolean` | When `true`, prevents the user from interacting with item |
| `displayValue` | | `((val: any) => string)` | The display value of input for selected item. Does not work with `multiple`. |
| `modelValue` | | `string` | The controlled value of the filter. Can be binded with v-model. |
**Events**
| Event | Payload | Description |
| --- | --- | --- |
| `update:modelValue` | `string` | |
[ComboboxInput.vue source](https://github.com/vinicunca/akar/blob/v2.0.20/packages/core/src/Combobox/ComboboxInput.vue)
### Trigger
The button that toggles the Combobox Content.
**Props**
| Prop | Default | Type | Description |
| --- | --- | --- | --- |
| `as` | `"button"` | `AsTag \| Component` | The element or component this component should render as. Can be overwritten by `asChild`. |
| `asChild` | | `boolean` | Change the default rendered element for the one passed as a child, merging their props and behavior.
Read our [Composition](https://vinicunca.dev/akar/guides/composition) guide for more details. |
| `disabled` | | `boolean` | When `true`, prevents the user from interacting with item |
[ComboboxTrigger.vue source](https://github.com/vinicunca/akar/blob/v2.0.20/packages/core/src/Combobox/ComboboxTrigger.vue)
| Data attribute | Value |
| --- | --- |
| `[data-state]` | "open" \\| "closed" |
| `[data-disabled]` | Present when disabled |
### Cancel
The button that clears the search term.
**Props**
| Prop | Default | Type | Description |
| --- | --- | --- | --- |
| `as` | `"button"` | `AsTag \| Component` | The element or component this component should render as. Can be overwritten by `asChild`. |
| `asChild` | | `boolean` | Change the default rendered element for the one passed as a child, merging their props and behavior.
Read our [Composition](https://vinicunca.dev/akar/guides/composition) guide for more details. |
[ComboboxCancel.vue source](https://github.com/vinicunca/akar/blob/v2.0.20/packages/core/src/Combobox/ComboboxCancel.vue)
### Empty
Shown when none of the items match the query.
**Props**
| Prop | Default | Type | Description |
| --- | --- | --- | --- |
| `as` | `"div"` | `AsTag \| Component` | The element or component this component should render as. Can be overwritten by `asChild`. |
| `asChild` | | `boolean` | Change the default rendered element for the one passed as a child, merging their props and behavior.
Read our [Composition](https://vinicunca.dev/akar/guides/composition) guide for more details. |
[ComboboxEmpty.vue source](https://github.com/vinicunca/akar/blob/v2.0.20/packages/core/src/Combobox/ComboboxEmpty.vue)
### Portal
When used, portals the content part into the `body`.
You need to set `position="popper"` for `ComboboxContent` to make sure the position was automatically computed similar to `Popover` or `DropdownMenu`.
**Props**
| Prop | Default | Type | Description |
| --- | --- | --- | --- |
| `defer` | | `boolean` | Defer the resolving of a Teleport target until other parts of the
application have mounted (requires Vue 3.5.0+)
[reference](https://vuejs.org/guide/built-ins/teleport.html#deferred-teleport) |
| `disabled` | | `boolean` | Disable teleport and render the component inline
[reference](https://vuejs.org/guide/built-ins/teleport.html#disabling-teleport) |
| `forceMount` | | `boolean` | Used to force mounting when more control is needed. Useful when
controlling animation with Vue animation libraries. |
| `to` | | `string \| HTMLElement` | Vue native teleport component prop `:to`
[reference](https://vuejs.org/guide/built-ins/teleport.html#basic-usage) |
[ComboboxPortal.vue source](https://github.com/vinicunca/akar/blob/v2.0.20/packages/core/src/Combobox/ComboboxPortal.vue)
### Content
The component that pops out when the combobox is open.
> [!NOTE]
>
> Defer mounting with `forceMount` / [`Presence`](https://vinicunca.dev/akar/utilities/presence). See the [animation guide](https://vinicunca.dev/akar/guides/animation).
**Props**
| Prop | Default | Type | Description |
| --- | --- | --- | --- |
| `align` | `"center"` | `"start" \| "center" \| "end"` | The preferred alignment against the trigger.
May change when collisions occur. |
| `alignFlip` | `true` | `boolean` | Flip alignment when colliding with boundary.
May only occur when `prioritizePosition` is true. |
| `alignOffset` | `0` | `number` | An offset in pixels from the `start` or `end` alignment options. |
| `arrowPadding` | `0` | `number` | The padding between the arrow and the edges of the content.
If your content has border-radius, this will prevent it from
overflowing the corners. |
| `as` | `"div"` | `AsTag \| Component` | The element or component this component should render as. Can be overwritten by `asChild`. |
| `asChild` | | `boolean` | Change the default rendered element for the one passed as a child, merging their props and behavior.
Read our [Composition](https://vinicunca.dev/akar/guides/composition) guide for more details. |
| `avoidCollisions` | `true` | `boolean` | When `true`, overrides the side and align preferences
to prevent collisions with boundary edges. |
| `bodyLock` | | `boolean` | The document.body will be lock, and scrolling will be disabled. |
| `collisionBoundary` | `[]` | `Element \| (Element \| null)[] \| null` | The element used as the collision boundary. By default
this is the viewport, though you can provide additional
element(s) to be included in this check. |
| `collisionPadding` | `0` | `number \| Partial
detection should occur. Accepts a number (same for all sides),
or a partial padding object, for example: { top: 20, left: 20 }. |
| `dir` | | `"ltr" \| "rtl"` | The reading direction of the popper content when applicable.
If omitted, inherits globally from `ConfigProvider` or assumes LTR (left-to-right) reading mode. |
| `disableOutsidePointerEvents` | | `boolean` | When `true`, hover/focus/click interactions will be disabled on elements outside
the `DismissableLayer`. Users will need to click twice on outside elements to
interact with them: once to close the `DismissableLayer`, and again to trigger the element. |
| `disableUpdateOnLayoutShift` | `false` | `boolean` | Whether to disable the update position for the content when the layout shifted. |
| `forceMount` | | `boolean` | Used to force mounting when more control is needed. Useful when
controlling animation with Vue animation libraries. |
| `hideShiftedArrow` | `true` | `boolean` | When `true`, hides the arrow when it cannot be centered
to the reference element. |
| `hideWhenDetached` | `false` | `boolean` | Whether to hide the content when the trigger becomes fully occluded. |
| `hideWhenEmpty` | `false` | `boolean` | When `true`, hides the content when there are no items matching the filter. |
| `memoDependencies` | | `unknown[]` | Reactive dependencies that should invalidate the memoized content subtree. |
| `position` | | `"inline" \| "popper"` | The positioning mode to use,
`inline` is the default and you can control the position using CSS.
`popper` positions content in the same way as our other primitives, for example `Popover` or `DropdownMenu`. |
| `positionStrategy` | | `"fixed" \| "absolute"` | The type of CSS position property to use. |
| `present` | | `boolean` | Whether this kept-mounted content is currently visible. |
| `prioritizePosition` | `false` | `boolean` | Force content to be position within the viewport.
Might overlap the reference element, which may not be desired. |
| `reference` | | `ReferenceElement` | The custom element or virtual element that will be set as the reference
to position the floating element.
If provided, it will replace the default anchor element. |
| `side` | `"bottom"` | `"top" \| "right" \| "bottom" \| "left"` | The preferred side of the trigger to render against when open.
Will be reversed when collisions occur and avoidCollisions
is enabled. |
| `sideFlip` | `true` | `boolean` | Flip to the opposite side when colliding with boundary. |
| `sideOffset` | `0` | `number` | The distance in pixels from the trigger. |
| `sticky` | `"partial"` | `"partial" \| "always"` | The sticky behavior on the align axis. `partial` will keep the
content in the boundary as long as the trigger is at least partially
in the boundary whilst "always" will keep the content in the boundary
regardless. |
| `updatePositionStrategy` | `'optimized'` | `"always" \| "optimized"` | Strategy to update the position of the floating element on every animation frame. |
**Events**
| Event | Payload | Description |
| --- | --- | --- |
| `escapeKeyDown` | `event: KeyboardEvent` | Event handler called when the escape key is down.
Can be prevented. |
| `focusOutside` | `event: FocusOutsideEvent` | Event handler called when the focus moves outside of the `DismissableLayer`.
Can be prevented. |
| `interactOutside` | `event: PointerDownOutsideEvent \| FocusOutsideEvent` | Event handler called when an interaction happens outside the `DismissableLayer`.
Specifically, when a `pointerdown` event happens outside or focus moves outside of it.
Can be prevented. |
| `pointerDownOutside` | `event: PointerDownOutsideEvent` | Event handler called when a `pointerdown` event happens outside of the `DismissableLayer`.
Can be prevented. |
[ComboboxContent.vue source](https://github.com/vinicunca/akar/blob/v2.0.20/packages/core/src/Combobox/ComboboxContent.vue)
| Data attribute | Value |
| --- | --- |
| `[data-state]` | "open" \\| "closed" |
| `[data-side]` | "left" \\| "right" \\| "bottom" \\| "top" |
| `[data-align]` | "start" \\| "end" \\| "center" |
| `[data-empty]` | Present when there are no items matching the filter |
| CSS variable | Description |
| --- | --- |
| `--akar-combobox-content-transform-origin` | The `transform-origin` computed from the content and arrow positions/offsets. Only present when `position="popper"`. |
| `--akar-combobox-content-available-width` | The remaining width between the trigger and the boundary edge. Only present when `position="popper"`. |
| `--akar-combobox-content-available-height` | The remaining height between the trigger and the boundary edge. Only present when `position="popper"`. |
| `--akar-combobox-trigger-width` | The width of the trigger. Only present when `position="popper"`. |
| `--akar-combobox-trigger-height` | The height of the trigger. Only present when `position="popper"`. |
### Viewport
The scrolling viewport that contains all of the items.
**Props**
| Prop | Default | Type | Description |
| --- | --- | --- | --- |
| `as` | `"div"` | `AsTag \| Component` | The element or component this component should render as. Can be overwritten by `asChild`. |
| `asChild` | | `boolean` | Change the default rendered element for the one passed as a child, merging their props and behavior.
Read our [Composition](https://vinicunca.dev/akar/guides/composition) guide for more details. |
| `nonce` | | `string` | Will add `nonce` attribute to the style tag which can be used by Content Security Policy.
If omitted, inherits globally from `ConfigProvider`. |
[ComboboxViewport.vue source](https://github.com/vinicunca/akar/blob/v2.0.20/packages/core/src/Combobox/ComboboxViewport.vue)
### Item
The component that contains the combobox items.
**Props**
| Prop | Default | Type | Description |
| --- | --- | --- | --- |
| `as` | `"div"` | `AsTag \| Component` | The element or component this component should render as. Can be overwritten by `asChild`. |
| `asChild` | | `boolean` | Change the default rendered element for the one passed as a child, merging their props and behavior.
Read our [Composition](https://vinicunca.dev/akar/guides/composition) guide for more details. |
| `disabled` | | `boolean` | When `true`, prevents the user from interacting with the item. |
| `textValue` | | `string` | A string representation of the item contents.
If the children are not plain text, then the `textValue` prop must also be set to a plain text representation, which will be used for autocomplete in the ComboBox. |
| `value*` | | `T` | The value given as data when submitted with a `name`. |
**Events**
| Event | Payload | Description |
| --- | --- | --- |
| `select` | `event: SelectEvent
It can be prevented by calling `event.preventDefault`. |
**Slots**
| Slot | Payload | Description |
| --- | --- | --- |
| `selected` | `boolean` | Whether the item is currently selected |
[ComboboxItem.vue source](https://github.com/vinicunca/akar/blob/v2.0.20/packages/core/src/Combobox/ComboboxItem.vue)
| Data attribute | Value |
| --- | --- |
| `[data-state]` | "checked" \\| "unchecked" |
| `[data-highlighted]` | Present when highlighted |
| `[data-disabled]` | Present when disabled |
### ItemIndicator
Renders when the item is selected. You can style this element directly, or you can use it as a wrapper to put an icon into, or both.
**Props**
| Prop | Default | Type | Description |
| --- | --- | --- | --- |
| `as` | `"span"` | `AsTag \| Component` | The element or component this component should render as. Can be overwritten by `asChild`. |
| `asChild` | | `boolean` | Change the default rendered element for the one passed as a child, merging their props and behavior.
Read our [Composition](https://vinicunca.dev/akar/guides/composition) guide for more details. |
| `forceMount` | | `boolean` | Used to force mounting when more control is needed. Useful when
controlling animation with Vue animation libraries. |
[ComboboxItemIndicator.vue source](https://github.com/vinicunca/akar/blob/v2.0.20/packages/core/src/Combobox/ComboboxItemIndicator.vue)
### Group
Used to group multiple items. use in conjunction with `ComboboxLabel` to ensure good accessibility via automatic labelling.
**Props**
| Prop | Default | Type | Description |
| --- | --- | --- | --- |
| `as` | `"div"` | `AsTag \| Component` | The element or component this component should render as. Can be overwritten by `asChild`. |
| `asChild` | | `boolean` | Change the default rendered element for the one passed as a child, merging their props and behavior.
Read our [Composition](https://vinicunca.dev/akar/guides/composition) guide for more details. |
[ComboboxGroup.vue source](https://github.com/vinicunca/akar/blob/v2.0.20/packages/core/src/Combobox/ComboboxGroup.vue)
### Label
Used to render the label of a group. It won't be focusable using arrow keys.
**Props**
| Prop | Default | Type | Description |
| --- | --- | --- | --- |
| `as` | `"div"` | `AsTag \| Component` | The element or component this component should render as. Can be overwritten by `asChild`. |
| `asChild` | | `boolean` | Change the default rendered element for the one passed as a child, merging their props and behavior.
Read our [Composition](https://vinicunca.dev/akar/guides/composition) guide for more details. |
| `for` | | `string` | |
[ComboboxLabel.vue source](https://github.com/vinicunca/akar/blob/v2.0.20/packages/core/src/Combobox/ComboboxLabel.vue)
### Separator
Used to visually separate items in the Combobox
**Props**
| Prop | Default | Type | Description |
| --- | --- | --- | --- |
| `as` | `"div"` | `AsTag \| Component` | The element or component this component should render as. Can be overwritten by `asChild`. |
| `asChild` | | `boolean` | Change the default rendered element for the one passed as a child, merging their props and behavior.
Read our [Composition](https://vinicunca.dev/akar/guides/composition) guide for more details. |
[ComboboxSeparator.vue source](https://github.com/vinicunca/akar/blob/v2.0.20/packages/core/src/Combobox/ComboboxSeparator.vue)
### Arrow
An optional arrow element to render alongside the content. This can be used to help visually link the trigger with the `ComboboxContent`. Must be rendered inside `ComboboxContent`. Only available when `position` is set to `popper`.
**Props**
| Prop | Default | Type | Description |
| --- | --- | --- | --- |
| `as` | `"svg"` | `AsTag \| Component` | The element or component this component should render as. Can be overwritten by `asChild`. |
| `asChild` | | `boolean` | Change the default rendered element for the one passed as a child, merging their props and behavior.
Read our [Composition](https://vinicunca.dev/akar/guides/composition) guide for more details. |
| `height` | `5` | `number` | The height of the arrow in pixels. |
| `rounded` | `false` | `boolean` | When `true`, render the rounded version of arrow. Do not work with `as`/`asChild` |
| `width` | `10` | `number` | The width of the arrow in pixels. |
[ComboboxArrow.vue source](https://github.com/vinicunca/akar/blob/v2.0.20/packages/core/src/Combobox/ComboboxArrow.vue)
### Virtualizer
Virtual container to achieve list virtualization.
> [!WARNING]
>
> Combobox items **must** be filtered manually before passing them over to the virtualizer. See [example below](#virtualized-combobox-with-working-filtering).
See the [virtualization guide](https://vinicunca.dev/akar/guides/virtualization.md) for more general info on virtualization.
**Props**
| Prop | Default | Type | Description |
| --- | --- | --- | --- |
| `estimateSize` | | `number \| ((index: number) => number)` | Estimated size (in px) of each item |
| `options*` | | `T` | List of items |
| `overscan` | | `number` | Number of items rendered outside the visible area |
| `textContent` | | `((option: T) => string)` | Text content for each item to achieve type-ahead feature |
**Slots**
| Slot | Payload | Description |
| --- | --- | --- |
| `option` | `T` | |
| `virtualizer` | `Virtualizer
Adolfo Hess
If omitted, inherits globally from `ConfigProvider` or assumes LTR (left-to-right) reading mode. |
| `modal` | `true` | `boolean` | The modality of the dropdown menu.
When set to `true`, interaction with outside elements will be disabled and only menu content will be visible to screen readers. |
| `pressOpenDelay` | `700` | `number` | The duration from when the trigger is pressed until the menu opens. |
**Events**
| Event | Payload | Description |
| --- | --- | --- |
| `update:open` | `payload: boolean` | |
[ContextMenuRoot.vue source](https://github.com/vinicunca/akar/blob/v2.0.20/packages/core/src/ContextMenu/ContextMenuRoot.vue)
### Trigger
The area that opens the context menu. Wrap it around the target you want the context menu to open from when right-clicking (or using the relevant keyboard shortcuts).
**Props**
| Prop | Default | Type | Description |
| --- | --- | --- | --- |
| `as` | `"span"` | `AsTag \| Component` | The element or component this component should render as. Can be overwritten by `asChild`. |
| `asChild` | | `boolean` | Change the default rendered element for the one passed as a child, merging their props and behavior.
Read our [Composition](https://vinicunca.dev/akar/guides/composition) guide for more details. |
| `disabled` | `false` | `boolean` | When `true`, the context menu would not open when right-clicking.
Note that this will also restore the native context menu. |
[ContextMenuTrigger.vue source](https://github.com/vinicunca/akar/blob/v2.0.20/packages/core/src/ContextMenu/ContextMenuTrigger.vue)
| Data attribute | Value |
| --- | --- |
| `[data-state]` | "open" \\| "closed" |
### Portal
When used, portals the content part into the `body`.
**Props**
| Prop | Default | Type | Description |
| --- | --- | --- | --- |
| `defer` | | `boolean` | Defer the resolving of a Teleport target until other parts of the
application have mounted (requires Vue 3.5.0+)
[reference](https://vuejs.org/guide/built-ins/teleport.html#deferred-teleport) |
| `disabled` | | `boolean` | Disable teleport and render the component inline
[reference](https://vuejs.org/guide/built-ins/teleport.html#disabling-teleport) |
| `forceMount` | | `boolean` | Used to force mounting when more control is needed. Useful when
controlling animation with Vue animation libraries. |
| `to` | | `string \| HTMLElement` | Vue native teleport component prop `:to`
[reference](https://vuejs.org/guide/built-ins/teleport.html#basic-usage) |
[ContextMenuPortal.vue source](https://github.com/vinicunca/akar/blob/v2.0.20/packages/core/src/ContextMenu/ContextMenuPortal.vue)
### Content
The component that pops out in an open context menu.
**Props**
| Prop | Default | Type | Description |
| --- | --- | --- | --- |
| `alignFlip` | `true` | `boolean` | Flip alignment when colliding with boundary.
May only occur when `prioritizePosition` is true. |
| `alignOffset` | `0` | `number` | An offset in pixels from the `start` or `end` alignment options. |
| `as` | `"div"` | `AsTag \| Component` | The element or component this component should render as. Can be overwritten by `asChild`. |
| `asChild` | | `boolean` | Change the default rendered element for the one passed as a child, merging their props and behavior.
Read our [Composition](https://vinicunca.dev/akar/guides/composition) guide for more details. |
| `avoidCollisions` | `true` | `boolean` | When `true`, overrides the side and align preferences
to prevent collisions with boundary edges. |
| `collisionBoundary` | `[]` | `Element \| (Element \| null)[] \| null` | The element used as the collision boundary. By default
this is the viewport, though you can provide additional
element(s) to be included in this check. |
| `collisionPadding` | `0` | `number \| Partial
detection should occur. Accepts a number (same for all sides),
or a partial padding object, for example: { top: 20, left: 20 }. |
| `disableUpdateOnLayoutShift` | `false` | `boolean` | Whether to disable the update position for the content when the layout shifted. |
| `forceMount` | | `boolean` | Used to force mounting when more control is needed. Useful when
controlling animation with Vue animation libraries. |
| `hideShiftedArrow` | `true` | `boolean` | When `true`, hides the arrow when it cannot be centered
to the reference element. |
| `hideWhenDetached` | `false` | `boolean` | Whether to hide the content when the trigger becomes fully occluded. |
| `loop` | `false` | `boolean` | When `true`, keyboard navigation will loop from last item to first, and vice versa. |
| `memoDependencies` | | `unknown[]` | Reactive dependencies that should invalidate the memoized content subtree. |
| `positionStrategy` | | `"fixed" \| "absolute"` | The type of CSS position property to use. |
| `prioritizePosition` | `false` | `boolean` | Force content to be position within the viewport.
Might overlap the reference element, which may not be desired. |
| `reference` | | `ReferenceElement` | The custom element or virtual element that will be set as the reference
to position the floating element.
If provided, it will replace the default anchor element. |
| `sideFlip` | `true` | `boolean` | Flip to the opposite side when colliding with boundary. |
| `sticky` | `"partial"` | `"partial" \| "always"` | The sticky behavior on the align axis. `partial` will keep the
content in the boundary as long as the trigger is at least partially
in the boundary whilst "always" will keep the content in the boundary
regardless. |
**Events**
| Event | Payload | Description |
| --- | --- | --- |
| `closeAutoFocus` | `event: Event` | Event handler called when auto-focusing on close.
Can be prevented. |
| `escapeKeyDown` | `event: KeyboardEvent` | Event handler called when the escape key is down.
Can be prevented. |
| `focusOutside` | `event: FocusOutsideEvent` | Event handler called when the focus moves outside of the `DismissableLayer`.
Can be prevented. |
| `interactOutside` | `event: PointerDownOutsideEvent \| FocusOutsideEvent` | Event handler called when an interaction happens outside the `DismissableLayer`.
Specifically, when a `pointerdown` event happens outside or focus moves outside of it.
Can be prevented. |
| `openAutoFocus` | `event: Event` | |
| `pointerDownOutside` | `event: PointerDownOutsideEvent` | Event handler called when a `pointerdown` event happens outside of the `DismissableLayer`.
Can be prevented. |
[ContextMenuContent.vue source](https://github.com/vinicunca/akar/blob/v2.0.20/packages/core/src/ContextMenu/ContextMenuContent.vue)
| Data attribute | Value |
| --- | --- |
| `[data-state]` | "open" \\| "closed" |
| `[data-side]` | "left" \\| "right" \\| "bottom" \\| "top" |
| `[data-align]` | "start" \\| "end" \\| "center" |
| CSS variable | Description |
| --- | --- |
| `--akar-context-menu-content-transform-origin` | The `transform-origin` computed from the content and arrow positions/offsets |
| `--akar-context-menu-content-available-width` | The remaining width between the trigger and the boundary edge |
| `--akar-context-menu-content-available-height` | The remaining height between the trigger and the boundary edge |
| `--akar-context-menu-trigger-width` | The width of the trigger |
| `--akar-context-menu-trigger-height` | The height of the trigger |
### Arrow
An optional arrow element to render alongside a submenu. This can be used to help visually link the trigger item with the `ContextMenu.Content`. Must be rendered inside `ContextMenu.Content`.
**Props**
| Prop | Default | Type | Description |
| --- | --- | --- | --- |
| `as` | `"svg"` | `AsTag \| Component` | The element or component this component should render as. Can be overwritten by `asChild`. |
| `asChild` | | `boolean` | Change the default rendered element for the one passed as a child, merging their props and behavior.
Read our [Composition](https://vinicunca.dev/akar/guides/composition) guide for more details. |
| `height` | `5` | `number` | The height of the arrow in pixels. |
| `rounded` | `false` | `boolean` | When `true`, render the rounded version of arrow. Do not work with `as`/`asChild` |
| `width` | `10` | `number` | The width of the arrow in pixels. |
[ContextMenuArrow.vue source](https://github.com/vinicunca/akar/blob/v2.0.20/packages/core/src/ContextMenu/ContextMenuArrow.vue)
### Item
The component that contains the context menu items.
**Props**
| Prop | Default | Type | Description |
| --- | --- | --- | --- |
| `as` | `"div"` | `AsTag \| Component` | The element or component this component should render as. Can be overwritten by `asChild`. |
| `asChild` | | `boolean` | Change the default rendered element for the one passed as a child, merging their props and behavior.
Read our [Composition](https://vinicunca.dev/akar/guides/composition) guide for more details. |
| `disabled` | | `boolean` | When `true`, prevents the user from interacting with the item. |
| `textValue` | | `string` | Optional text used for typeahead purposes. By default the typeahead behavior will use the `.textContent` of the item.
Use this when the content is complex, or you have non-textual content inside. |
**Events**
| Event | Payload | Description |
| --- | --- | --- |
| `select` | `event: Event` | Event handler called when the user selects an item (via mouse or keyboard).
Calling `event.preventDefault` in this handler will prevent the menu from closing when selecting that item. |
[ContextMenuItem.vue source](https://github.com/vinicunca/akar/blob/v2.0.20/packages/core/src/ContextMenu/ContextMenuItem.vue)
| Data attribute | Value |
| --- | --- |
| `[data-highlighted]` | Present when highlighted |
| `[data-disabled]` | Present when disabled |
### Group
Used to group multiple `ContextMenu.Item`s.
**Props**
| Prop | Default | Type | Description |
| --- | --- | --- | --- |
| `as` | `"div"` | `AsTag \| Component` | The element or component this component should render as. Can be overwritten by `asChild`. |
| `asChild` | | `boolean` | Change the default rendered element for the one passed as a child, merging their props and behavior.
Read our [Composition](https://vinicunca.dev/akar/guides/composition) guide for more details. |
[ContextMenuGroup.vue source](https://github.com/vinicunca/akar/blob/v2.0.20/packages/core/src/ContextMenu/ContextMenuGroup.vue)
### Label
Used to render a label. It won't be focusable using arrow keys.
**Props**
| Prop | Default | Type | Description |
| --- | --- | --- | --- |
| `as` | `"div"` | `AsTag \| Component` | The element or component this component should render as. Can be overwritten by `asChild`. |
| `asChild` | | `boolean` | Change the default rendered element for the one passed as a child, merging their props and behavior.
Read our [Composition](https://vinicunca.dev/akar/guides/composition) guide for more details. |
[ContextMenuLabel.vue source](https://github.com/vinicunca/akar/blob/v2.0.20/packages/core/src/ContextMenu/ContextMenuLabel.vue)
### CheckboxItem
An item that can be controlled and rendered like a checkbox.
**Props**
| Prop | Default | Type | Description |
| --- | --- | --- | --- |
| `as` | `"div"` | `AsTag \| Component` | The element or component this component should render as. Can be overwritten by `asChild`. |
| `asChild` | | `boolean` | Change the default rendered element for the one passed as a child, merging their props and behavior.
Read our [Composition](https://vinicunca.dev/akar/guides/composition) guide for more details. |
| `disabled` | | `boolean` | When `true`, prevents the user from interacting with the item. |
| `modelValue` | | `false \| true \| "indeterminate"` | The controlled checked state of the item. Can be used as `v-model`. |
| `textValue` | | `string` | Optional text used for typeahead purposes. By default the typeahead behavior will use the `.textContent` of the item.
Use this when the content is complex, or you have non-textual content inside. |
**Events**
| Event | Payload | Description |
| --- | --- | --- |
| `select` | `event: Event` | Event handler called when the user selects an item (via mouse or keyboard).
Calling `event.preventDefault` in this handler will prevent the menu from closing when selecting that item. |
| `update:modelValue` | `payload: boolean` | Event handler called when the checked state changes. |
**Slots**
| Slot | Payload | Description |
| --- | --- | --- |
| `checked` | `false \| true \| "indeterminate"` | Current checked state |
| `modelValue` | `CheckedState` | Current modelValue state |
[ContextMenuCheckboxItem.vue source](https://github.com/vinicunca/akar/blob/v2.0.20/packages/core/src/ContextMenu/ContextMenuCheckboxItem.vue)
| Data attribute | Value |
| --- | --- |
| `[data-state]` | "checked" \\| "unchecked" \\| "indeterminate" |
| `[data-highlighted]` | Present when highlighted |
| `[data-disabled]` | Present when disabled |
### RadioGroup
Used to group multiple `ContextMenu.RadioItem`s.
**Props**
| Prop | Default | Type | Description |
| --- | --- | --- | --- |
| `as` | `"div"` | `AsTag \| Component` | The element or component this component should render as. Can be overwritten by `asChild`. |
| `asChild` | | `boolean` | Change the default rendered element for the one passed as a child, merging their props and behavior.
Read our [Composition](https://vinicunca.dev/akar/guides/composition) guide for more details. |
| `modelValue` | | `AcceptableValue` | The value of the selected item in the group. |
**Events**
| Event | Payload | Description |
| --- | --- | --- |
| `update:modelValue` | `payload: AcceptableValue` | Event handler called when the value changes. |
[ContextMenuRadioGroup.vue source](https://github.com/vinicunca/akar/blob/v2.0.20/packages/core/src/ContextMenu/ContextMenuRadioGroup.vue)
### RadioItem
An item that can be controlled and rendered like a radio.
**Props**
| Prop | Default | Type | Description |
| --- | --- | --- | --- |
| `as` | `"div"` | `AsTag \| Component` | The element or component this component should render as. Can be overwritten by `asChild`. |
| `asChild` | | `boolean` | Change the default rendered element for the one passed as a child, merging their props and behavior.
Read our [Composition](https://vinicunca.dev/akar/guides/composition) guide for more details. |
| `disabled` | | `boolean` | When `true`, prevents the user from interacting with the item. |
| `textValue` | | `string` | Optional text used for typeahead purposes. By default the typeahead behavior will use the `.textContent` of the item.
Use this when the content is complex, or you have non-textual content inside. |
| `value*` | | `AcceptableValue` | The unique value of the item. |
**Events**
| Event | Payload | Description |
| --- | --- | --- |
| `select` | `event: Event` | Event handler called when the user selects an item (via mouse or keyboard).
Calling `event.preventDefault` in this handler will prevent the menu from closing when selecting that item. |
**Slots**
| Slot | Payload | Description |
| --- | --- | --- |
| `checked` | `boolean` | Current checked state |
[ContextMenuRadioItem.vue source](https://github.com/vinicunca/akar/blob/v2.0.20/packages/core/src/ContextMenu/ContextMenuRadioItem.vue)
| Data attribute | Value |
| --- | --- |
| `[data-state]` | "checked" \\| "unchecked" \\| "indeterminate" |
| `[data-highlighted]` | Present when highlighted |
| `[data-disabled]` | Present when disabled |
### ItemIndicator
Renders when the parent `ContextMenu.CheckboxItem` or `ContextMenu.RadioItem` is checked. You can style this element directly, or you can use it as a wrapper to put an icon into, or both.
**Props**
| Prop | Default | Type | Description |
| --- | --- | --- | --- |
| `as` | `"div"` | `AsTag \| Component` | The element or component this component should render as. Can be overwritten by `asChild`. |
| `asChild` | | `boolean` | Change the default rendered element for the one passed as a child, merging their props and behavior.
Read our [Composition](https://vinicunca.dev/akar/guides/composition) guide for more details. |
| `forceMount` | | `boolean` | Used to force mounting when more control is needed. Useful when
controlling animation with Vue animation libraries. |
[ContextMenuItemIndicator.vue source](https://github.com/vinicunca/akar/blob/v2.0.20/packages/core/src/ContextMenu/ContextMenuItemIndicator.vue)
| Data attribute | Value |
| --- | --- |
| `[data-state]` | "checked" \\| "unchecked" \\| "indeterminate" |
### Separator
Used to visually separate items in the context menu.
**Props**
| Prop | Default | Type | Description |
| --- | --- | --- | --- |
| `as` | `"div"` | `AsTag \| Component` | The element or component this component should render as. Can be overwritten by `asChild`. |
| `asChild` | | `boolean` | Change the default rendered element for the one passed as a child, merging their props and behavior.
Read our [Composition](https://vinicunca.dev/akar/guides/composition) guide for more details. |
[ContextMenuSeparator.vue source](https://github.com/vinicunca/akar/blob/v2.0.20/packages/core/src/ContextMenu/ContextMenuSeparator.vue)
### Sub
Contains all the parts of a submenu.
**Props**
| Prop | Default | Type | Description |
| --- | --- | --- | --- |
| `defaultOpen` | | `boolean` | The open state of the submenu when it is initially rendered. Use when you do not need to control its open state. |
| `open` | | `boolean` | The controlled open state of the menu. Can be used as `v-model:open`. |
**Events**
| Event | Payload | Description |
| --- | --- | --- |
| `update:open` | `payload: boolean` | Event handler called when the open state of the submenu changes. |
**Slots**
| Slot | Payload | Description |
| --- | --- | --- |
| `open` | `boolean` | Current open state |
[ContextMenuSub.vue source](https://github.com/vinicunca/akar/blob/v2.0.20/packages/core/src/ContextMenu/ContextMenuSub.vue)
### SubTrigger
An item that opens a submenu. Must be rendered inside `ContextMenu.Sub`.
**Props**
| Prop | Default | Type | Description |
| --- | --- | --- | --- |
| `as` | `"div"` | `AsTag \| Component` | The element or component this component should render as. Can be overwritten by `asChild`. |
| `asChild` | | `boolean` | Change the default rendered element for the one passed as a child, merging their props and behavior.
Read our [Composition](https://vinicunca.dev/akar/guides/composition) guide for more details. |
| `disabled` | | `boolean` | When `true`, prevents the user from interacting with the item. |
| `graceDuration` | `300` | `number` | Time in milliseconds to keep a submenu open while the pointer moves from
its trigger to the submenu. |
| `textValue` | | `string` | Optional text used for typeahead purposes. By default the typeahead behavior will use the `.textContent` of the item.
Use this when the content is complex, or you have non-textual content inside. |
[ContextMenuSubTrigger.vue source](https://github.com/vinicunca/akar/blob/v2.0.20/packages/core/src/ContextMenu/ContextMenuSubTrigger.vue)
| Data attribute | Value |
| --- | --- |
| `[data-state]` | "open" \\| "closed" |
| `[data-highlighted]` | Present when highlighted |
| `[data-disabled]` | Present when disabled |
### SubContent
The component that pops out when a submenu is open. Must be rendered inside `ContextMenu.Sub`.
**Props**
| Prop | Default | Type | Description |
| --- | --- | --- | --- |
| `alignFlip` | `true` | `boolean` | Flip alignment when colliding with boundary.
May only occur when `prioritizePosition` is true. |
| `alignOffset` | `0` | `number` | An offset in pixels from the `start` or `end` alignment options. |
| `arrowPadding` | `0` | `number` | The padding between the arrow and the edges of the content.
If your content has border-radius, this will prevent it from
overflowing the corners. |
| `as` | `"div"` | `AsTag \| Component` | The element or component this component should render as. Can be overwritten by `asChild`. |
| `asChild` | | `boolean` | Change the default rendered element for the one passed as a child, merging their props and behavior.
Read our [Composition](https://vinicunca.dev/akar/guides/composition) guide for more details. |
| `avoidCollisions` | `true` | `boolean` | When `true`, overrides the side and align preferences
to prevent collisions with boundary edges. |
| `collisionBoundary` | `[]` | `Element \| (Element \| null)[] \| null` | The element used as the collision boundary. By default
this is the viewport, though you can provide additional
element(s) to be included in this check. |
| `collisionPadding` | `0` | `number \| Partial
detection should occur. Accepts a number (same for all sides),
or a partial padding object, for example: { top: 20, left: 20 }. |
| `disableUpdateOnLayoutShift` | `false` | `boolean` | Whether to disable the update position for the content when the layout shifted. |
| `forceMount` | | `boolean` | Used to force mounting when more control is needed. Useful when
controlling animation with Vue animation libraries. |
| `hideShiftedArrow` | `true` | `boolean` | When `true`, hides the arrow when it cannot be centered
to the reference element. |
| `hideWhenDetached` | `false` | `boolean` | Whether to hide the content when the trigger becomes fully occluded. |
| `loop` | `false` | `boolean` | When `true`, keyboard navigation will loop from last item to first, and vice versa. |
| `memoDependencies` | | `unknown[]` | Reactive dependencies that should invalidate the memoized content subtree. |
| `positionStrategy` | | `"fixed" \| "absolute"` | The type of CSS position property to use. |
| `prioritizePosition` | `false` | `boolean` | Force content to be position within the viewport.
Might overlap the reference element, which may not be desired. |
| `reference` | | `ReferenceElement` | The custom element or virtual element that will be set as the reference
to position the floating element.
If provided, it will replace the default anchor element. |
| `sideFlip` | `true` | `boolean` | Flip to the opposite side when colliding with boundary. |
| `sideOffset` | `0` | `number` | The distance in pixels from the trigger. |
| `sticky` | `"partial"` | `"partial" \| "always"` | The sticky behavior on the align axis. `partial` will keep the
content in the boundary as long as the trigger is at least partially
in the boundary whilst "always" will keep the content in the boundary
regardless. |
| `updatePositionStrategy` | `'optimized'` | `"always" \| "optimized"` | Strategy to update the position of the floating element on every animation frame. |
**Events**
| Event | Payload | Description |
| --- | --- | --- |
| `closeAutoFocus` | `event: Event` | Event handler called when auto-focusing on close.
Can be prevented. |
| `entryFocus` | `event: Event` | |
| `escapeKeyDown` | `event: KeyboardEvent` | Event handler called when the escape key is down.
Can be prevented. |
| `focusOutside` | `event: FocusOutsideEvent` | Event handler called when the focus moves outside of the `DismissableLayer`.
Can be prevented. |
| `interactOutside` | `event: PointerDownOutsideEvent \| FocusOutsideEvent` | Event handler called when an interaction happens outside the `DismissableLayer`.
Specifically, when a `pointerdown` event happens outside or focus moves outside of it.
Can be prevented. |
| `openAutoFocus` | `event: Event` | |
| `pointerDownOutside` | `event: PointerDownOutsideEvent` | Event handler called when a `pointerdown` event happens outside of the `DismissableLayer`.
Can be prevented. |
[ContextMenuSubContent.vue source](https://github.com/vinicunca/akar/blob/v2.0.20/packages/core/src/ContextMenu/ContextMenuSubContent.vue)
| Data attribute | Value |
| --- | --- |
| `[data-state]` | "open" \\| "closed" |
| `[data-side]` | "left" \\| "right" \\| "bottom" \\| "top" |
| `[data-align]` | "start" \\| "end" \\| "center" |
| CSS variable | Description |
| --- | --- |
| `--akar-context-menu-content-transform-origin` | The `transform-origin` computed from the content and arrow positions/offsets |
| `--akar-context-menu-content-available-width` | The remaining width between the trigger and the boundary edge |
| `--akar-context-menu-content-available-height` | The remaining height between the trigger and the boundary edge |
| `--akar-context-menu-trigger-width` | The width of the trigger |
| `--akar-context-menu-trigger-height` | The height of the trigger |
## Examples
### With submenus
You can create submenus by using `ContextMenuSub` in combination with its parts.
```vue
Adolfo Hess
Miyah Myles
Read our [Composition](/akar/guides/composition) guide for more details. |
| `defaultPlaceholder` | | `DateValue` | The default placeholder date |
| `defaultValue` | | `DateValue` | The default value for the calendar |
| `dir` | | `"ltr" \| "rtl"` | The reading direction of the date field when applicable.
If omitted, inherits globally from `ConfigProvider` or assumes LTR (left-to-right) reading mode. |
| `disabled` | `false` | `boolean` | Whether or not the date field is disabled |
| `granularity` | | `"day" \| "hour" \| "minute" \| "second"` | The granularity to use for formatting times. Defaults to day if a CalendarDate is provided, otherwise defaults to minute. The field will render segments for each part of the date up to and including the specified granularity |
| `hideTimeZone` | | `boolean` | Whether or not to hide the time zone segment of the field |
| `hourCycle` | | `12 \| 24` | The hour cycle used for formatting times. Defaults to the local preference |
| `id` | | `string` | Id of the element |
| `isDateUnavailable` | | `Matcher` | A function that returns whether or not a date is unavailable |
| `locale` | | `string` | The locale to use for formatting dates |
| `maxValue` | | `DateValue` | The maximum date that can be selected |
| `minValue` | | `DateValue` | The minimum date that can be selected |
| `modelValue` | | `DateValue \| null` | The controlled value of the field. Can be bound as `v-model`. |
| `name` | | `string` | The name of the field. Submitted with its owning form as part of a name/value pair. |
| `placeholder` | | `DateValue` | The placeholder date, which is used to determine what month to display when no date is selected. This updates as the user navigates the calendar and can be used to programmatically control the calendar view |
| `readonly` | `false` | `boolean` | Whether or not the date field is readonly |
| `required` | | `boolean` | When `true`, indicates that the user must set the value before the owning form can be submitted. |
| `step` | | `DateStep` | The stepping interval for the time fields. Defaults to `1`. |
| `stepSnapping` | `false` | `boolean` | Whether to enforce snapping the time value to the nearest step increment after input. Defaults to `false`. |
**Events**
| Event | Payload | Description |
| --- | --- | --- |
| `update:modelValue` | `date: DateValue` | Event handler called whenever the model value changes |
| `update:placeholder` | `date: DateValue` | Event handler called whenever the placeholder value changes |
**Slots**
| Slot | Payload | Description |
| --- | --- | --- |
| `modelValue` | `DateValue` | The current date of the field |
| `segments` | `{ part: SegmentPart; value: string; }[]` | The date field segment contents |
| `isInvalid` | `boolean` | Value if the input is invalid |
**Methods**
| Method | Type | Description |
| --- | --- | --- |
| `setFocusedElement` | `(el: HTMLElement) => void` | Helper to set the focused element inside the DateField |
[DateFieldRoot.vue source](https://github.com/vinicunca/akar/blob/v2.0.20/packages/core/src/DateField/DateFieldRoot.vue)
| Data attribute | Value |
| --- | --- |
| `[data-readonly]` | Present when readonly |
| `[data-disabled]` | Present when disabled |
| `[data-invalid]` | Present when invalid |
### Input
Contains the date field segments
**Props**
| Prop | Default | Type | Description |
| --- | --- | --- | --- |
| `as` | `"div"` | `AsTag \| Component` | The element or component this component should render as. Can be overwritten by `asChild`. |
| `asChild` | | `boolean` | Change the default rendered element for the one passed as a child, merging their props and behavior.
Read our [Composition](/akar/guides/composition) guide for more details. |
| `part*` | | `"day" \| "month" \| "year" \| "hour" \| "minute" \| "second" \| "dayPeriod" \| "literal" \| "timeZoneName"` | The part of the date to render |
[DateFieldInput.vue source](https://github.com/vinicunca/akar/blob/v2.0.20/packages/core/src/DateField/DateFieldInput.vue)
| Data attribute | Value |
| --- | --- |
| `[data-disabled]` | Present when disabled |
| `[data-invalid]` | Present when invalid |
| `[data-placeholder]` | Present when no value is set |
## Accessibility
### Keyboard Interactions
| Key | Description |
| --- | --- |
| Tab | When focus moves onto the date field, focuses the first segment. |
| ArrowLeft / ArrowRight | Navigates between the date field segments. |
| ArrowUp / ArrowDown | Increments/changes the value of the segment. |
| 0-9 | When the focus is on a numeric `DateFieldInput`, it types in the number and focuses the next segment if the next input would result in an invalid value. |
| Backspace | Deletes a digit from the focused numeric segments. |
| A / P | When the focus is on the day period, it sets it to AM or PM. |
---
- [GitHub](https://github.com/vinicunca/akar/blob/v2.0.20/packages/core/src/DateField)
- [npm](https://www.npmjs.com/package/akar)
# Date Picker
> Facilitates the selection of dates through an input and calendar-based interface.
`````vue [index.vue]
If omitted, inherits globally from `ConfigProvider` or assumes LTR (left-to-right) reading mode. |
| `disabled` | `false` | `boolean` | Whether or not the date field is disabled |
| `fixedWeeks` | `false` | `boolean` | Whether or not to always display 6 weeks in the calendar |
| `granularity` | | `"day" \| "hour" \| "minute" \| "second"` | The granularity to use for formatting times. Defaults to day if a CalendarDate is provided, otherwise defaults to minute. The field will render segments for each part of the date up to and including the specified granularity |
| `hideTimeZone` | | `boolean` | Whether or not to hide the time zone segment of the field |
| `hourCycle` | | `12 \| 24` | The hour cycle used for formatting times. Defaults to the local preference |
| `id` | | `string` | Id of the element |
| `isDateDisabled` | | `Matcher` | A function that returns whether or not a date is disabled |
| `isDateUnavailable` | | `Matcher` | A function that returns whether or not a date is unavailable |
| `locale` | | `string` | The locale to use for formatting dates |
| `maxValue` | | `DateValue` | The maximum date that can be selected |
| `minValue` | | `DateValue` | The minimum date that can be selected |
| `modal` | `false` | `boolean` | The modality of the popover. When set to true, interaction with outside elements will be disabled and only popover content will be visible to screen readers. |
| `modelValue` | | `DateValue \| null` | The controlled value of the field. Can be bound as `v-model`. |
| `name` | | `string` | The name of the field. Submitted with its owning form as part of a name/value pair. |
| `numberOfMonths` | `1` | `number` | The number of months to display at once |
| `open` | | `boolean` | The controlled open state of the popover. |
| `pagedNavigation` | `false` | `boolean` | This property causes the previous and next buttons to navigate by the number of months displayed at once, rather than one month |
| `placeholder` | | `DateValue` | The placeholder date, which is used to determine what month to display when no date is selected. This updates as the user navigates the calendar and can be used to programmatically control the calendar view |
| `preventDeselect` | `false` | `boolean` | Whether or not to prevent the user from deselecting a date without selecting another date first |
| `readonly` | `false` | `boolean` | Whether or not the date field is readonly |
| `required` | | `boolean` | When `true`, indicates that the user must set the value before the owning form can be submitted. |
| `step` | | `DateStep` | The stepping interval for the time fields. Defaults to `1`. |
| `stepSnapping` | | `boolean` | Whether to enforce snapping the time value to the nearest step increment after input. Defaults to `false`. |
| `weekdayFormat` | `"narrow"` | `"narrow" \| "short" \| "long"` | The format to use for the weekday strings provided via the weekdays slot prop |
| `weekStartsOn` | | `0 \| 1 \| 2 \| 3 \| 4 \| 5 \| 6` | The day of the week to start the calendar on |
**Events**
| Event | Payload | Description |
| --- | --- | --- |
| `update:modelValue` | `date: DateValue` | Event handler called whenever the model value changes |
| `update:open` | `value: boolean` | Event handler called when the open state of the popover changes. |
| `update:placeholder` | `date: DateValue` | Event handler called whenever the placeholder value changes |
[DatePickerRoot.vue source](https://github.com/vinicunca/akar/blob/v2.0.20/packages/core/src/DatePicker/DatePickerRoot.vue)
### Field
Contains the date picker date field segments and trigger
**Slots**
| Slot | Payload | Description |
| --- | --- | --- |
| `segments` | `{ part: SegmentPart; value: string; }[]` | |
| `modelValue` | `DateValue` | |
[DatePickerField.vue source](https://github.com/vinicunca/akar/blob/v2.0.20/packages/core/src/DatePicker/DatePickerField.vue)
| Data attribute | Value |
| --- | --- |
| `[data-readonly]` | Present when readonly |
| `[data-disabled]` | Present when disabled |
| `[data-invalid]` | Present when invalid |
### Input
Contains the date picker date field segments
**Props**
| Prop | Default | Type | Description |
| --- | --- | --- | --- |
| `as` | `"div"` | `AsTag \| Component` | The element or component this component should render as. Can be overwritten by `asChild`. |
| `asChild` | | `boolean` | Change the default rendered element for the one passed as a child, merging their props and behavior.
Read our [Composition](/akar/guides/composition) guide for more details. |
| `part*` | | `"day" \| "month" \| "year" \| "hour" \| "minute" \| "second" \| "dayPeriod" \| "literal" \| "timeZoneName"` | The part of the date to render |
[DatePickerInput.vue source](https://github.com/vinicunca/akar/blob/v2.0.20/packages/core/src/DatePicker/DatePickerInput.vue)
| Data attribute | Value |
| --- | --- |
| `[data-disabled]` | Present when disabled |
| `[data-invalid]` | Present when invalid |
| `[data-placeholder]` | Present when no value is set |
### Trigger
The button that toggles the popover. By default, the `DatePickerContent` will position itself against the trigger.
**Props**
| Prop | Default | Type | Description |
| --- | --- | --- | --- |
| `as` | `"div"` | `AsTag \| Component` | The element or component this component should render as. Can be overwritten by `asChild`. |
| `asChild` | | `boolean` | Change the default rendered element for the one passed as a child, merging their props and behavior.
Read our [Composition](/akar/guides/composition) guide for more details. |
[DatePickerTrigger.vue source](https://github.com/vinicunca/akar/blob/v2.0.20/packages/core/src/DatePicker/DatePickerTrigger.vue)
### Content
The component that pops out when the popover is open.
**Props**
| Prop | Default | Type | Description |
| --- | --- | --- | --- |
| `align` | `"center"` | `"start" \| "center" \| "end"` | The preferred alignment against the trigger.
May change when collisions occur. |
| `alignFlip` | `true` | `boolean` | Flip alignment when colliding with boundary.
May only occur when `prioritizePosition` is true. |
| `alignOffset` | `0` | `number` | An offset in pixels from the `start` or `end` alignment options. |
| `arrowPadding` | `0` | `number` | The padding between the arrow and the edges of the content.
If your content has border-radius, this will prevent it from
overflowing the corners. |
| `as` | `"div"` | `AsTag \| Component` | The element or component this component should render as. Can be overwritten by `asChild`. |
| `asChild` | | `boolean` | Change the default rendered element for the one passed as a child, merging their props and behavior.
Read our [Composition](/akar/guides/composition) guide for more details. |
| `avoidCollisions` | `true` | `boolean` | When `true`, overrides the side and align preferences
to prevent collisions with boundary edges. |
| `collisionBoundary` | `[]` | `Element \| (Element \| null)[] \| null` | The element used as the collision boundary. By default
this is the viewport, though you can provide additional
element(s) to be included in this check. |
| `collisionPadding` | `0` | `number \| Partial
detection should occur. Accepts a number (same for all sides),
or a partial padding object, for example: { top: 20, left: 20 }. |
| `dir` | | `"ltr" \| "rtl"` | The reading direction of the popper content when applicable.
If omitted, inherits globally from `ConfigProvider` or assumes LTR (left-to-right) reading mode. |
| `disableOutsidePointerEvents` | | `boolean` | When `true`, hover/focus/click interactions will be disabled on elements outside
the `DismissableLayer`. Users will need to click twice on outside elements to
interact with them: once to close the `DismissableLayer`, and again to trigger the element. |
| `disableUpdateOnLayoutShift` | `false` | `boolean` | Whether to disable the update position for the content when the layout shifted. |
| `forceMount` | | `boolean` | Used to force mounting when more control is needed. Useful when
controlling animation with Vue animation libraries. |
| `hideShiftedArrow` | `true` | `boolean` | When `true`, hides the arrow when it cannot be centered
to the reference element. |
| `hideWhenDetached` | `false` | `boolean` | Whether to hide the content when the trigger becomes fully occluded. |
| `memoDependencies` | | `unknown[]` | Reactive dependencies that should invalidate the memoized content subtree. |
| `portal` | | `PopoverPortalProps` | Props to control the portal wrapped around the content. |
| `positionStrategy` | | `"fixed" \| "absolute"` | The type of CSS position property to use. |
| `prioritizePosition` | `false` | `boolean` | Force content to be position within the viewport.
Might overlap the reference element, which may not be desired. |
| `reference` | | `ReferenceElement` | The custom element or virtual element that will be set as the reference
to position the floating element.
If provided, it will replace the default anchor element. |
| `side` | `"bottom"` | `"top" \| "right" \| "bottom" \| "left"` | The preferred side of the trigger to render against when open.
Will be reversed when collisions occur and avoidCollisions
is enabled. |
| `sideFlip` | `true` | `boolean` | Flip to the opposite side when colliding with boundary. |
| `sideOffset` | `0` | `number` | The distance in pixels from the trigger. |
| `sticky` | `"partial"` | `"partial" \| "always"` | The sticky behavior on the align axis. `partial` will keep the
content in the boundary as long as the trigger is at least partially
in the boundary whilst "always" will keep the content in the boundary
regardless. |
| `updatePositionStrategy` | `'optimized'` | `"always" \| "optimized"` | Strategy to update the position of the floating element on every animation frame. |
**Events**
| Event | Payload | Description |
| --- | --- | --- |
| `closeAutoFocus` | `event: Event` | Event handler called when auto-focusing on close.
Can be prevented. |
| `escapeKeyDown` | `event: KeyboardEvent` | Event handler called when the escape key is down.
Can be prevented. |
| `focusOutside` | `event: FocusOutsideEvent` | Event handler called when the focus moves outside of the `DismissableLayer`.
Can be prevented. |
| `interactOutside` | `event: PointerDownOutsideEvent \| FocusOutsideEvent` | Event handler called when an interaction happens outside the `DismissableLayer`.
Specifically, when a `pointerdown` event happens outside or focus moves outside of it.
Can be prevented. |
| `openAutoFocus` | `event: Event` | Event handler called when auto-focusing on open.
Can be prevented. |
| `pointerDownOutside` | `event: PointerDownOutsideEvent` | Event handler called when a `pointerdown` event happens outside of the `DismissableLayer`.
Can be prevented. |
[DatePickerContent.vue source](https://github.com/vinicunca/akar/blob/v2.0.20/packages/core/src/DatePicker/DatePickerContent.vue)
### Arrow
An optional arrow element to render alongside the popover. This can be used to help visually link the anchor with the `DatePickerContent`. Must be rendered inside `DatePickerContent`.
**Props**
| Prop | Default | Type | Description |
| --- | --- | --- | --- |
| `as` | `"div"` | `AsTag \| Component` | The element or component this component should render as. Can be overwritten by `asChild`. |
| `asChild` | | `boolean` | Change the default rendered element for the one passed as a child, merging their props and behavior.
Read our [Composition](/akar/guides/composition) guide for more details. |
| `height` | `5` | `number` | The height of the arrow in pixels. |
| `rounded` | `false` | `boolean` | When `true`, render the rounded version of arrow. Do not work with `as`/`asChild` |
| `width` | `10` | `number` | The width of the arrow in pixels. |
[DatePickerArrow.vue source](https://github.com/vinicunca/akar/blob/v2.0.20/packages/core/src/DatePicker/DatePickerArrow.vue)
### Close
The button that closes an open date picker.
**Props**
| Prop | Default | Type | Description |
| --- | --- | --- | --- |
| `as` | `"div"` | `AsTag \| Component` | The element or component this component should render as. Can be overwritten by `asChild`. |
| `asChild` | | `boolean` | Change the default rendered element for the one passed as a child, merging their props and behavior.
Read our [Composition](/akar/guides/composition) guide for more details. |
[DatePickerClose.vue source](https://github.com/vinicunca/akar/blob/v2.0.20/packages/core/src/DatePicker/DatePickerClose.vue)
### Anchor
An optional element to position the `DatePickerContent` against. If this part is not used, the content will position alongside the `DatePickerTrigger`.
**Props**
| Prop | Default | Type | Description |
| --- | --- | --- | --- |
| `as` | `"div"` | `AsTag \| Component` | The element or component this component should render as. Can be overwritten by `asChild`. |
| `asChild` | | `boolean` | Change the default rendered element for the one passed as a child, merging their props and behavior.
Read our [Composition](/akar/guides/composition) guide for more details. |
| `reference` | | `ReferenceElement` | The reference (or anchor) element that is being referred to for positioning.
If not provided will use the current component as anchor. |
[DatePickerAnchor.vue source](https://github.com/vinicunca/akar/blob/v2.0.20/packages/core/src/DatePicker/DatePickerAnchor.vue)
### Calendar
Contains all the parts of a calendar
**Slots**
| Slot | Payload | Description |
| --- | --- | --- |
| `date` | `DateValue` | |
| `grid` | `Grid
Read our [Composition](/akar/guides/composition) guide for more details. |
[DatePickerHeader.vue source](https://github.com/vinicunca/akar/blob/v2.0.20/packages/core/src/DatePicker/DatePickerHeader.vue)
### Prev Button
Calendar navigation button. It navigates the calendar one month/year/decade in the past based on the current calendar view.
**Props**
| Prop | Default | Type | Description |
| --- | --- | --- | --- |
| `as` | `"div"` | `AsTag \| Component` | The element or component this component should render as. Can be overwritten by `asChild`. |
| `asChild` | | `boolean` | Change the default rendered element for the one passed as a child, merging their props and behavior.
Read our [Composition](/akar/guides/composition) guide for more details. |
| `prevPage` | | `((placeholder: DateValue) => DateValue)` | The function to be used for the prev page. Overwrites the `prevPage` function set on the `CalendarRoot`. |
**Slots**
| Slot | Payload | Description |
| --- | --- | --- |
| `disabled` | `boolean` | Current disable state |
[DatePickerPrev.vue source](https://github.com/vinicunca/akar/blob/v2.0.20/packages/core/src/DatePicker/DatePickerPrev.vue)
| Data attribute | Value |
| --- | --- |
| `[data-disabled]` | Present when disabled |
### Next Button
Calendar navigation button. It navigates the calendar one month/year/decade in the future based on the current calendar view.
**Props**
| Prop | Default | Type | Description |
| --- | --- | --- | --- |
| `as` | `"div"` | `AsTag \| Component` | The element or component this component should render as. Can be overwritten by `asChild`. |
| `asChild` | | `boolean` | Change the default rendered element for the one passed as a child, merging their props and behavior.
Read our [Composition](/akar/guides/composition) guide for more details. |
| `nextPage` | | `((placeholder: DateValue) => DateValue)` | The function to be used for the next page. Overwrites the `nextPage` function set on the `CalendarRoot`. |
**Slots**
| Slot | Payload | Description |
| --- | --- | --- |
| `disabled` | `boolean` | Current disable state |
[DatePickerNext.vue source](https://github.com/vinicunca/akar/blob/v2.0.20/packages/core/src/DatePicker/DatePickerNext.vue)
| Data attribute | Value |
| --- | --- |
| `[data-disabled]` | Present when disabled |
### Heading
Heading for displaying the current month and year/
**Props**
| Prop | Default | Type | Description |
| --- | --- | --- | --- |
| `as` | `"div"` | `AsTag \| Component` | The element or component this component should render as. Can be overwritten by `asChild`. |
| `asChild` | | `boolean` | Change the default rendered element for the one passed as a child, merging their props and behavior.
Read our [Composition](/akar/guides/composition) guide for more details. |
**Slots**
| Slot | Payload | Description |
| --- | --- | --- |
| `headingValue` | `string` | Current month and year |
[DatePickerHeading.vue source](https://github.com/vinicunca/akar/blob/v2.0.20/packages/core/src/DatePicker/DatePickerHeading.vue)
### Grid
Container for wrapping the calendar grid.
**Props**
| Prop | Default | Type | Description |
| --- | --- | --- | --- |
| `as` | `"div"` | `AsTag \| Component` | The element or component this component should render as. Can be overwritten by `asChild`. |
| `asChild` | | `boolean` | Change the default rendered element for the one passed as a child, merging their props and behavior.
Read our [Composition](/akar/guides/composition) guide for more details. |
[DatePickerGrid.vue source](https://github.com/vinicunca/akar/blob/v2.0.20/packages/core/src/DatePicker/DatePickerGrid.vue)
| Data attribute | Value |
| --- | --- |
| `[data-disabled]` | Present when disabled |
| `[data-readonly]` | Present when readonly |
### Grid Head
Container for wrapping the grid head.
**Props**
| Prop | Default | Type | Description |
| --- | --- | --- | --- |
| `as` | `"div"` | `AsTag \| Component` | The element or component this component should render as. Can be overwritten by `asChild`. |
| `asChild` | | `boolean` | Change the default rendered element for the one passed as a child, merging their props and behavior.
Read our [Composition](/akar/guides/composition) guide for more details. |
[DatePickerGridHead.vue source](https://github.com/vinicunca/akar/blob/v2.0.20/packages/core/src/DatePicker/DatePickerGridHead.vue)
### Grid Body
Container for wrapping the grid body.
**Props**
| Prop | Default | Type | Description |
| --- | --- | --- | --- |
| `as` | `"div"` | `AsTag \| Component` | The element or component this component should render as. Can be overwritten by `asChild`. |
| `asChild` | | `boolean` | Change the default rendered element for the one passed as a child, merging their props and behavior.
Read our [Composition](/akar/guides/composition) guide for more details. |
[DatePickerGridBody.vue source](https://github.com/vinicunca/akar/blob/v2.0.20/packages/core/src/DatePicker/DatePickerGridBody.vue)
### Grid Row
Container for wrapping the grid row.
**Props**
| Prop | Default | Type | Description |
| --- | --- | --- | --- |
| `as` | `"div"` | `AsTag \| Component` | The element or component this component should render as. Can be overwritten by `asChild`. |
| `asChild` | | `boolean` | Change the default rendered element for the one passed as a child, merging their props and behavior.
Read our [Composition](/akar/guides/composition) guide for more details. |
[DatePickerGridRow.vue source](https://github.com/vinicunca/akar/blob/v2.0.20/packages/core/src/DatePicker/DatePickerGridRow.vue)
### Head Cell
Container for wrapping the head cell. Used for displaying the week days.
**Props**
| Prop | Default | Type | Description |
| --- | --- | --- | --- |
| `as` | `"div"` | `AsTag \| Component` | The element or component this component should render as. Can be overwritten by `asChild`. |
| `asChild` | | `boolean` | Change the default rendered element for the one passed as a child, merging their props and behavior.
Read our [Composition](/akar/guides/composition) guide for more details. |
[DatePickerHeadCell.vue source](https://github.com/vinicunca/akar/blob/v2.0.20/packages/core/src/DatePicker/DatePickerHeadCell.vue)
### Cell
Container for wrapping the calendar cells.
**Props**
| Prop | Default | Type | Description |
| --- | --- | --- | --- |
| `as` | `"div"` | `AsTag \| Component` | The element or component this component should render as. Can be overwritten by `asChild`. |
| `asChild` | | `boolean` | Change the default rendered element for the one passed as a child, merging their props and behavior.
Read our [Composition](/akar/guides/composition) guide for more details. |
| `date*` | | `DateValue` | The date value for the cell |
[DatePickerCell.vue source](https://github.com/vinicunca/akar/blob/v2.0.20/packages/core/src/DatePicker/DatePickerCell.vue)
| Data attribute | Value |
| --- | --- |
| `[data-disabled]` | Present when disabled |
### Cell Trigger
Interactable container for displaying the cell dates. Clicking it selects the date.
**Props**
| Prop | Default | Type | Description |
| --- | --- | --- | --- |
| `as` | `"div"` | `AsTag \| Component` | The element or component this component should render as. Can be overwritten by `asChild`. |
| `asChild` | | `boolean` | Change the default rendered element for the one passed as a child, merging their props and behavior.
Read our [Composition](/akar/guides/composition) guide for more details. |
| `day*` | | `DateValue` | The date value provided to the cell trigger |
| `month*` | | `DateValue` | The month in which the cell is rendered |
**Slots**
| Slot | Payload | Description |
| --- | --- | --- |
| `dayValue` | `string` | Current day |
| `disabled` | `boolean` | Current disable state |
| `selected` | `boolean` | Current selected state |
| `today` | `boolean` | Current today state |
| `outsideView` | `boolean` | Current outside view state |
| `outsideVisibleView` | `boolean` | Current outside visible view state |
| `unavailable` | `boolean` | Current unavailable state |
[DatePickerCellTrigger.vue source](https://github.com/vinicunca/akar/blob/v2.0.20/packages/core/src/DatePicker/DatePickerCellTrigger.vue)
| Data attribute | Value |
| --- | --- |
| `[data-selected]` | Present when selected |
| `[data-value]` | The ISO string value of the date. |
| `[data-disabled]` | Present when disabled |
| `[data-unavailable]` | Present when unavailable |
| `[data-today]` | Present when today |
| `[data-outside-view]` | Present when the date is outside the current month it is displayed in. |
| `[data-outside-visible-view]` | Present when the date is outside the months that are visible on the calendar. |
| `[data-focused]` | Present when focused |
## Accessibility
### Keyboard Interactions
| Key | Description |
| --- | --- |
| Tab | When focus moves onto the date field, focuses the first segment. |
| Space | When the focus is on either `DatePickerNext` or `DatePickerPrev`, it navigates the calendar. Otherwise, it selects the date. If the focus is on `DatePickerTrigger`, it opens/closes the popover. |
| Enter | When the focus is on either `DatePickerNext` or `DatePickerPrev`, it navigates the calendar. Otherwise, it selects the date. If the focus is on `DatePickerTrigger`, it opens/closes the popover. |
| ArrowLeft / ArrowRight | Navigates between the date field segments. If the focus is on the `DatePickerCalendar`, it navigates between the dates. |
| ArrowUp / ArrowDown | Increments/changes the value of the segment. If the focus is on the `DatePickerCalendar`, it navigates between the dates. |
| 0-9 | When the focus is on a numeric `DatePickerInput`, it types in the number and focuses the next segment if the next input would result in an invalid value. |
| Backspace | Deletes a digit from the focused numeric segments. |
| A / P | When the focus is on the day period, it sets it to AM or PM. |
---
- [GitHub](https://github.com/vinicunca/akar/blob/v2.0.20/packages/core/src/DatePicker)
- [npm](https://www.npmjs.com/package/akar)
# Date Range Field
> Allows users to input a range of dates within a designated field.
`````vue [index.vue]
Read our [Composition](/akar/guides/composition) guide for more details. |
| `defaultPlaceholder` | | `DateValue` | The default placeholder date |
| `defaultValue` | | `DateRange` | The default value for the calendar |
| `dir` | | `"ltr" \| "rtl"` | The reading direction of the date field when applicable.
If omitted, inherits globally from `ConfigProvider` or assumes LTR (left-to-right) reading mode. |
| `disabled` | `false` | `boolean` | Whether or not the date field is disabled |
| `granularity` | | `"day" \| "hour" \| "minute" \| "second"` | The granularity to use for formatting times. Defaults to day if a CalendarDate is provided, otherwise defaults to minute. The field will render segments for each part of the date up to and including the specified granularity |
| `hideTimeZone` | | `boolean` | Whether or not to hide the time zone segment of the field |
| `hourCycle` | | `12 \| 24` | The hour cycle used for formatting times. Defaults to the local preference |
| `id` | | `string` | Id of the element |
| `isDateUnavailable` | | `Matcher` | A function that returns whether or not a date is unavailable |
| `locale` | | `string` | The locale to use for formatting dates |
| `maxValue` | | `DateValue` | The maximum date that can be selected |
| `minValue` | | `DateValue` | The minimum date that can be selected |
| `modelValue` | | `DateRange \| null` | The controlled value of the field. Can be bound as `v-model`. |
| `name` | | `string` | The name of the field. Submitted with its owning form as part of a name/value pair. |
| `placeholder` | | `DateValue` | The placeholder date, which is used to determine what month to display when no date is selected. This updates as the user navigates the calendar and can be used to programmatically control the calendar view |
| `readonly` | `false` | `boolean` | Whether or not the date field is readonly |
| `required` | | `boolean` | When `true`, indicates that the user must set the value before the owning form can be submitted. |
| `step` | | `DateStep` | The stepping interval for the time fields. Defaults to `1`. |
**Events**
| Event | Payload | Description |
| --- | --- | --- |
| `update:modelValue` | `date: DateRange` | Event handler called whenever the model value changes |
| `update:placeholder` | `date: DateValue` | Event handler called whenever the placeholder value changes |
**Slots**
| Slot | Payload | Description |
| --- | --- | --- |
| `modelValue` | `DateRange \| null` | The current date range of the field |
| `segments` | `{ start: { part: SegmentPart; value: string; }[]; end: { part: SegmentPart; value: string; }[]; }` | The date field segment contents |
| `isInvalid` | `boolean` | Value if the input is invalid |
**Methods**
| Method | Type | Description |
| --- | --- | --- |
| `setFocusedElement` | `(el: HTMLElement) => void` | |
[DateRangeFieldRoot.vue source](https://github.com/vinicunca/akar/blob/v2.0.20/packages/core/src/DateRangeField/DateRangeFieldRoot.vue)
| Data attribute | Value |
| --- | --- |
| `[data-readonly]` | Present when readonly |
| `[data-disabled]` | Present when disabled |
| `[data-invalid]` | Present when invalid |
### Input
Contains the date field segments
**Props**
| Prop | Default | Type | Description |
| --- | --- | --- | --- |
| `as` | `"div"` | `AsTag \| Component` | The element or component this component should render as. Can be overwritten by `asChild`. |
| `asChild` | | `boolean` | Change the default rendered element for the one passed as a child, merging their props and behavior.
Read our [Composition](/akar/guides/composition) guide for more details. |
| `part*` | | `"day" \| "month" \| "year" \| "hour" \| "minute" \| "second" \| "dayPeriod" \| "literal" \| "timeZoneName"` | The part of the date to render |
| `type*` | | `"start" \| "end"` | The type of field to render (start or end) |
[DateRangeFieldInput.vue source](https://github.com/vinicunca/akar/blob/v2.0.20/packages/core/src/DateRangeField/DateRangeFieldInput.vue)
| Data attribute | Value |
| --- | --- |
| `[data-disabled]` | Present when disabled |
| `[data-invalid]` | Present when invalid |
| `[data-placeholder]` | Present when no value is set |
## Accessibility
### Keyboard Interactions
| Key | Description |
| --- | --- |
| Tab | When focus moves onto the date field, focuses the first segment. |
| ArrowLeft / ArrowRight | Navigates between the date field segments. |
| ArrowUp / ArrowDown | Increments/changes the value of the segment. |
| 0-9 | When the focus is on a numeric `DateFieldInput`, it types in the number and focuses the next segment if the next input would result in an invalid value. |
| Backspace | Deletes a digit from the focused numeric segments. |
| A / P | When the focus is on the day period, it sets it to AM or PM. |
---
- [GitHub](https://github.com/vinicunca/akar/blob/v2.0.20/packages/core/src/DateRangeField)
- [npm](https://www.npmjs.com/package/akar)
# Date Range Picker
> Facilitates the selection of date ranges through an input and calendar-based interface.
`````vue [index.vue]
If omitted, inherits globally from `ConfigProvider` or assumes LTR (left-to-right) reading mode. |
| `disabled` | `false` | `boolean` | Whether or not the date field is disabled |
| `fixedDate` | | `"start" \| "end"` | Which part of the range should be fixed |
| `fixedWeeks` | `false` | `boolean` | Whether or not to always display 6 weeks in the calendar |
| `granularity` | | `"day" \| "hour" \| "minute" \| "second"` | The granularity to use for formatting times. Defaults to day if a CalendarDate is provided, otherwise defaults to minute. The field will render segments for each part of the date up to and including the specified granularity |
| `hideTimeZone` | | `boolean` | Whether or not to hide the time zone segment of the field |
| `hourCycle` | | `12 \| 24` | The hour cycle used for formatting times. Defaults to the local preference |
| `id` | | `string` | Id of the element |
| `isDateDisabled` | | `Matcher` | A function that returns whether or not a date is disabled |
| `isDateHighlightable` | | `Matcher` | A function that returns whether or not a date is hightable |
| `isDateUnavailable` | | `Matcher` | A function that returns whether or not a date is unavailable |
| `locale` | | `string` | The locale to use for formatting dates |
| `maximumDays` | | `number` | The maximum number of days that can be selected in a range |
| `maxValue` | | `DateValue` | The maximum date that can be selected |
| `minValue` | | `DateValue` | The minimum date that can be selected |
| `modal` | `false` | `boolean` | The modality of the popover. When set to true, interaction with outside elements will be disabled and only popover content will be visible to screen readers. |
| `modelValue` | | `DateRange \| null` | The controlled value of the field. Can be bound as `v-model`. |
| `name` | | `string` | The name of the field. Submitted with its owning form as part of a name/value pair. |
| `numberOfMonths` | `1` | `number` | The number of months to display at once |
| `open` | | `boolean` | The controlled open state of the popover. |
| `pagedNavigation` | `false` | `boolean` | This property causes the previous and next buttons to navigate by the number of months displayed at once, rather than one month |
| `placeholder` | | `DateValue` | The placeholder date, which is used to determine what month to display when no date is selected. This updates as the user navigates the calendar and can be used to programmatically control the calendar view |
| `preventDeselect` | `false` | `boolean` | Whether or not to prevent the user from deselecting a date without selecting another date first |
| `readonly` | `false` | `boolean` | Whether or not the date field is readonly |
| `required` | | `boolean` | When `true`, indicates that the user must set the value before the owning form can be submitted. |
| `step` | | `DateStep` | The stepping interval for the time fields. Defaults to `1`. |
| `weekdayFormat` | `"narrow"` | `"narrow" \| "short" \| "long"` | The format to use for the weekday strings provided via the weekdays slot prop |
| `weekStartsOn` | | `0 \| 1 \| 2 \| 3 \| 4 \| 5 \| 6` | The day of the week to start the calendar on |
**Events**
| Event | Payload | Description |
| --- | --- | --- |
| `update:modelValue` | `date: DateRange` | Event handler called whenever the model value changes |
| `update:open` | `value: boolean` | Event handler called when the open state of the popover changes. |
| `update:placeholder` | `date: DateValue` | Event handler called whenever the placeholder value changes |
| `update:startValue` | `date: DateValue` | Event handler called whenever the start value changes |
**Slots**
| Slot | Payload | Description |
| --- | --- | --- |
| `modelValue` | `DateRange` | |
| `open` | `boolean` | |
[DateRangePickerRoot.vue source](https://github.com/vinicunca/akar/blob/v2.0.20/packages/core/src/DateRangePicker/DateRangePickerRoot.vue)
### Field
Contains the date picker date field segments and trigger
**Slots**
| Slot | Payload | Description |
| --- | --- | --- |
| `segments` | `{ start: { part: SegmentPart; value: string; }[]; end: { part: SegmentPart; value: string; }[]; }` | |
| `modelValue` | `DateRange \| null` | |
[DateRangePickerField.vue source](https://github.com/vinicunca/akar/blob/v2.0.20/packages/core/src/DateRangePicker/DateRangePickerField.vue)
| Data attribute | Value |
| --- | --- |
| `[data-readonly]` | Present when readonly |
| `[data-disabled]` | Present when disabled |
| `[data-invalid]` | Present when invalid |
### Input
Contains the date picker date field segments
**Props**
| Prop | Default | Type | Description |
| --- | --- | --- | --- |
| `as` | `"div"` | `AsTag \| Component` | The element or component this component should render as. Can be overwritten by `asChild`. |
| `asChild` | | `boolean` | Change the default rendered element for the one passed as a child, merging their props and behavior.
Read our [Composition](/akar/guides/composition) guide for more details. |
| `part*` | | `"day" \| "month" \| "year" \| "hour" \| "minute" \| "second" \| "dayPeriod" \| "literal" \| "timeZoneName"` | The part of the date to render |
| `type*` | | `"start" \| "end"` | The type of field to render (start or end) |
[DateRangePickerInput.vue source](https://github.com/vinicunca/akar/blob/v2.0.20/packages/core/src/DateRangePicker/DateRangePickerInput.vue)
| Data attribute | Value |
| --- | --- |
| `[data-disabled]` | Present when disabled |
| `[data-invalid]` | Present when invalid |
| `[data-placeholder]` | Present when no value is set |
### Trigger
The button that toggles the popover. By default, the `DateRangePickerContent` will position itself against the trigger.
**Props**
| Prop | Default | Type | Description |
| --- | --- | --- | --- |
| `as` | `"div"` | `AsTag \| Component` | The element or component this component should render as. Can be overwritten by `asChild`. |
| `asChild` | | `boolean` | Change the default rendered element for the one passed as a child, merging their props and behavior.
Read our [Composition](/akar/guides/composition) guide for more details. |
[DateRangePickerTrigger.vue source](https://github.com/vinicunca/akar/blob/v2.0.20/packages/core/src/DateRangePicker/DateRangePickerTrigger.vue)
### Content
The component that pops out when the popover is open.
**Props**
| Prop | Default | Type | Description |
| --- | --- | --- | --- |
| `align` | `"center"` | `"start" \| "center" \| "end"` | The preferred alignment against the trigger.
May change when collisions occur. |
| `alignFlip` | `true` | `boolean` | Flip alignment when colliding with boundary.
May only occur when `prioritizePosition` is true. |
| `alignOffset` | `0` | `number` | An offset in pixels from the `start` or `end` alignment options. |
| `arrowPadding` | `0` | `number` | The padding between the arrow and the edges of the content.
If your content has border-radius, this will prevent it from
overflowing the corners. |
| `as` | `"div"` | `AsTag \| Component` | The element or component this component should render as. Can be overwritten by `asChild`. |
| `asChild` | | `boolean` | Change the default rendered element for the one passed as a child, merging their props and behavior.
Read our [Composition](/akar/guides/composition) guide for more details. |
| `avoidCollisions` | `true` | `boolean` | When `true`, overrides the side and align preferences
to prevent collisions with boundary edges. |
| `collisionBoundary` | `[]` | `Element \| (Element \| null)[] \| null` | The element used as the collision boundary. By default
this is the viewport, though you can provide additional
element(s) to be included in this check. |
| `collisionPadding` | `0` | `number \| Partial
detection should occur. Accepts a number (same for all sides),
or a partial padding object, for example: { top: 20, left: 20 }. |
| `dir` | | `"ltr" \| "rtl"` | The reading direction of the popper content when applicable.
If omitted, inherits globally from `ConfigProvider` or assumes LTR (left-to-right) reading mode. |
| `disableOutsidePointerEvents` | | `boolean` | When `true`, hover/focus/click interactions will be disabled on elements outside
the `DismissableLayer`. Users will need to click twice on outside elements to
interact with them: once to close the `DismissableLayer`, and again to trigger the element. |
| `disableUpdateOnLayoutShift` | `false` | `boolean` | Whether to disable the update position for the content when the layout shifted. |
| `forceMount` | | `boolean` | Used to force mounting when more control is needed. Useful when
controlling animation with Vue animation libraries. |
| `hideShiftedArrow` | `true` | `boolean` | When `true`, hides the arrow when it cannot be centered
to the reference element. |
| `hideWhenDetached` | `false` | `boolean` | Whether to hide the content when the trigger becomes fully occluded. |
| `memoDependencies` | | `unknown[]` | Reactive dependencies that should invalidate the memoized content subtree. |
| `portal` | | `PopoverPortalProps` | Props to control the portal wrapped around the content. |
| `positionStrategy` | | `"fixed" \| "absolute"` | The type of CSS position property to use. |
| `prioritizePosition` | `false` | `boolean` | Force content to be position within the viewport.
Might overlap the reference element, which may not be desired. |
| `reference` | | `ReferenceElement` | The custom element or virtual element that will be set as the reference
to position the floating element.
If provided, it will replace the default anchor element. |
| `side` | `"bottom"` | `"top" \| "right" \| "bottom" \| "left"` | The preferred side of the trigger to render against when open.
Will be reversed when collisions occur and avoidCollisions
is enabled. |
| `sideFlip` | `true` | `boolean` | Flip to the opposite side when colliding with boundary. |
| `sideOffset` | `0` | `number` | The distance in pixels from the trigger. |
| `sticky` | `"partial"` | `"partial" \| "always"` | The sticky behavior on the align axis. `partial` will keep the
content in the boundary as long as the trigger is at least partially
in the boundary whilst "always" will keep the content in the boundary
regardless. |
| `updatePositionStrategy` | `'optimized'` | `"always" \| "optimized"` | Strategy to update the position of the floating element on every animation frame. |
**Events**
| Event | Payload | Description |
| --- | --- | --- |
| `closeAutoFocus` | `event: Event` | Event handler called when auto-focusing on close.
Can be prevented. |
| `escapeKeyDown` | `event: KeyboardEvent` | Event handler called when the escape key is down.
Can be prevented. |
| `focusOutside` | `event: FocusOutsideEvent` | Event handler called when the focus moves outside of the `DismissableLayer`.
Can be prevented. |
| `interactOutside` | `event: PointerDownOutsideEvent \| FocusOutsideEvent` | Event handler called when an interaction happens outside the `DismissableLayer`.
Specifically, when a `pointerdown` event happens outside or focus moves outside of it.
Can be prevented. |
| `openAutoFocus` | `event: Event` | Event handler called when auto-focusing on open.
Can be prevented. |
| `pointerDownOutside` | `event: PointerDownOutsideEvent` | Event handler called when a `pointerdown` event happens outside of the `DismissableLayer`.
Can be prevented. |
[DateRangePickerContent.vue source](https://github.com/vinicunca/akar/blob/v2.0.20/packages/core/src/DateRangePicker/DateRangePickerContent.vue)
### Arrow
An optional arrow element to render alongside the popover. This can be used to help visually link the anchor with the `DateRangePickerContent`. Must be rendered inside `DateRangePickerContent`.
**Props**
| Prop | Default | Type | Description |
| --- | --- | --- | --- |
| `as` | `"div"` | `AsTag \| Component` | The element or component this component should render as. Can be overwritten by `asChild`. |
| `asChild` | | `boolean` | Change the default rendered element for the one passed as a child, merging their props and behavior.
Read our [Composition](/akar/guides/composition) guide for more details. |
| `height` | `5` | `number` | The height of the arrow in pixels. |
| `rounded` | `false` | `boolean` | When `true`, render the rounded version of arrow. Do not work with `as`/`asChild` |
| `width` | `10` | `number` | The width of the arrow in pixels. |
[DateRangePickerArrow.vue source](https://github.com/vinicunca/akar/blob/v2.0.20/packages/core/src/DateRangePicker/DateRangePickerArrow.vue)
### Close
The button that closes an open date picker.
**Props**
| Prop | Default | Type | Description |
| --- | --- | --- | --- |
| `as` | `"div"` | `AsTag \| Component` | The element or component this component should render as. Can be overwritten by `asChild`. |
| `asChild` | | `boolean` | Change the default rendered element for the one passed as a child, merging their props and behavior.
Read our [Composition](/akar/guides/composition) guide for more details. |
[DateRangePickerClose.vue source](https://github.com/vinicunca/akar/blob/v2.0.20/packages/core/src/DateRangePicker/DateRangePickerClose.vue)
### Anchor
An optional element to position the `DateRangePickerContent` against. If this part is not used, the content will position alongside the `DateRangePickerTrigger`.
**Props**
| Prop | Default | Type | Description |
| --- | --- | --- | --- |
| `as` | `"div"` | `AsTag \| Component` | The element or component this component should render as. Can be overwritten by `asChild`. |
| `asChild` | | `boolean` | Change the default rendered element for the one passed as a child, merging their props and behavior.
Read our [Composition](/akar/guides/composition) guide for more details. |
| `reference` | | `ReferenceElement` | The reference (or anchor) element that is being referred to for positioning.
If not provided will use the current component as anchor. |
[DateRangePickerAnchor.vue source](https://github.com/vinicunca/akar/blob/v2.0.20/packages/core/src/DateRangePicker/DateRangePickerAnchor.vue)
### Calendar
Contains all the parts of a calendar
**Slots**
| Slot | Payload | Description |
| --- | --- | --- |
| `date` | `DateValue` | |
| `grid` | `Grid
Read our [Composition](/akar/guides/composition) guide for more details. |
[DateRangePickerHeader.vue source](https://github.com/vinicunca/akar/blob/v2.0.20/packages/core/src/DateRangePicker/DateRangePickerHeader.vue)
### Prev Button
Calendar navigation button. It navigates the calendar one month/year/decade in the past based on the current calendar view.
**Props**
| Prop | Default | Type | Description |
| --- | --- | --- | --- |
| `as` | `"div"` | `AsTag \| Component` | The element or component this component should render as. Can be overwritten by `asChild`. |
| `asChild` | | `boolean` | Change the default rendered element for the one passed as a child, merging their props and behavior.
Read our [Composition](/akar/guides/composition) guide for more details. |
| `prevPage` | | `((placeholder: DateValue) => DateValue)` | The function to be used for the prev page. Overwrites the `prevPage` function set on the `RangeCalendarRoot`. |
**Slots**
| Slot | Payload | Description |
| --- | --- | --- |
| `disabled` | `boolean` | Current disable state |
[DateRangePickerPrev.vue source](https://github.com/vinicunca/akar/blob/v2.0.20/packages/core/src/DateRangePicker/DateRangePickerPrev.vue)
| Data attribute | Value |
| --- | --- |
| `[data-disabled]` | Present when disabled |
### Next Button
Calendar navigation button. It navigates the calendar one month/year/decade in the future based on the current calendar view.
**Props**
| Prop | Default | Type | Description |
| --- | --- | --- | --- |
| `as` | `"div"` | `AsTag \| Component` | The element or component this component should render as. Can be overwritten by `asChild`. |
| `asChild` | | `boolean` | Change the default rendered element for the one passed as a child, merging their props and behavior.
Read our [Composition](/akar/guides/composition) guide for more details. |
| `nextPage` | | `((placeholder: DateValue) => DateValue)` | The function to be used for the next page. Overwrites the `nextPage` function set on the `RangeCalendarRoot`. |
**Slots**
| Slot | Payload | Description |
| --- | --- | --- |
| `disabled` | `boolean` | Current disable state |
[DateRangePickerNext.vue source](https://github.com/vinicunca/akar/blob/v2.0.20/packages/core/src/DateRangePicker/DateRangePickerNext.vue)
| Data attribute | Value |
| --- | --- |
| `[data-disabled]` | Present when disabled |
### Heading
Heading for displaying the current month and year
**Props**
| Prop | Default | Type | Description |
| --- | --- | --- | --- |
| `as` | `"div"` | `AsTag \| Component` | The element or component this component should render as. Can be overwritten by `asChild`. |
| `asChild` | | `boolean` | Change the default rendered element for the one passed as a child, merging their props and behavior.
Read our [Composition](/akar/guides/composition) guide for more details. |
**Slots**
| Slot | Payload | Description |
| --- | --- | --- |
| `headingValue` | `string` | Current month and year |
[DateRangePickerHeading.vue source](https://github.com/vinicunca/akar/blob/v2.0.20/packages/core/src/DateRangePicker/DateRangePickerHeading.vue)
| Data attribute | Value |
| --- | --- |
| `[data-disabled]` | Present when disabled |
### Grid
Container for wrapping the calendar grid.
**Props**
| Prop | Default | Type | Description |
| --- | --- | --- | --- |
| `as` | `"div"` | `AsTag \| Component` | The element or component this component should render as. Can be overwritten by `asChild`. |
| `asChild` | | `boolean` | Change the default rendered element for the one passed as a child, merging their props and behavior.
Read our [Composition](/akar/guides/composition) guide for more details. |
[DateRangePickerGrid.vue source](https://github.com/vinicunca/akar/blob/v2.0.20/packages/core/src/DateRangePicker/DateRangePickerGrid.vue)
| Data attribute | Value |
| --- | --- |
| `[data-readonly]` | Present when readonly |
| `[data-disabled]` | Present when disabled |
### Grid Head
Container for wrapping the grid head.
**Props**
| Prop | Default | Type | Description |
| --- | --- | --- | --- |
| `as` | `"div"` | `AsTag \| Component` | The element or component this component should render as. Can be overwritten by `asChild`. |
| `asChild` | | `boolean` | Change the default rendered element for the one passed as a child, merging their props and behavior.
Read our [Composition](/akar/guides/composition) guide for more details. |
[DateRangePickerGridHead.vue source](https://github.com/vinicunca/akar/blob/v2.0.20/packages/core/src/DateRangePicker/DateRangePickerGridHead.vue)
### Grid Body
Container for wrapping the grid body.
**Props**
| Prop | Default | Type | Description |
| --- | --- | --- | --- |
| `as` | `"div"` | `AsTag \| Component` | The element or component this component should render as. Can be overwritten by `asChild`. |
| `asChild` | | `boolean` | Change the default rendered element for the one passed as a child, merging their props and behavior.
Read our [Composition](/akar/guides/composition) guide for more details. |
[DateRangePickerGridBody.vue source](https://github.com/vinicunca/akar/blob/v2.0.20/packages/core/src/DateRangePicker/DateRangePickerGridBody.vue)
### Grid Row
Container for wrapping the grid row.
**Props**
| Prop | Default | Type | Description |
| --- | --- | --- | --- |
| `as` | `"div"` | `AsTag \| Component` | The element or component this component should render as. Can be overwritten by `asChild`. |
| `asChild` | | `boolean` | Change the default rendered element for the one passed as a child, merging their props and behavior.
Read our [Composition](/akar/guides/composition) guide for more details. |
[DateRangePickerGridRow.vue source](https://github.com/vinicunca/akar/blob/v2.0.20/packages/core/src/DateRangePicker/DateRangePickerGridRow.vue)
### Head Cell
Container for wrapping the head cell. Used for displaying the week days.
**Props**
| Prop | Default | Type | Description |
| --- | --- | --- | --- |
| `as` | `"div"` | `AsTag \| Component` | The element or component this component should render as. Can be overwritten by `asChild`. |
| `asChild` | | `boolean` | Change the default rendered element for the one passed as a child, merging their props and behavior.
Read our [Composition](/akar/guides/composition) guide for more details. |
[DateRangePickerHeadCell.vue source](https://github.com/vinicunca/akar/blob/v2.0.20/packages/core/src/DateRangePicker/DateRangePickerHeadCell.vue)
### Cell
Container for wrapping the calendar cells.
**Props**
| Prop | Default | Type | Description |
| --- | --- | --- | --- |
| `as` | `"div"` | `AsTag \| Component` | The element or component this component should render as. Can be overwritten by `asChild`. |
| `asChild` | | `boolean` | Change the default rendered element for the one passed as a child, merging their props and behavior.
Read our [Composition](/akar/guides/composition) guide for more details. |
| `date*` | | `DateValue` | |
[DateRangePickerCell.vue source](https://github.com/vinicunca/akar/blob/v2.0.20/packages/core/src/DateRangePicker/DateRangePickerCell.vue)
| Data attribute | Value |
| --- | --- |
| `[data-disabled]` | Present when disabled |
### Cell Trigger
Interactable container for displaying the cell dates. Clicking it selects the date.
**Props**
| Prop | Default | Type | Description |
| --- | --- | --- | --- |
| `as` | `"div"` | `AsTag \| Component` | The element or component this component should render as. Can be overwritten by `asChild`. |
| `asChild` | | `boolean` | Change the default rendered element for the one passed as a child, merging their props and behavior.
Read our [Composition](/akar/guides/composition) guide for more details. |
| `day*` | | `DateValue` | |
| `month*` | | `DateValue` | |
**Slots**
| Slot | Payload | Description |
| --- | --- | --- |
| `dayValue` | `string` | Current day |
| `disabled` | `boolean` | Current disable state |
| `selected` | `boolean` | Current selected state |
| `today` | `boolean` | Current today state |
| `outsideView` | `boolean` | Current outside view state |
| `outsideVisibleView` | `boolean` | Current outside visible view state |
| `unavailable` | `boolean` | Current unavailable state |
| `highlighted` | `boolean` | Current highlighted state |
| `highlightedStart` | `boolean` | Current highlighted start state |
| `highlightedEnd` | `boolean` | Current highlighted end state |
| `selectionStart` | `boolean` | Current selection start state |
| `selectionEnd` | `boolean` | Current selection end state |
[DateRangePickerCellTrigger.vue source](https://github.com/vinicunca/akar/blob/v2.0.20/packages/core/src/DateRangePicker/DateRangePickerCellTrigger.vue)
| Data attribute | Value |
| --- | --- |
| `[data-selected]` | Present when selected |
| `[data-value]` | The ISO string value of the date. |
| `[data-disabled]` | Present when disabled |
| `[data-unavailable]` | Present when unavailable |
| `[data-today]` | Present when today |
| `[data-outside-view]` | Present when the date is outside the current month it is displayed in. |
| `[data-outside-visible-view]` | Present when the date is outside the months that are visible on the calendar. |
| `[data-selection-start]` | Present when the date is the start of the selection. |
| `[data-selection-end]` | Present when the date is the end of the selection. |
| `[data-highlighted]` | Present when the date is highlighted by the user as they select a range. |
| `[data-highlighted-start]` | Present when the date is the start of the range that is highlighted by the user. |
| `[data-highlighted-end]` | Present when the date is the end of the range that is highlighted by the user. |
| `[data-focused]` | Present when focused |
## Accessibility
### Keyboard Interactions
| Key | Description |
| --- | --- |
| Tab | When focus moves onto the date field, focuses the first segment. |
| Space | When the focus is on either `DateRangePickerNext` or `DateRangePickerPrev`, it navigates the calendar. Otherwise, it selects the date. If the focus is on `DateRangePickerTrigger`, it opens/closes the popover. |
| Enter | When the focus is on either `DateRangePickerNext` or `DateRangePickerPrev`, it navigates the calendar. Otherwise, it selects the date. If the focus is on `DateRangePickerTrigger`, it opens/closes the popover. |
| ArrowLeft / ArrowRight | Navigates between the date field segments. If the focus is on the `DateRangePickerCalendar`, it navigates between the dates. |
| ArrowUp / ArrowDown | Increments/changes the value of the segment. If the focus is on the `DateRangePickerCalendar`, it navigates between the dates. |
| 0-9 | When the focus is on a numeric `DateRangePickerInput`, it types in the number and focuses the next segment if the next input would result in an invalid value. |
| Backspace | Deletes a digit from the focused numeric segments. |
| A / P | When the focus is on the day period, it sets it to AM or PM. |
---
- [GitHub](https://github.com/vinicunca/akar/blob/v2.0.20/packages/core/src/DateRangePicker)
- [npm](https://www.npmjs.com/package/akar)
# Dialog
> A window overlaid on either the primary window or another dialog window, rendering the content underneath inert.
```vue [index.vue]
interaction with outside elements will be disabled and only dialog content will be visible to screen readers. |
| `open` | | `boolean` | The controlled open state of the dialog. Can be binded as `v-model:open`. |
| `unmountOnHide` | `true` | `boolean` | When set to `false`, the dialog content will not be unmounted when closed, but instead hidden with CSS.
Useful for SEO or when you want to improve performance by not remounting the component on every open. |
**Events**
| Event | Payload | Description |
| --- | --- | --- |
| `update:open` | `value: boolean` | Event handler called when the open state of the dialog changes. |
**Slots**
| Slot | Payload | Description |
| --- | --- | --- |
| `open` | `boolean` | Current open state |
| `close` | `(): void` | Close the dialog |
[DialogRoot.vue source](https://github.com/vinicunca/akar/blob/v2.0.20/packages/core/src/Dialog/DialogRoot.vue)
### Trigger
The button that opens the dialog
**Props**
| Prop | Default | Type | Description |
| --- | --- | --- | --- |
| `as` | `"button"` | `AsTag \| Component` | The element or component this component should render as. Can be overwritten by `asChild`. |
| `asChild` | | `boolean` | Change the default rendered element for the one passed as a child, merging their props and behavior.
Read our [Composition](https://vinicunca.dev/akar/guides/composition) guide for more details. |
[DialogTrigger.vue source](https://github.com/vinicunca/akar/blob/v2.0.20/packages/core/src/Dialog/DialogTrigger.vue)
| Data attribute | Value |
| --- | --- |
| `[data-state]` | "open" \\| "closed" |
### Portal
When used, portals your overlay and content parts into the `body`.
**Props**
| Prop | Default | Type | Description |
| --- | --- | --- | --- |
| `defer` | | `boolean` | Defer the resolving of a Teleport target until other parts of the
application have mounted (requires Vue 3.5.0+)
[reference](https://vuejs.org/guide/built-ins/teleport.html#deferred-teleport) |
| `disabled` | | `boolean` | Disable teleport and render the component inline
[reference](https://vuejs.org/guide/built-ins/teleport.html#disabling-teleport) |
| `forceMount` | | `boolean` | Used to force mounting when more control is needed. Useful when
controlling animation with Vue animation libraries. |
| `to` | | `string \| HTMLElement` | Vue native teleport component prop `:to`
[reference](https://vuejs.org/guide/built-ins/teleport.html#basic-usage) |
[DialogPortal.vue source](https://github.com/vinicunca/akar/blob/v2.0.20/packages/core/src/Dialog/DialogPortal.vue)
### Overlay
A layer that covers the inert portion of the view when the dialog is open.
> [!NOTE]
>
> Defer mounting with `forceMount` / [`Presence`](https://vinicunca.dev/akar/utilities/presence). See the [animation guide](https://vinicunca.dev/akar/guides/animation).
**Props**
| Prop | Default | Type | Description |
| --- | --- | --- | --- |
| `as` | `"div"` | `AsTag \| Component` | The element or component this component should render as. Can be overwritten by `asChild`. |
| `asChild` | | `boolean` | Change the default rendered element for the one passed as a child, merging their props and behavior.
Read our [Composition](https://vinicunca.dev/akar/guides/composition) guide for more details. |
| `forceMount` | | `boolean` | Used to force mounting when more control is needed. Useful when
controlling animation with Vue animation libraries. |
[DialogOverlay.vue source](https://github.com/vinicunca/akar/blob/v2.0.20/packages/core/src/Dialog/DialogOverlay.vue)
| Data attribute | Value |
| --- | --- |
| `[data-state]` | "open" \\| "closed" |
### Content
Contains content to be rendered in the open dialog
> [!NOTE]
>
> Defer mounting with `forceMount` / [`Presence`](https://vinicunca.dev/akar/utilities/presence). See the [animation guide](https://vinicunca.dev/akar/guides/animation).
**Props**
| Prop | Default | Type | Description |
| --- | --- | --- | --- |
| `as` | `"div"` | `AsTag \| Component` | The element or component this component should render as. Can be overwritten by `asChild`. |
| `asChild` | | `boolean` | Change the default rendered element for the one passed as a child, merging their props and behavior.
Read our [Composition](https://vinicunca.dev/akar/guides/composition) guide for more details. |
| `disableOutsidePointerEvents` | | `boolean` | When `true`, hover/focus/click interactions will be disabled on elements outside
the `DismissableLayer`. Users will need to click twice on outside elements to
interact with them: once to close the `DismissableLayer`, and again to trigger the element. |
| `forceMount` | | `boolean` | Used to force mounting when more control is needed. Useful when
controlling animation with Vue animation libraries. |
**Events**
| Event | Payload | Description |
| --- | --- | --- |
| `closeAutoFocus` | `event: Event` | Event handler called when auto-focusing on close.
Can be prevented. |
| `escapeKeyDown` | `event: KeyboardEvent` | Event handler called when the escape key is down.
Can be prevented. |
| `focusOutside` | `event: FocusOutsideEvent` | Event handler called when the focus moves outside of the `DismissableLayer`.
Can be prevented. |
| `interactOutside` | `event: PointerDownOutsideEvent \| FocusOutsideEvent` | Event handler called when an interaction happens outside the `DismissableLayer`.
Specifically, when a `pointerdown` event happens outside or focus moves outside of it.
Can be prevented. |
| `openAutoFocus` | `event: Event` | Event handler called when auto-focusing on open.
Can be prevented. |
| `pointerDownOutside` | `event: PointerDownOutsideEvent` | Event handler called when a `pointerdown` event happens outside of the `DismissableLayer`.
Can be prevented. |
[DialogContent.vue source](https://github.com/vinicunca/akar/blob/v2.0.20/packages/core/src/Dialog/DialogContent.vue)
| Data attribute | Value |
| --- | --- |
| `[data-state]` | "open" \\| "closed" |
### Close
The button that closes the dialog
**Props**
| Prop | Default | Type | Description |
| --- | --- | --- | --- |
| `as` | `"button"` | `AsTag \| Component` | The element or component this component should render as. Can be overwritten by `asChild`. |
| `asChild` | | `boolean` | Change the default rendered element for the one passed as a child, merging their props and behavior.
Read our [Composition](https://vinicunca.dev/akar/guides/composition) guide for more details. |
[DialogClose.vue source](https://github.com/vinicunca/akar/blob/v2.0.20/packages/core/src/Dialog/DialogClose.vue)
### Title
An accessible title to be announced when the dialog is opened.
If you want to hide the title, wrap it inside our Visually Hidden utility like this `
Read our [Composition](https://vinicunca.dev/akar/guides/composition) guide for more details. |
[DialogTitle.vue source](https://github.com/vinicunca/akar/blob/v2.0.20/packages/core/src/Dialog/DialogTitle.vue)
### Description
An optional accessible description to be announced when the dialog is opened.
If you want to hide the description, wrap it inside our Visually Hidden utility like this `
Read our [Composition](https://vinicunca.dev/akar/guides/composition) guide for more details. |
[DialogDescription.vue source](https://github.com/vinicunca/akar/blob/v2.0.20/packages/core/src/Dialog/DialogDescription.vue)
## Examples
### Nested dialog
You can nest multiple layers of dialogs.
```vue [index.vue]
- `true` (default): modal with focus trap, scroll lock, and outside-press dismiss
- `'trap-focus'`: traps focus but allows outside pointer events (non-modal side panels)
- `false`: non-modal |
| `open` | | `boolean` | v-model:open |
| `snapPoint` | | `null \| string \| number` | v-model:snapPoint |
| `snapPoints` | | `DrawerSnapPoint[]` | Preset snap positions (fractions 0-1, pixels >1, or '148px'/'30rem' strings) |
| `snapToSequentialPoints` | `false` | `boolean` | When true, snaps to the next sequential snap point (one step at a time).
When false, snaps to the nearest snap point by distance. |
| `swipeDirection` | `"down"` | `"right" \| "left" \| "down" \| "up"` | Direction to swipe to dismiss. |
**Events**
| Event | Payload | Description |
| --- | --- | --- |
| `update:open` | `value: boolean, details?: DrawerOpenChangeDetails` | |
| `update:openComplete` | `value: boolean` | |
| `update:snapPoint` | `value: DrawerSnapPoint \| null` | |
**Slots**
| Slot | Payload | Description |
| --- | --- | --- |
| `open` | `boolean` | |
| `close` | `(): void` | |
[DrawerRoot.vue source](https://github.com/vinicunca/akar/blob/v2.0.20/packages/core/src/Drawer/DrawerRoot.vue)
### Trigger
The button that opens the drawer.
**Props**
| Prop | Default | Type | Description |
| --- | --- | --- | --- |
| `as` | `"button"` | `AsTag \| Component` | The element or component this component should render as. Can be overwritten by `asChild`. |
| `asChild` | | `boolean` | Change the default rendered element for the one passed as a child, merging their props and behavior.
Read our [Composition](/akar/guides/composition) guide for more details. |
[DrawerTrigger.vue source](https://github.com/vinicunca/akar/blob/v2.0.20/packages/core/src/Drawer/DrawerTrigger.vue)
| Data attribute | Value |
| --- | --- |
| `[data-state]` | "open" \\| "closed" |
### Portal
When used, portals your overlay and content parts into the `body`.
**Props**
| Prop | Default | Type | Description |
| --- | --- | --- | --- |
| `defer` | | `boolean` | Defer the resolving of a Teleport target until other parts of the
application have mounted (requires Vue 3.5.0+)
[reference](https://vuejs.org/guide/built-ins/teleport.html#deferred-teleport) |
| `disabled` | | `boolean` | Disable teleport and render the component inline
[reference](https://vuejs.org/guide/built-ins/teleport.html#disabling-teleport) |
| `forceMount` | | `boolean` | Used to force mounting when more control is needed. Useful when
controlling animation with Vue animation libraries. |
| `to` | | `string \| HTMLElement` | Vue native teleport component prop `:to`
[reference](https://vuejs.org/guide/built-ins/teleport.html#basic-usage) |
[DrawerPortal.vue source](https://github.com/vinicunca/akar/blob/v2.0.20/packages/core/src/Drawer/DrawerPortal.vue)
### Overlay
A layer that covers the inert portion of the view when the drawer is open. Only
rendered when the drawer is `modal`.
> [!NOTE]
>
> Defer mounting with `forceMount` / [`Presence`](https://vinicunca.dev/akar/utilities/presence). See the [animation guide](https://vinicunca.dev/akar/guides/animation).
**Props**
| Prop | Default | Type | Description |
| --- | --- | --- | --- |
| `as` | `"div"` | `AsTag \| Component` | The element or component this component should render as. Can be overwritten by `asChild`. |
| `asChild` | | `boolean` | Change the default rendered element for the one passed as a child, merging their props and behavior.
Read our [Composition](/akar/guides/composition) guide for more details. |
| `forceMount` | `false` | `boolean` | Keep mounted for animation control. |
| `forceRender` | `false` | `boolean` | Render even when inside a nested drawer. |
[DrawerOverlay.vue source](https://github.com/vinicunca/akar/blob/v2.0.20/packages/core/src/Drawer/DrawerOverlay.vue)
| Data attribute | Value |
| --- | --- |
| `[data-state]` | "open" \\| "closed" |
| `[data-swipe-direction]` | "up" \\| "down" \\| "left" \\| "right" |
| `[data-swiping]` | "Present when the drawer is being dragged" |
### Content
Contains the content to be rendered in the open drawer. Owns the swipe gesture
and exposes the drag offset through CSS custom properties (see [Animating the
drawer](#animating-the-drawer)). Also aliased as `DrawerPopup` for Base UI parity.
> [!NOTE]
>
> Defer mounting with `forceMount` / [`Presence`](https://vinicunca.dev/akar/utilities/presence). See the [animation guide](https://vinicunca.dev/akar/guides/animation).
**Props**
| Prop | Default | Type | Description |
| --- | --- | --- | --- |
| `as` | `"div"` | `AsTag \| Component` | The element or component this component should render as. Can be overwritten by `asChild`. |
| `asChild` | | `boolean` | Change the default rendered element for the one passed as a child, merging their props and behavior.
Read our [Composition](/akar/guides/composition) guide for more details. |
| `disableOutsidePointerEvents` | | `boolean` | When `true`, hover/focus/click interactions will be disabled on elements outside
the `DismissableLayer`. Users will need to click twice on outside elements to
interact with them: once to close the `DismissableLayer`, and again to trigger the element. |
| `finalFocus` | `true` | `boolean \| HTMLElement \| null` | Final focus target when the drawer closes.
- `true` / default: focus the trigger
- `false`: do not restore focus
- element ref: focus that specific element |
| `forceMount` | | `boolean` | |
| `initialFocus` | `true` | `boolean \| HTMLElement \| null` | Initial focus target when the drawer opens.
- `true` / default: focus the first focusable element inside
- `false`: do not focus anything
- element ref: focus that specific element |
**Events**
| Event | Payload | Description |
| --- | --- | --- |
| `closeAutoFocus` | `event: Event` | |
| `escapeKeyDown` | `event: KeyboardEvent` | Event handler called when the escape key is down.
Can be prevented. |
| `focusOutside` | `event: FocusOutsideEvent` | Event handler called when the focus moves outside of the `DismissableLayer`.
Can be prevented. |
| `interactOutside` | `event: PointerDownOutsideEvent \| FocusOutsideEvent` | Event handler called when an interaction happens outside the `DismissableLayer`.
Specifically, when a `pointerdown` event happens outside or focus moves outside of it.
Can be prevented. |
| `openAutoFocus` | `event: Event` | |
| `pointerDownOutside` | `event: PointerDownOutsideEvent` | Event handler called when a `pointerdown` event happens outside of the `DismissableLayer`.
Can be prevented. |
[DrawerContent.vue source](https://github.com/vinicunca/akar/blob/v2.0.20/packages/core/src/Drawer/DrawerContent.vue)
| Data attribute | Value |
| --- | --- |
| `[data-state]` | "open" \\| "closed" |
| `[data-swipe-direction]` | "up" \\| "down" \\| "left" \\| "right" |
| `[data-swiping]` | "Present while the drawer is being dragged" |
| `[data-nested-drawer-open]` | "Present when a nested drawer is open" |
### Close
The button that closes the drawer.
**Props**
| Prop | Default | Type | Description |
| --- | --- | --- | --- |
| `as` | `"button"` | `AsTag \| Component` | The element or component this component should render as. Can be overwritten by `asChild`. |
| `asChild` | | `boolean` | Change the default rendered element for the one passed as a child, merging their props and behavior.
Read our [Composition](/akar/guides/composition) guide for more details. |
[DrawerClose.vue source](https://github.com/vinicunca/akar/blob/v2.0.20/packages/core/src/Drawer/DrawerClose.vue)
### Title
An accessible title to be announced when the drawer is opened.
If you want to hide the title, wrap it inside our Visually Hidden utility like this `
Read our [Composition](/akar/guides/composition) guide for more details. |
[DrawerTitle.vue source](https://github.com/vinicunca/akar/blob/v2.0.20/packages/core/src/Drawer/DrawerTitle.vue)
### Description
An optional accessible description to be announced when the drawer is opened.
If you want to hide the description, wrap it inside our Visually Hidden utility like this `
Read our [Composition](/akar/guides/composition) guide for more details. |
[DrawerDescription.vue source](https://github.com/vinicunca/akar/blob/v2.0.20/packages/core/src/Drawer/DrawerDescription.vue)
### Handle
A visual grab handle that hints the drawer can be dragged. It is purely
decorative (`aria-hidden`) — the whole content is draggable regardless.
**Props**
| Prop | Default | Type | Description |
| --- | --- | --- | --- |
| `as` | `"div"` | `AsTag \| Component` | The element or component this component should render as. Can be overwritten by `asChild`. |
| `asChild` | | `boolean` | Change the default rendered element for the one passed as a child, merging their props and behavior.
Read our [Composition](/akar/guides/composition) guide for more details. |
[DrawerHandle.vue source](https://github.com/vinicunca/akar/blob/v2.0.20/packages/core/src/Drawer/DrawerHandle.vue)
| Data attribute | Value |
| --- | --- |
| `[data-state]` | "open" \\| "closed" |
### SwipeArea
An off-screen edge area that lets users swipe the drawer **open**. By default it
listens on the opposite side of the Root's `swipeDirection`.
**Props**
| Prop | Default | Type | Description |
| --- | --- | --- | --- |
| `as` | `"div"` | `AsTag \| Component` | The element or component this component should render as. Can be overwritten by `asChild`. |
| `asChild` | | `boolean` | Change the default rendered element for the one passed as a child, merging their props and behavior.
Read our [Composition](/akar/guides/composition) guide for more details. |
| `disabled` | `false` | `boolean` | Disable swipe-to-open. |
| `swipeDirection` | | `"right" \| "left" \| "down" \| "up"` | Override the open swipe direction (defaults to opposite of Root's swipeDirection). |
[DrawerSwipeArea.vue source](https://github.com/vinicunca/akar/blob/v2.0.20/packages/core/src/Drawer/DrawerSwipeArea.vue)
| Data attribute | Value |
| --- | --- |
| `[data-state]` | "open" \\| "closed" |
| `[data-swipe-direction]` | "up" \\| "down" \\| "left" \\| "right" |
### Viewport
An optional wrapper around `DrawerContent`. Mirrors Base UI's `Drawer.Viewport`
and carries a `data-drawer-viewport` attribute for downstream selectors.
Required when using `VirtualKeyboardProvider`, which measures the keyboard
against it.
**Props**
| Prop | Default | Type | Description |
| --- | --- | --- | --- |
| `as` | `"div"` | `AsTag \| Component` | The element or component this component should render as. Can be overwritten by `asChild`. |
| `asChild` | | `boolean` | Change the default rendered element for the one passed as a child, merging their props and behavior.
Read our [Composition](/akar/guides/composition) guide for more details. |
[DrawerViewport.vue source](https://github.com/vinicunca/akar/blob/v2.0.20/packages/core/src/Drawer/DrawerViewport.vue)
### VirtualKeyboardProvider
Makes the drawer react to the software keyboard: it keeps the focused field
visible and exposes `--drawer-keyboard-inset` on `DrawerViewport`, which it
requires (see [Soft keyboard](#soft-keyboard)). Takes no props and renders no
markup of its own.
### Indent
Wraps page content that should visually shift (scale/indent) as the drawer is
swiped, mimicking the native iOS "card stack" effect. Reads the visual state
from a parent `DrawerProvider` and syncs the `--drawer-swipe-progress` and
`--drawer-height` CSS variables onto its element.
**Props**
| Prop | Default | Type | Description |
| --- | --- | --- | --- |
| `as` | `"div"` | `AsTag \| Component` | The element or component this component should render as. Can be overwritten by `asChild`. |
| `asChild` | | `boolean` | Change the default rendered element for the one passed as a child, merging their props and behavior.
Read our [Composition](/akar/guides/composition) guide for more details. |
[DrawerIndent.vue source](https://github.com/vinicunca/akar/blob/v2.0.20/packages/core/src/Drawer/DrawerIndent.vue)
| Data attribute | Value |
| --- | --- |
| `[data-active]` | "Present when a drawer is open" |
| `[data-inactive]` | "Present when no drawer is open" |
### IndentBackground
The backdrop layer revealed behind an indented page (typically a solid colour
that peeks out as the page scales down). Companion to `Indent`.
**Props**
| Prop | Default | Type | Description |
| --- | --- | --- | --- |
| `as` | `"div"` | `AsTag \| Component` | The element or component this component should render as. Can be overwritten by `asChild`. |
| `asChild` | | `boolean` | Change the default rendered element for the one passed as a child, merging their props and behavior.
Read our [Composition](/akar/guides/composition) guide for more details. |
[DrawerIndentBackground.vue source](https://github.com/vinicunca/akar/blob/v2.0.20/packages/core/src/Drawer/DrawerIndentBackground.vue)
| Data attribute | Value |
| --- | --- |
| `[data-active]` | "Present when a drawer is open" |
| `[data-inactive]` | "Present when no drawer is open" |
## Examples
### Choosing a side
`DrawerRoot` slides up from the bottom by default. Set `swipeDirection` to change
the edge the drawer attaches to and the direction users swipe to dismiss it.
```vue
If omitted, inherits globally from `ConfigProvider` or assumes LTR (left-to-right) reading mode. |
| `modal` | `true` | `boolean` | The modality of the dropdown menu.
When set to `true`, interaction with outside elements will be disabled and only menu content will be visible to screen readers. |
| `open` | | `boolean` | The controlled open state of the menu. Can be used as `v-model:open`. |
**Events**
| Event | Payload | Description |
| --- | --- | --- |
| `update:open` | `payload: boolean` | |
**Slots**
| Slot | Payload | Description |
| --- | --- | --- |
| `open` | `boolean` | Current open state |
[DropdownMenuRoot.vue source](https://github.com/vinicunca/akar/blob/v2.0.20/packages/core/src/DropdownMenu/DropdownMenuRoot.vue)
### Trigger
The button that toggles the dropdown menu. By default, the `DropdownMenuContent` will position itself against the trigger.
**Props**
| Prop | Default | Type | Description |
| --- | --- | --- | --- |
| `as` | `"button"` | `AsTag \| Component` | The element or component this component should render as. Can be overwritten by `asChild`. |
| `asChild` | | `boolean` | Change the default rendered element for the one passed as a child, merging their props and behavior.
Read our [Composition](https://vinicunca.dev/akar/guides/composition) guide for more details. |
| `disabled` | | `boolean` | When `true`, prevents the user from interacting with item |
[DropdownMenuTrigger.vue source](https://github.com/vinicunca/akar/blob/v2.0.20/packages/core/src/DropdownMenu/DropdownMenuTrigger.vue)
| Data attribute | Value |
| --- | --- |
| `[data-state]` | "open" \\| "closed" |
| `[data-disabled]` | Present when disabled |
### Portal
When used, portals the content part into the `body`.
**Props**
| Prop | Default | Type | Description |
| --- | --- | --- | --- |
| `defer` | | `boolean` | Defer the resolving of a Teleport target until other parts of the
application have mounted (requires Vue 3.5.0+)
[reference](https://vuejs.org/guide/built-ins/teleport.html#deferred-teleport) |
| `disabled` | | `boolean` | Disable teleport and render the component inline
[reference](https://vuejs.org/guide/built-ins/teleport.html#disabling-teleport) |
| `forceMount` | | `boolean` | Used to force mounting when more control is needed. Useful when
controlling animation with Vue animation libraries. |
| `to` | | `string \| HTMLElement` | Vue native teleport component prop `:to`
[reference](https://vuejs.org/guide/built-ins/teleport.html#basic-usage) |
[DropdownMenuPortal.vue source](https://github.com/vinicunca/akar/blob/v2.0.20/packages/core/src/DropdownMenu/DropdownMenuPortal.vue)
### Content
The component that pops out when the dropdown menu is open.
**Props**
| Prop | Default | Type | Description |
| --- | --- | --- | --- |
| `align` | `"center"` | `"start" \| "center" \| "end"` | The preferred alignment against the trigger.
May change when collisions occur. |
| `alignFlip` | `true` | `boolean` | Flip alignment when colliding with boundary.
May only occur when `prioritizePosition` is true. |
| `alignOffset` | `0` | `number` | An offset in pixels from the `start` or `end` alignment options. |
| `arrowPadding` | `0` | `number` | The padding between the arrow and the edges of the content.
If your content has border-radius, this will prevent it from
overflowing the corners. |
| `as` | `"div"` | `AsTag \| Component` | The element or component this component should render as. Can be overwritten by `asChild`. |
| `asChild` | | `boolean` | Change the default rendered element for the one passed as a child, merging their props and behavior.
Read our [Composition](https://vinicunca.dev/akar/guides/composition) guide for more details. |
| `avoidCollisions` | `true` | `boolean` | When `true`, overrides the side and align preferences
to prevent collisions with boundary edges. |
| `collisionBoundary` | `[]` | `Element \| (Element \| null)[] \| null` | The element used as the collision boundary. By default
this is the viewport, though you can provide additional
element(s) to be included in this check. |
| `collisionPadding` | `0` | `number \| Partial
detection should occur. Accepts a number (same for all sides),
or a partial padding object, for example: { top: 20, left: 20 }. |
| `disableUpdateOnLayoutShift` | `false` | `boolean` | Whether to disable the update position for the content when the layout shifted. |
| `forceMount` | | `boolean` | Used to force mounting when more control is needed. Useful when
controlling animation with Vue animation libraries. |
| `hideShiftedArrow` | `true` | `boolean` | When `true`, hides the arrow when it cannot be centered
to the reference element. |
| `hideWhenDetached` | `false` | `boolean` | Whether to hide the content when the trigger becomes fully occluded. |
| `loop` | `false` | `boolean` | When `true`, keyboard navigation will loop from last item to first, and vice versa. |
| `memoDependencies` | | `unknown[]` | Reactive dependencies that should invalidate the memoized content subtree. |
| `positionStrategy` | | `"fixed" \| "absolute"` | The type of CSS position property to use. |
| `prioritizePosition` | `false` | `boolean` | Force content to be position within the viewport.
Might overlap the reference element, which may not be desired. |
| `reference` | | `ReferenceElement` | The custom element or virtual element that will be set as the reference
to position the floating element.
If provided, it will replace the default anchor element. |
| `side` | `"bottom"` | `"top" \| "right" \| "bottom" \| "left"` | The preferred side of the trigger to render against when open.
Will be reversed when collisions occur and avoidCollisions
is enabled. |
| `sideFlip` | `true` | `boolean` | Flip to the opposite side when colliding with boundary. |
| `sideOffset` | `0` | `number` | The distance in pixels from the trigger. |
| `sticky` | `"partial"` | `"partial" \| "always"` | The sticky behavior on the align axis. `partial` will keep the
content in the boundary as long as the trigger is at least partially
in the boundary whilst "always" will keep the content in the boundary
regardless. |
| `updatePositionStrategy` | `'optimized'` | `"always" \| "optimized"` | Strategy to update the position of the floating element on every animation frame. |
**Events**
| Event | Payload | Description |
| --- | --- | --- |
| `closeAutoFocus` | `event: Event` | Event handler called when auto-focusing on close.
Can be prevented. |
| `escapeKeyDown` | `event: KeyboardEvent` | Event handler called when the escape key is down.
Can be prevented. |
| `focusOutside` | `event: FocusOutsideEvent` | Event handler called when the focus moves outside of the `DismissableLayer`.
Can be prevented. |
| `interactOutside` | `event: PointerDownOutsideEvent \| FocusOutsideEvent` | Event handler called when an interaction happens outside the `DismissableLayer`.
Specifically, when a `pointerdown` event happens outside or focus moves outside of it.
Can be prevented. |
| `openAutoFocus` | `event: Event` | |
| `pointerDownOutside` | `event: PointerDownOutsideEvent` | Event handler called when a `pointerdown` event happens outside of the `DismissableLayer`.
Can be prevented. |
[DropdownMenuContent.vue source](https://github.com/vinicunca/akar/blob/v2.0.20/packages/core/src/DropdownMenu/DropdownMenuContent.vue)
| Data attribute | Value |
| --- | --- |
| `[data-state]` | "open" \\| "closed" |
| `[data-side]` | "left" \\| "right" \\| "bottom" \\| "top" |
| `[data-align]` | "start" \\| "end" \\| "center" |
| `[data-orientation]` | "vertical" \\| "horizontal" |
| CSS variable | Description |
| --- | --- |
| `--akar-dropdown-menu-content-transform-origin` | The `transform-origin` computed from the content and arrow positions/offsets |
| `--akar-dropdown-menu-content-available-width` | The remaining width between the trigger and the boundary edge |
| `--akar-dropdown-menu-content-available-height` | The remaining height between the trigger and the boundary edge |
| `--akar-dropdown-menu-trigger-width` | The width of the trigger |
| `--akar-dropdown-menu-trigger-height` | The height of the trigger |
### Filter
An optional search input inside `DropdownMenuContent` or `DropdownMenuSubContent`. It integrates text input with the menu's keyboard navigation.
**Props**
| Prop | Default | Type | Description |
| --- | --- | --- | --- |
| `as` | `"input"` | `AsTag \| Component` | The element or component this component should render as. Can be overwritten by `asChild`. |
| `asChild` | | `boolean` | Change the default rendered element for the one passed as a child, merging their props and behavior.
Read our [Composition](https://vinicunca.dev/akar/guides/composition) guide for more details. |
| `autoFocus` | | `boolean` | Focus on element when mounted. |
| `disabled` | | `boolean` | When `true`, prevents the user from interacting with the filter input |
| `modelValue` | | `string` | The controlled value of the filter. Can be binded with v-model. |
**Events**
| Event | Payload | Description |
| --- | --- | --- |
| `update:modelValue` | `string` | |
**Slots**
| Slot | Payload | Description |
| --- | --- | --- |
| `modelValue` | `string` | Current input values |
[DropdownMenuFilter.vue source](https://github.com/vinicunca/akar/blob/v2.0.20/packages/core/src/DropdownMenu/DropdownMenuFilter.vue)
| Data attribute | Value |
| --- | --- |
| `[data-disabled]` | Present when disabled |
### Arrow
An optional arrow element to render alongside the dropdown menu. This can be used to help visually link the trigger with the `DropdownMenuContent`. Must be rendered inside `DropdownMenuContent`.
**Props**
| Prop | Default | Type | Description |
| --- | --- | --- | --- |
| `as` | `"svg"` | `AsTag \| Component` | The element or component this component should render as. Can be overwritten by `asChild`. |
| `asChild` | | `boolean` | Change the default rendered element for the one passed as a child, merging their props and behavior.
Read our [Composition](https://vinicunca.dev/akar/guides/composition) guide for more details. |
| `height` | `5` | `number` | The height of the arrow in pixels. |
| `rounded` | `false` | `boolean` | When `true`, render the rounded version of arrow. Do not work with `as`/`asChild` |
| `width` | `10` | `number` | The width of the arrow in pixels. |
[DropdownMenuArrow.vue source](https://github.com/vinicunca/akar/blob/v2.0.20/packages/core/src/DropdownMenu/DropdownMenuArrow.vue)
### Item
The component that contains the dropdown menu items.
**Props**
| Prop | Default | Type | Description |
| --- | --- | --- | --- |
| `as` | `"div"` | `AsTag \| Component` | The element or component this component should render as. Can be overwritten by `asChild`. |
| `asChild` | | `boolean` | Change the default rendered element for the one passed as a child, merging their props and behavior.
Read our [Composition](https://vinicunca.dev/akar/guides/composition) guide for more details. |
| `disabled` | | `boolean` | When `true`, prevents the user from interacting with the item. |
| `textValue` | | `string` | Optional text used for typeahead purposes. By default the typeahead behavior will use the `.textContent` of the item.
Use this when the content is complex, or you have non-textual content inside. |
**Events**
| Event | Payload | Description |
| --- | --- | --- |
| `select` | `event: Event` | Event handler called when the user selects an item (via mouse or keyboard).
Calling `event.preventDefault` in this handler will prevent the menu from closing when selecting that item. |
[DropdownMenuItem.vue source](https://github.com/vinicunca/akar/blob/v2.0.20/packages/core/src/DropdownMenu/DropdownMenuItem.vue)
| Data attribute | Value |
| --- | --- |
| `[data-orientation]` | "vertical" \\| "horizontal" |
| `[data-highlighted]` | Present when highlighted |
| `[data-disabled]` | Present when disabled |
### Group
Used to group multiple `DropdownMenuItem`s.
**Props**
| Prop | Default | Type | Description |
| --- | --- | --- | --- |
| `as` | `"div"` | `AsTag \| Component` | The element or component this component should render as. Can be overwritten by `asChild`. |
| `asChild` | | `boolean` | Change the default rendered element for the one passed as a child, merging their props and behavior.
Read our [Composition](https://vinicunca.dev/akar/guides/composition) guide for more details. |
[DropdownMenuGroup.vue source](https://github.com/vinicunca/akar/blob/v2.0.20/packages/core/src/DropdownMenu/DropdownMenuGroup.vue)
### Label
Used to render a label. It won't be focusable using arrow keys.
**Props**
| Prop | Default | Type | Description |
| --- | --- | --- | --- |
| `as` | `"div"` | `AsTag \| Component` | The element or component this component should render as. Can be overwritten by `asChild`. |
| `asChild` | | `boolean` | Change the default rendered element for the one passed as a child, merging their props and behavior.
Read our [Composition](https://vinicunca.dev/akar/guides/composition) guide for more details. |
[DropdownMenuLabel.vue source](https://github.com/vinicunca/akar/blob/v2.0.20/packages/core/src/DropdownMenu/DropdownMenuLabel.vue)
### CheckboxItem
An item that can be controlled and rendered like a checkbox.
**Props**
| Prop | Default | Type | Description |
| --- | --- | --- | --- |
| `as` | `"div"` | `AsTag \| Component` | The element or component this component should render as. Can be overwritten by `asChild`. |
| `asChild` | | `boolean` | Change the default rendered element for the one passed as a child, merging their props and behavior.
Read our [Composition](https://vinicunca.dev/akar/guides/composition) guide for more details. |
| `disabled` | | `boolean` | When `true`, prevents the user from interacting with the item. |
| `modelValue` | | `false \| true \| "indeterminate"` | The controlled checked state of the item. Can be used as `v-model`. |
| `textValue` | | `string` | Optional text used for typeahead purposes. By default the typeahead behavior will use the `.textContent` of the item.
Use this when the content is complex, or you have non-textual content inside. |
**Events**
| Event | Payload | Description |
| --- | --- | --- |
| `select` | `event: Event` | Event handler called when the user selects an item (via mouse or keyboard).
Calling `event.preventDefault` in this handler will prevent the menu from closing when selecting that item. |
| `update:modelValue` | `payload: boolean` | Event handler called when the checked state changes. |
**Slots**
| Slot | Payload | Description |
| --- | --- | --- |
| `checked` | `false \| true \| "indeterminate"` | Current checked state |
| `modelValue` | `CheckedState` | Current modelValue state |
[DropdownMenuCheckboxItem.vue source](https://github.com/vinicunca/akar/blob/v2.0.20/packages/core/src/DropdownMenu/DropdownMenuCheckboxItem.vue)
| Data attribute | Value |
| --- | --- |
| `[data-state]` | "checked" \\| "unchecked" \\| "indeterminate" |
| `[data-highlighted]` | Present when highlighted |
| `[data-disabled]` | Present when disabled |
### RadioGroup
Used to group multiple `DropdownMenuRadioItem`s.
**Props**
| Prop | Default | Type | Description |
| --- | --- | --- | --- |
| `as` | `"div"` | `AsTag \| Component` | The element or component this component should render as. Can be overwritten by `asChild`. |
| `asChild` | | `boolean` | Change the default rendered element for the one passed as a child, merging their props and behavior.
Read our [Composition](https://vinicunca.dev/akar/guides/composition) guide for more details. |
| `modelValue` | | `AcceptableValue` | The value of the selected item in the group. |
**Events**
| Event | Payload | Description |
| --- | --- | --- |
| `update:modelValue` | `payload: AcceptableValue` | Event handler called when the value changes. |
[DropdownMenuRadioGroup.vue source](https://github.com/vinicunca/akar/blob/v2.0.20/packages/core/src/DropdownMenu/DropdownMenuRadioGroup.vue)
### RadioItem
An item that can be controlled and rendered like a radio.
**Props**
| Prop | Default | Type | Description |
| --- | --- | --- | --- |
| `as` | `"div"` | `AsTag \| Component` | The element or component this component should render as. Can be overwritten by `asChild`. |
| `asChild` | | `boolean` | Change the default rendered element for the one passed as a child, merging their props and behavior.
Read our [Composition](https://vinicunca.dev/akar/guides/composition) guide for more details. |
| `disabled` | | `boolean` | When `true`, prevents the user from interacting with the item. |
| `textValue` | | `string` | Optional text used for typeahead purposes. By default the typeahead behavior will use the `.textContent` of the item.
Use this when the content is complex, or you have non-textual content inside. |
| `value*` | | `AcceptableValue` | The unique value of the item. |
**Events**
| Event | Payload | Description |
| --- | --- | --- |
| `select` | `event: Event` | Event handler called when the user selects an item (via mouse or keyboard).
Calling `event.preventDefault` in this handler will prevent the menu from closing when selecting that item. |
**Slots**
| Slot | Payload | Description |
| --- | --- | --- |
| `checked` | `boolean` | Current checked state |
[DropdownMenuRadioItem.vue source](https://github.com/vinicunca/akar/blob/v2.0.20/packages/core/src/DropdownMenu/DropdownMenuRadioItem.vue)
| Data attribute | Value |
| --- | --- |
| `[data-state]` | "checked" \\| "unchecked" \\| "indeterminate" |
| `[data-highlighted]` | Present when highlighted |
| `[data-disabled]` | Present when disabled |
### ItemIndicator
Renders when the parent `DropdownMenuCheckboxItem` or `DropdownMenuRadioItem` is checked. You can style this element directly, or you can use it as a wrapper to put an icon into, or both.
**Props**
| Prop | Default | Type | Description |
| --- | --- | --- | --- |
| `as` | `"div"` | `AsTag \| Component` | The element or component this component should render as. Can be overwritten by `asChild`. |
| `asChild` | | `boolean` | Change the default rendered element for the one passed as a child, merging their props and behavior.
Read our [Composition](https://vinicunca.dev/akar/guides/composition) guide for more details. |
| `forceMount` | | `boolean` | Used to force mounting when more control is needed. Useful when
controlling animation with Vue animation libraries. |
[DropdownMenuItemIndicator.vue source](https://github.com/vinicunca/akar/blob/v2.0.20/packages/core/src/DropdownMenu/DropdownMenuItemIndicator.vue)
| Data attribute | Value |
| --- | --- |
| `[data-state]` | "checked" \\| "unchecked" \\| "indeterminate" |
### Separator
Used to visually separate items in the dropdown menu.
**Props**
| Prop | Default | Type | Description |
| --- | --- | --- | --- |
| `as` | `"div"` | `AsTag \| Component` | The element or component this component should render as. Can be overwritten by `asChild`. |
| `asChild` | | `boolean` | Change the default rendered element for the one passed as a child, merging their props and behavior.
Read our [Composition](https://vinicunca.dev/akar/guides/composition) guide for more details. |
[DropdownMenuSeparator.vue source](https://github.com/vinicunca/akar/blob/v2.0.20/packages/core/src/DropdownMenu/DropdownMenuSeparator.vue)
### Sub
Contains all the parts of a submenu.
**Props**
| Prop | Default | Type | Description |
| --- | --- | --- | --- |
| `defaultOpen` | | `boolean` | The open state of the dropdown menu when it is initially rendered. Use when you do not need to control its open state. |
| `open` | | `boolean` | The controlled open state of the menu. Can be used as `v-model:open`. |
**Events**
| Event | Payload | Description |
| --- | --- | --- |
| `update:open` | `payload: boolean` | Event handler called when the open state of the submenu changes. |
**Slots**
| Slot | Payload | Description |
| --- | --- | --- |
| `open` | `boolean` | Current open state |
[DropdownMenuSub.vue source](https://github.com/vinicunca/akar/blob/v2.0.20/packages/core/src/DropdownMenu/DropdownMenuSub.vue)
### SubTrigger
An item that opens a submenu. Must be rendered inside `DropdownMenuSub`.
**Props**
| Prop | Default | Type | Description |
| --- | --- | --- | --- |
| `as` | `"div"` | `AsTag \| Component` | The element or component this component should render as. Can be overwritten by `asChild`. |
| `asChild` | | `boolean` | Change the default rendered element for the one passed as a child, merging their props and behavior.
Read our [Composition](https://vinicunca.dev/akar/guides/composition) guide for more details. |
| `disabled` | | `boolean` | When `true`, prevents the user from interacting with the item. |
| `graceDuration` | `300` | `number` | Time in milliseconds to keep a submenu open while the pointer moves from
its trigger to the submenu. |
| `textValue` | | `string` | Optional text used for typeahead purposes. By default the typeahead behavior will use the `.textContent` of the item.
Use this when the content is complex, or you have non-textual content inside. |
[DropdownMenuSubTrigger.vue source](https://github.com/vinicunca/akar/blob/v2.0.20/packages/core/src/DropdownMenu/DropdownMenuSubTrigger.vue)
| Data attribute | Value |
| --- | --- |
| `[data-state]` | "open" \\| "closed" |
| `[data-highlighted]` | Present when highlighted |
| `[data-disabled]` | Present when disabled |
| CSS variable | Description |
| --- | --- |
| `--akar-dropdown-menu-content-transform-origin` | The `transform-origin` computed from the content and arrow positions/offsets |
| `--akar-dropdown-menu-content-available-width` | The remaining width between the trigger and the boundary edge |
| `--akar-dropdown-menu-content-available-height` | The remaining height between the trigger and the boundary edge |
| `--akar-dropdown-menu-trigger-width` | The width of the trigger |
| `--akar-dropdown-menu-trigger-height` | The height of the trigger |
### SubContent
The component that pops out when a submenu is open. Must be rendered inside `DropdownMenuSub`.
**Props**
| Prop | Default | Type | Description |
| --- | --- | --- | --- |
| `alignFlip` | `true` | `boolean` | Flip alignment when colliding with boundary.
May only occur when `prioritizePosition` is true. |
| `alignOffset` | `0` | `number` | An offset in pixels from the `start` or `end` alignment options. |
| `arrowPadding` | `0` | `number` | The padding between the arrow and the edges of the content.
If your content has border-radius, this will prevent it from
overflowing the corners. |
| `as` | `"div"` | `AsTag \| Component` | The element or component this component should render as. Can be overwritten by `asChild`. |
| `asChild` | | `boolean` | Change the default rendered element for the one passed as a child, merging their props and behavior.
Read our [Composition](https://vinicunca.dev/akar/guides/composition) guide for more details. |
| `avoidCollisions` | `true` | `boolean` | When `true`, overrides the side and align preferences
to prevent collisions with boundary edges. |
| `collisionBoundary` | `[]` | `Element \| (Element \| null)[] \| null` | The element used as the collision boundary. By default
this is the viewport, though you can provide additional
element(s) to be included in this check. |
| `collisionPadding` | `0` | `number \| Partial
detection should occur. Accepts a number (same for all sides),
or a partial padding object, for example: { top: 20, left: 20 }. |
| `disableUpdateOnLayoutShift` | `false` | `boolean` | Whether to disable the update position for the content when the layout shifted. |
| `forceMount` | | `boolean` | Used to force mounting when more control is needed. Useful when
controlling animation with Vue animation libraries. |
| `hideShiftedArrow` | `true` | `boolean` | When `true`, hides the arrow when it cannot be centered
to the reference element. |
| `hideWhenDetached` | `false` | `boolean` | Whether to hide the content when the trigger becomes fully occluded. |
| `loop` | `false` | `boolean` | When `true`, keyboard navigation will loop from last item to first, and vice versa. |
| `memoDependencies` | | `unknown[]` | Reactive dependencies that should invalidate the memoized content subtree. |
| `positionStrategy` | | `"fixed" \| "absolute"` | The type of CSS position property to use. |
| `prioritizePosition` | `false` | `boolean` | Force content to be position within the viewport.
Might overlap the reference element, which may not be desired. |
| `reference` | | `ReferenceElement` | The custom element or virtual element that will be set as the reference
to position the floating element.
If provided, it will replace the default anchor element. |
| `sideFlip` | `true` | `boolean` | Flip to the opposite side when colliding with boundary. |
| `sideOffset` | `0` | `number` | The distance in pixels from the trigger. |
| `sticky` | `"partial"` | `"partial" \| "always"` | The sticky behavior on the align axis. `partial` will keep the
content in the boundary as long as the trigger is at least partially
in the boundary whilst "always" will keep the content in the boundary
regardless. |
| `updatePositionStrategy` | `'optimized'` | `"always" \| "optimized"` | Strategy to update the position of the floating element on every animation frame. |
**Events**
| Event | Payload | Description |
| --- | --- | --- |
| `closeAutoFocus` | `event: Event` | Event handler called when auto-focusing on close.
Can be prevented. |
| `entryFocus` | `event: Event` | |
| `escapeKeyDown` | `event: KeyboardEvent` | Event handler called when the escape key is down.
Can be prevented. |
| `focusOutside` | `event: FocusOutsideEvent` | Event handler called when the focus moves outside of the `DismissableLayer`.
Can be prevented. |
| `interactOutside` | `event: PointerDownOutsideEvent \| FocusOutsideEvent` | Event handler called when an interaction happens outside the `DismissableLayer`.
Specifically, when a `pointerdown` event happens outside or focus moves outside of it.
Can be prevented. |
| `openAutoFocus` | `event: Event` | |
| `pointerDownOutside` | `event: PointerDownOutsideEvent` | Event handler called when a `pointerdown` event happens outside of the `DismissableLayer`.
Can be prevented. |
[DropdownMenuSubContent.vue source](https://github.com/vinicunca/akar/blob/v2.0.20/packages/core/src/DropdownMenu/DropdownMenuSubContent.vue)
| Data attribute | Value |
| --- | --- |
| `[data-state]` | "open" \\| "closed" |
| `[data-side]` | "left" \\| "right" \\| "bottom" \\| "top" |
| `[data-align]` | "start" \\| "end" \\| "center" |
| `[data-orientation]` | "vertical" \\| "horizontal" |
## Examples
### With submenus
You can create submenus by using `DropdownMenuSub` in combination with its parts.
```vue
Adolfo Hess
Miyah Myles
DropdownMenuTrigger, opens the dropdown
menu and focuses the first item.
When focus is on an item, activates the focused item.
`,
},
{
keys: ['ArrowDown'],
description: `
When focus is on DropdownMenuTrigger, opens the dropdown
menu.
When focus is on an item, moves focus to the next item.
`,
},
{
keys: ['ArrowUp'],
description: `
When focus is on an item, moves focus to the previous item.
`,
},
{
keys: ['ArrowRight', 'ArrowLeft'],
description: `
When focus is on DropdownMenuSubTrigger, opens or closes
the submenu depending on reading direction.
`,
},
{
keys: ['Esc'],
description: `
Closes the dropdown menu and moves focus to{' '}
DropdownMenuTrigger.
`,
},
```
]"
/>
#### When focus is on the filter
The input keeps focus while keyboard navigation updates the highlighted item through `aria-activedescendant`.
| Key | Description |
| --- | --- |
| ArrowDown / ArrowUp | Highlights the next or previous enabled item. |
| Home / End | Highlights the first or last enabled item. |
| Enter | Activates the highlighted item. |
| Esc | Clears a non-empty filter without closing the menu. If the filter is empty, closes the menu and returns focus to the trigger. |
## Custom APIs
Create your own API by abstracting the primitive parts into your own component.
### Abstract the arrow and item indicators
This example abstracts the `DropdownMenuArrow` and `DropdownMenuItemIndicator` parts. It also wraps implementation details for `CheckboxItem` and `RadioItem`.
#### Usage
```vue
Read our [Composition](https://vinicunca.dev/akar/guides/composition) guide for more details. |
| `autoResize` | `false` | `boolean` | Whether the editable field should auto resize |
| `defaultValue` | | `string` | The default value of the editable field |
| `dir` | | `"ltr" \| "rtl"` | The reading direction of the calendar when applicable.
If omitted, inherits globally from `ConfigProvider` or assumes LTR (left-to-right) reading mode. |
| `disabled` | `false` | `boolean` | Whether the editable field is disabled |
| `id` | | `string` | The id of the field |
| `maxLength` | | `number` | The maximum number of characters allowed |
| `modelValue` | | `string \| null` | The value of the editable field |
| `name` | | `string` | The name of the field. Submitted with its owning form as part of a name/value pair. |
| `placeholder` | `"Enter text..."` | `string \| { edit: string; preview: string; }` | The placeholder for the editable field |
| `readonly` | | `boolean` | Whether the editable field is read-only |
| `required` | `false` | `boolean` | When `true`, indicates that the user must set the value before the owning form can be submitted. |
| `selectOnFocus` | `false` | `boolean` | Whether to select the text in the input when it is focused. |
| `startWithEditMode` | | `boolean` | Whether to start with the edit mode active |
| `submitMode` | `"blur"` | `"blur" \| "none" \| "enter" \| "both"` | The submit event of the editable field |
**Events**
| Event | Payload | Description |
| --- | --- | --- |
| `submit` | `value: string \| null` | Event handler called when a value is submitted |
| `update:modelValue` | `value: string` | Event handler called whenever the model value changes |
| `update:state` | `state: "cancel" \| "submit" \| "edit"` | Event handler called when the editable field changes state |
**Slots**
| Slot | Payload | Description |
| --- | --- | --- |
| `isEditing` | `boolean` | Whether the editable field is in edit mode |
| `modelValue` | `string \| null` | The value of the editable field |
| `isEmpty` | `boolean` | Whether the editable field is empty |
| `submit` | `(): void` | Function to submit the value of the editable |
| `cancel` | `(): void` | Function to cancel the value of the editable |
| `edit` | `(): void` | Function to set the editable in edit mode |
**Methods**
| Method | Type | Description |
| --- | --- | --- |
| `submit` | `() => void` | Function to submit the value of the editable |
| `cancel` | `() => void` | Function to cancel the value of the editable |
| `edit` | `() => void` | Function to set the editable in edit mode |
[EditableRoot.vue source](https://github.com/vinicunca/akar/blob/v2.0.20/packages/core/src/Editable/EditableRoot.vue)
### Area
Contains the text parts of an editable component.
**Props**
| Prop | Default | Type | Description |
| --- | --- | --- | --- |
| `as` | `"div"` | `AsTag \| Component` | The element or component this component should render as. Can be overwritten by `asChild`. |
| `asChild` | | `boolean` | Change the default rendered element for the one passed as a child, merging their props and behavior.
Read our [Composition](https://vinicunca.dev/akar/guides/composition) guide for more details. |
[EditableArea.vue source](https://github.com/vinicunca/akar/blob/v2.0.20/packages/core/src/Editable/EditableArea.vue)
| Data attribute | Value |
| --- | --- |
| `[data-readonly]` | Present when readonly |
| `[data-disabled]` | Present when disabled |
| `[data-placeholder-shown]` | Present when preview is shown |
| `[data-empty]` | Present when the input is empty |
| `[data-focus]` | Present when the editable field is focused. To be deprecated in favor of [data-focused] |
| `[data-focused]` | Present when the editable field is focused |
### Input
Contains the input of an editable component.
**Props**
| Prop | Default | Type | Description |
| --- | --- | --- | --- |
| `as` | `"input"` | `AsTag \| Component` | The element or component this component should render as. Can be overwritten by `asChild`. |
| `asChild` | | `boolean` | Change the default rendered element for the one passed as a child, merging their props and behavior.
Read our [Composition](https://vinicunca.dev/akar/guides/composition) guide for more details. |
[EditableInput.vue source](https://github.com/vinicunca/akar/blob/v2.0.20/packages/core/src/Editable/EditableInput.vue)
| Data attribute | Value |
| --- | --- |
| `[data-readonly]` | Present when readonly |
| `[data-disabled]` | Present when disabled |
### Preview
Contains the preview of the editable component.
**Props**
| Prop | Default | Type | Description |
| --- | --- | --- | --- |
| `as` | `"span"` | `AsTag \| Component` | The element or component this component should render as. Can be overwritten by `asChild`. |
| `asChild` | | `boolean` | Change the default rendered element for the one passed as a child, merging their props and behavior.
Read our [Composition](https://vinicunca.dev/akar/guides/composition) guide for more details. |
[EditablePreview.vue source](https://github.com/vinicunca/akar/blob/v2.0.20/packages/core/src/Editable/EditablePreview.vue)
### Edit Trigger
Contains the edit trigger of the editable component.
**Props**
| Prop | Default | Type | Description |
| --- | --- | --- | --- |
| `as` | `"button"` | `AsTag \| Component` | The element or component this component should render as. Can be overwritten by `asChild`. |
| `asChild` | | `boolean` | Change the default rendered element for the one passed as a child, merging their props and behavior.
Read our [Composition](https://vinicunca.dev/akar/guides/composition) guide for more details. |
[EditableEditTrigger.vue source](https://github.com/vinicunca/akar/blob/v2.0.20/packages/core/src/Editable/EditableEditTrigger.vue)
### Submit Trigger
Contains the submit trigger of the editable component.
**Props**
| Prop | Default | Type | Description |
| --- | --- | --- | --- |
| `as` | `"button"` | `AsTag \| Component` | The element or component this component should render as. Can be overwritten by `asChild`. |
| `asChild` | | `boolean` | Change the default rendered element for the one passed as a child, merging their props and behavior.
Read our [Composition](https://vinicunca.dev/akar/guides/composition) guide for more details. |
[EditableSubmitTrigger.vue source](https://github.com/vinicunca/akar/blob/v2.0.20/packages/core/src/Editable/EditableSubmitTrigger.vue)
### Cancel Trigger
Contains the cancel trigger of the editable component.
**Props**
| Prop | Default | Type | Description |
| --- | --- | --- | --- |
| `as` | `"button"` | `AsTag \| Component` | The element or component this component should render as. Can be overwritten by `asChild`. |
| `asChild` | | `boolean` | Change the default rendered element for the one passed as a child, merging their props and behavior.
Read our [Composition](https://vinicunca.dev/akar/guides/composition) guide for more details. |
[EditableCancelTrigger.vue source](https://github.com/vinicunca/akar/blob/v2.0.20/packages/core/src/Editable/EditableCancelTrigger.vue)
## Examples
### Change only on submit
By default the component will submit when `blur` event triggers. We can modify the `submit-mode` prop to alter this behavior.
In this case, we want to submit only when user click on `EditableSubmitTrigger`, so we change the submit mode to `none`.
```vue
Read our [Composition](https://vinicunca.dev/akar/guides/composition) guide for more details. |
| `dirty` | | `boolean` | Whether the field's value has changed from its initial value.
Useful when the field state is controlled by an external library. |
| `disabled` | | `boolean` | When `true`, prevents the user from interacting with the field's control. Takes precedence over the `disabled` of the control. |
| `invalid` | | `boolean` | When `true`, marks the field invalid regardless of its own validation.
Useful when the field state is controlled by an external library. |
| `name` | | `string` | The name of the field. Submitted with its owning form as part of a
name/value pair, and used to match server `errors` on a `FormRoot`.
Takes precedence over the `name` of the control. |
| `required` | | `boolean` | When `true`, indicates that the user must set the value before the owning form can be submitted. |
| `touched` | | `boolean` | Whether the field has been touched (its control blurred).
Useful when the field state is controlled by an external library. |
| `validate` | | `FieldValidateFn` | Custom validation function. Return an error message (or array of
messages) when invalid, or `null`/`undefined` when valid. Receives the
control's value and the values of every named field in the owning form.
Can be async, but an async `validate` does not prevent form submission
when `validationMode` is `onSubmit`. |
| `validationDebounceTime` | | `number` | How long to wait (in ms) between `validate` calls when validating on change. |
| `validationMode` | `"onSubmit"` | `"onBlur" \| "onChange" \| "onSubmit"` | When the field (re-)runs validation. Takes precedence over the
`validationMode` of an ancestor `FormRoot`.
- `onSubmit`: when the form is submitted, then on every change after that.
- `onBlur`: when the control loses focus.
- `onChange`: on every change to the control's value. |
**Slots**
| Slot | Payload | Description |
| --- | --- | --- |
| `invalid` | `boolean` | Whether the field is currently invalid. |
| `errors` | `string[]` | All current error messages. |
[FieldRoot.vue source](https://github.com/vinicunca/akar/blob/v2.0.20/packages/core/src/Field/FieldRoot.vue)
Every part (and a participating reka control) renders the same data attributes, so any of them can be styled by the field's state.
| Data attribute | Value |
| --- | --- |
| `[data-valid]` | Present once validation has run and the field is valid |
| `[data-invalid]` | Present once validation has run and the field is invalid |
| `[data-dirty]` | Present while the control's value differs from its initial value |
| `[data-touched]` | Present once the control has been blurred |
| `[data-filled]` | Present when the control has a non-empty value |
| `[data-focused]` | Present while the control is focused |
| `[data-disabled]` | Present when disabled |
### Label
Renders a [Label](https://vinicunca.dev/akar/components/label), automatically wired to the control via `for`/`id` and the control's `aria-labelledby`.
For a button control like `SelectTrigger`, a native `label` forwards clicks and `:hover` to the button. Render another element with `:native-label="false"` instead: it drops `for` and focuses the control on click.
```vue
Read our [Composition](https://vinicunca.dev/akar/guides/composition) guide for more details. |
| `for` | | `string` | The id of the element the label is associated with. |
| `nativeLabel` | `true` | `boolean` | Whether the label renders a native `label` element. Set to `false` when
rendering another element (e.g. `as="div"`): it then drops `for`, focuses
the control on click, and relies on the control's `aria-labelledby`.
Useful for button controls like `SelectTrigger`, where a native label
would forward clicks and `:hover` to the button. |
[FieldLabel.vue source](https://github.com/vinicunca/akar/blob/v2.0.20/packages/core/src/Field/FieldLabel.vue)
### Control
A native form control (`input` by default — pass `as="textarea"` or `as="select"` for others). Binds `id`/`name`/`disabled`/`required`/`aria-labelledby`/`aria-describedby`/`aria-invalid` from the Field, and reports focus/blur/input interactions back to it. The Field's `name` takes precedence over the control's; `disabled` and `required` apply when set on either.
Bind its value with `v-model`, or set a starting value with `default-value`. A controlled value is validated when it changes, so a value you reject or rewrite never reaches the field.
Existing reka controls (`CheckboxRoot`, `SelectRoot`/`SelectTrigger`, `DateFieldRoot`, ...) can be used directly inside a `FieldRoot` instead of `FieldControl` — they pick up the same wiring automatically by optionally reading the Field's context, and behave exactly as before when used outside a Field.
**Props**
| Prop | Default | Type | Description |
| --- | --- | --- | --- |
| `as` | `"input"` | `AsTag \| Component` | The element or component this component should render as. Can be overwritten by `asChild`. |
| `asChild` | | `boolean` | Change the default rendered element for the one passed as a child, merging their props and behavior.
Read our [Composition](https://vinicunca.dev/akar/guides/composition) guide for more details. |
| `defaultValue` | | `string \| number` | The value of the control when it is initially rendered. Use when you do not need to control its value. |
| `id` | | `string` | Id of the element. Falls back to the id generated by the ancestor `FieldRoot`. |
| `modelValue` | | `string \| number` | The controlled value of the control. Can be bound with `v-model`. |
**Events**
| Event | Payload | Description |
| --- | --- | --- |
| `update:modelValue` | `value: string` | Event handler called when the value of the control changes. |
[FieldControl.vue source](https://github.com/vinicunca/akar/blob/v2.0.20/packages/core/src/Field/FieldControl.vue)
### Description
A description for the field, automatically added to the control's `aria-describedby`. Renders a `p` by default.
**Props**
| Prop | Default | Type | Description |
| --- | --- | --- | --- |
| `as` | `"p"` | `AsTag \| Component` | The element or component this component should render as. Can be overwritten by `asChild`. |
| `asChild` | | `boolean` | Change the default rendered element for the one passed as a child, merging their props and behavior.
Read our [Composition](https://vinicunca.dev/akar/guides/composition) guide for more details. |
| `id` | | `string` | Id of the element. Auto-generated when not provided. |
[FieldDescription.vue source](https://github.com/vinicunca/akar/blob/v2.0.20/packages/core/src/Field/FieldDescription.vue)
### Error
An error message for the field, added to the control's `aria-describedby` while shown. Renders a `div` by default.
- Without `match`, it shows whenever the field is invalid. Its default content is the current message: a server error, a custom `validate` message, or the browser's validation message. Several messages render as a list.
- With a `ValidityState` key like `match="valueMissing"`, it shows only for that constraint, typically with your own message.
- With `match` set to `true`, it always shows, letting an external library control it.
It never shows while the field is disabled. Its `data-state` is `open` or `closed`, and it waits for a closing animation before unmounting, keeping its last message meanwhile.
**Props**
| Prop | Default | Type | Description |
| --- | --- | --- | --- |
| `as` | `"div"` | `AsTag \| Component` | The element or component this component should render as. Can be overwritten by `asChild`. |
| `asChild` | | `boolean` | Change the default rendered element for the one passed as a child, merging their props and behavior.
Read our [Composition](https://vinicunca.dev/akar/guides/composition) guide for more details. |
| `forceMount` | | `boolean` | Used to force mounting when more control is needed. Useful when controlling animation with Vue animation libraries. |
| `id` | | `string` | Id of the element. Auto-generated when not provided. |
| `match` | | `boolean \| keyof ValidityState` | Restricts when this error renders:
- a `ValidityState` key (e.g. `"valueMissing"`) — renders when that constraint fails.
- `true` — always renders, letting an external library control visibility.
- omitted — renders whenever the field is invalid. |
**Slots**
| Slot | Payload | Description |
| --- | --- | --- |
| `errors` | `string[]` | The error messages this part displays. |
[FieldError.vue source](https://github.com/vinicunca/akar/blob/v2.0.20/packages/core/src/Field/FieldError.vue)
### Validity
Renders no element. Passes the field's `validity`, `errors`, `error`, `value` and `initialValue` to its slot, for displaying something custom based on the field's validity.
```vue
Read our [Composition](https://vinicunca.dev/akar/guides/composition) guide for more details. |
| `errors` | | `Record
matching `FieldRoot`'s `FieldError` until the user edits that field, or a
new value for that key is provided. |
| `validationMode` | `"onSubmit"` | `"onBlur" \| "onChange" \| "onSubmit"` | When fields validate. The `validationMode` of a `FieldRoot` takes precedence over this.
- `onSubmit`: when the form is submitted, then on every change after that.
- `onBlur`: when a control loses focus.
- `onChange`: on every change to a control's value. |
**Events**
| Event | Payload | Description |
| --- | --- | --- |
| `formSubmit` | `values: Record
to it prevents the native submission. |
| `submit` | `event: SubmitEvent` | Emitted with the native submit event once every field has validated
successfully. When any field is invalid, the native submission is
prevented and this isn't emitted. Otherwise the form submits natively
(e.g. to its `action`) unless you call `event.preventDefault()`, or
listen to `formSubmit`. |
**Methods**
| Method | Type | Description |
| --- | --- | --- |
| `validate` | `(fieldName?: string \| undefined) => boolean` | Validates every field, or only the field with the given `name`. Returns whether they're all valid. |
[FormRoot.vue source](https://github.com/vinicunca/akar/blob/v2.0.20/packages/core/src/Form/FormRoot.vue)
## Examples
### Server-side errors
Pass an `errors` map keyed by field `name`. The matching `FieldRoot`'s `FieldError` displays it until the user edits that field, or a new value for that key is provided. When errors arrive in response to a submit, focus moves to the first field they invalidate.
```vue
Read our [Composition](https://vinicunca.dev/akar/guides/composition) guide for more details. |
| `reference` | | `ReferenceElement` | The reference (or anchor) element that is being referred to for positioning.
If not provided will use the current component as anchor. |
[HoverCardTrigger.vue source](https://github.com/vinicunca/akar/blob/v2.0.20/packages/core/src/HoverCard/HoverCardTrigger.vue)
| Data attribute | Value |
| --- | --- |
| `[data-state]` | "open" \\| "closed" |
### Portal
When used, portals the content part into the `body`.
**Props**
| Prop | Default | Type | Description |
| --- | --- | --- | --- |
| `defer` | | `boolean` | Defer the resolving of a Teleport target until other parts of the
application have mounted (requires Vue 3.5.0+)
[reference](https://vuejs.org/guide/built-ins/teleport.html#deferred-teleport) |
| `disabled` | | `boolean` | Disable teleport and render the component inline
[reference](https://vuejs.org/guide/built-ins/teleport.html#disabling-teleport) |
| `forceMount` | | `boolean` | Used to force mounting when more control is needed. Useful when
controlling animation with Vue animation libraries. |
| `to` | | `string \| HTMLElement` | Vue native teleport component prop `:to`
[reference](https://vuejs.org/guide/built-ins/teleport.html#basic-usage) |
[HoverCardPortal.vue source](https://github.com/vinicunca/akar/blob/v2.0.20/packages/core/src/HoverCard/HoverCardPortal.vue)
### Content
The component that pops out when the hover card is open.
> [!NOTE]
>
> Defer mounting with `forceMount` / [`Presence`](https://vinicunca.dev/akar/utilities/presence). See the [animation guide](https://vinicunca.dev/akar/guides/animation).
**Props**
| Prop | Default | Type | Description |
| --- | --- | --- | --- |
| `align` | `"center"` | `"start" \| "center" \| "end"` | The preferred alignment against the trigger.
May change when collisions occur. |
| `alignFlip` | `true` | `boolean` | Flip alignment when colliding with boundary.
May only occur when `prioritizePosition` is true. |
| `alignOffset` | `0` | `number` | An offset in pixels from the `start` or `end` alignment options. |
| `arrowPadding` | `0` | `number` | The padding between the arrow and the edges of the content.
If your content has border-radius, this will prevent it from
overflowing the corners. |
| `as` | `"div"` | `AsTag \| Component` | The element or component this component should render as. Can be overwritten by `asChild`. |
| `asChild` | | `boolean` | Change the default rendered element for the one passed as a child, merging their props and behavior.
Read our [Composition](https://vinicunca.dev/akar/guides/composition) guide for more details. |
| `avoidCollisions` | `true` | `boolean` | When `true`, overrides the side and align preferences
to prevent collisions with boundary edges. |
| `collisionBoundary` | `[]` | `Element \| (Element \| null)[] \| null` | The element used as the collision boundary. By default
this is the viewport, though you can provide additional
element(s) to be included in this check. |
| `collisionPadding` | `0` | `number \| Partial
detection should occur. Accepts a number (same for all sides),
or a partial padding object, for example: { top: 20, left: 20 }. |
| `dir` | | `"ltr" \| "rtl"` | The reading direction of the popper content when applicable.
If omitted, inherits globally from `ConfigProvider` or assumes LTR (left-to-right) reading mode. |
| `disableUpdateOnLayoutShift` | `false` | `boolean` | Whether to disable the update position for the content when the layout shifted. |
| `forceMount` | | `boolean` | Used to force mounting when more control is needed. Useful when
controlling animation with Vue animation libraries. |
| `hideShiftedArrow` | `true` | `boolean` | When `true`, hides the arrow when it cannot be centered
to the reference element. |
| `hideWhenDetached` | `false` | `boolean` | Whether to hide the content when the trigger becomes fully occluded. |
| `memoDependencies` | | `unknown[]` | Reactive dependencies that should invalidate the memoized content subtree. |
| `positionStrategy` | | `"fixed" \| "absolute"` | The type of CSS position property to use. |
| `prioritizePosition` | `false` | `boolean` | Force content to be position within the viewport.
Might overlap the reference element, which may not be desired. |
| `reference` | | `ReferenceElement` | The custom element or virtual element that will be set as the reference
to position the floating element.
If provided, it will replace the default anchor element. |
| `side` | `"bottom"` | `"top" \| "right" \| "bottom" \| "left"` | The preferred side of the trigger to render against when open.
Will be reversed when collisions occur and avoidCollisions
is enabled. |
| `sideFlip` | `true` | `boolean` | Flip to the opposite side when colliding with boundary. |
| `sideOffset` | `0` | `number` | The distance in pixels from the trigger. |
| `sticky` | `"partial"` | `"partial" \| "always"` | The sticky behavior on the align axis. `partial` will keep the
content in the boundary as long as the trigger is at least partially
in the boundary whilst "always" will keep the content in the boundary
regardless. |
| `updatePositionStrategy` | `'optimized'` | `"always" \| "optimized"` | Strategy to update the position of the floating element on every animation frame. |
**Events**
| Event | Payload | Description |
| --- | --- | --- |
| `escapeKeyDown` | `event: KeyboardEvent` | Event handler called when the escape key is down.
Can be prevented. |
| `focusOutside` | `event: FocusOutsideEvent` | Event handler called when the focus moves outside of the `DismissableLayer`.
Can be prevented. |
| `interactOutside` | `event: PointerDownOutsideEvent \| FocusOutsideEvent` | Event handler called when an interaction happens outside the `DismissableLayer`.
Specifically, when a `pointerdown` event happens outside or focus moves outside of it.
Can be prevented. |
| `pointerDownOutside` | `event: PointerDownOutsideEvent` | Event handler called when a `pointerdown` event happens outside of the `DismissableLayer`.
Can be prevented. |
[HoverCardContent.vue source](https://github.com/vinicunca/akar/blob/v2.0.20/packages/core/src/HoverCard/HoverCardContent.vue)
| Data attribute | Value |
| --- | --- |
| `[data-state]` | "open" \\| "closed" |
| `[data-side]` | "left" \\| "right" \\| "bottom" \\| "top" |
| `[data-align]` | "start" \\| "end" \\| "center" |
| CSS variable | Description |
| --- | --- |
| `--akar-hover-card-content-transform-origin` | The `transform-origin` computed from the content and arrow positions/offsets |
| `--akar-hover-card-content-available-width` | The remaining width between the trigger and the boundary edge |
| `--akar-hover-card-content-available-height` | The remaining height between the trigger and the boundary edge |
| `--akar-hover-card-trigger-width` | The width of the trigger |
| `--akar-hover-card-trigger-height` | The height of the trigger |
### Arrow
An optional arrow element to render alongside the hover card. This can be used to help visually link the trigger with the `HoverCardContent`. Must be rendered inside `HoverCardContent`.
**Props**
| Prop | Default | Type | Description |
| --- | --- | --- | --- |
| `as` | `"svg"` | `AsTag \| Component` | The element or component this component should render as. Can be overwritten by `asChild`. |
| `asChild` | | `boolean` | Change the default rendered element for the one passed as a child, merging their props and behavior.
Read our [Composition](https://vinicunca.dev/akar/guides/composition) guide for more details. |
| `height` | `5` | `number` | The height of the arrow in pixels. |
| `rounded` | `false` | `boolean` | When `true`, render the rounded version of arrow. Do not work with `as`/`asChild` |
| `width` | `10` | `number` | The width of the arrow in pixels. |
[HoverCardArrow.vue source](https://github.com/vinicunca/akar/blob/v2.0.20/packages/core/src/HoverCard/HoverCardArrow.vue)
## Examples
### Show instantly
Use the `openDelay` prop to control the time it takes for the hover card to open.
```vue
Read our [Composition](https://vinicunca.dev/akar/guides/composition) guide for more details. |
| `for` | | `string` | The id of the element the label is associated with. |
[Label.vue source](https://github.com/vinicunca/akar/blob/v2.0.20/packages/core/src/Label/Label.vue)
## Accessibility
This component is based on the native `label` element, it will automatically apply the correct labelling when wrapping controls or using the `for` attribute. For your own custom controls to work correctly, ensure they use native elements such as `button` or `input` as a base.
---
- [GitHub](https://github.com/vinicunca/akar/blob/v2.0.20/packages/core/src/Label)
- [npm](https://www.npmjs.com/package/akar)
# Listbox
> A control that allows the user to toggle between checked and not checked.
```vue [index.vue]
Read our [Composition](https://vinicunca.dev/akar/guides/composition) guide for more details. |
| `by` | | `string \| ((a: AcceptableValue, b: AcceptableValue) => boolean)` | Use this to compare objects by a particular field, or pass your own comparison function for complete control over how objects are compared. |
| `defaultValue` | | `AcceptableValue \| AcceptableValue[]` | The value of the listbox when initially rendered. Use when you do not need to control the state of the Listbox |
| `dir` | | `"ltr" \| "rtl"` | The reading direction of the listbox when applicable.
If omitted, inherits globally from `ConfigProvider` or assumes LTR (left-to-right) reading mode. |
| `disabled` | | `boolean` | When `true`, prevents the user from interacting with listbox |
| `highlightOnHover` | | `boolean` | When `true`, hover over item will trigger highlight |
| `modelValue` | | `AcceptableValue \| AcceptableValue[]` | The controlled value of the listbox. Can be binded with `v-model`. |
| `multiple` | | `boolean` | Whether multiple options can be selected or not. |
| `name` | | `string` | The name of the field. Submitted with its owning form as part of a name/value pair. |
| `orientation` | `"vertical"` | `"vertical" \| "horizontal"` | The orientation of the listbox.
Mainly so arrow navigation is done accordingly (left & right vs. up & down) |
| `required` | | `boolean` | When `true`, indicates that the user must set the value before the owning form can be submitted. |
| `selectionBehavior` | `"toggle"` | `"replace" \| "toggle"` | How multiple selection should behave in the collection. |
**Events**
| Event | Payload | Description |
| --- | --- | --- |
| `entryFocus` | `event: CustomEvent
Read our [Composition](https://vinicunca.dev/akar/guides/composition) guide for more details. |
| `autoFocus` | | `boolean` | Focus on element when mounted. |
| `disabled` | | `boolean` | When `true`, prevents the user from interacting with item |
| `modelValue` | | `string` | The controlled value of the filter. Can be binded with v-model. |
**Events**
| Event | Payload | Description |
| --- | --- | --- |
| `update:modelValue` | `string` | |
**Slots**
| Slot | Payload | Description |
| --- | --- | --- |
| `modelValue` | `string` | Current input values |
[ListboxFilter.vue source](https://github.com/vinicunca/akar/blob/v2.0.20/packages/core/src/Listbox/ListboxFilter.vue)
| Data attribute | Value |
| --- | --- |
| `[data-disabled]` | Present when disabled |
### Content
Contains all the listbox group and items.
**Props**
| Prop | Default | Type | Description |
| --- | --- | --- | --- |
| `as` | `"div"` | `AsTag \| Component` | The element or component this component should render as. Can be overwritten by `asChild`. |
| `asChild` | | `boolean` | Change the default rendered element for the one passed as a child, merging their props and behavior.
Read our [Composition](https://vinicunca.dev/akar/guides/composition) guide for more details. |
[ListboxContent.vue source](https://github.com/vinicunca/akar/blob/v2.0.20/packages/core/src/Listbox/ListboxContent.vue)
### Item
The item component.
**Props**
| Prop | Default | Type | Description |
| --- | --- | --- | --- |
| `as` | `"div"` | `AsTag \| Component` | The element or component this component should render as. Can be overwritten by `asChild`. |
| `asChild` | | `boolean` | Change the default rendered element for the one passed as a child, merging their props and behavior.
Read our [Composition](https://vinicunca.dev/akar/guides/composition) guide for more details. |
| `disabled` | | `boolean` | When `true`, prevents the user from interacting with the item. |
| `value*` | | `T` | The value given as data when submitted with a `name`. |
**Events**
| Event | Payload | Description |
| --- | --- | --- |
| `select` | `event: SelectEvent
It can be prevented by calling `event.preventDefault`. |
**Slots**
| Slot | Payload | Description |
| --- | --- | --- |
| `selected` | `boolean` | Whether the item is currently selected |
[ListboxItem.vue source](https://github.com/vinicunca/akar/blob/v2.0.20/packages/core/src/Listbox/ListboxItem.vue)
| Data attribute | Value |
| --- | --- |
| `[data-state]` | "checked" \\| "unchecked" |
| `[data-highlighted]` | Present when highlighted |
| `[data-disabled]` | Present when disabled |
### ItemIndicator
Renders when the item is selected. You can style this element directly, or you can use it as a wrapper to put an icon into, or both.
**Props**
| Prop | Default | Type | Description |
| --- | --- | --- | --- |
| `as` | `"span"` | `AsTag \| Component` | The element or component this component should render as. Can be overwritten by `asChild`. |
| `asChild` | | `boolean` | Change the default rendered element for the one passed as a child, merging their props and behavior.
Read our [Composition](https://vinicunca.dev/akar/guides/composition) guide for more details. |
| `forceMount` | | `boolean` | Used to force mounting when more control is needed. Useful when
controlling animation with Vue animation libraries. |
[ListboxItemIndicator.vue source](https://github.com/vinicunca/akar/blob/v2.0.20/packages/core/src/Listbox/ListboxItemIndicator.vue)
### Group
Used to group multiple items. use in conjunction with `ListboxGroupLabel` to ensure good accessibility via automatic labelling.
**Props**
| Prop | Default | Type | Description |
| --- | --- | --- | --- |
| `as` | `"div"` | `AsTag \| Component` | The element or component this component should render as. Can be overwritten by `asChild`. |
| `asChild` | | `boolean` | Change the default rendered element for the one passed as a child, merging their props and behavior.
Read our [Composition](https://vinicunca.dev/akar/guides/composition) guide for more details. |
[ListboxGroup.vue source](https://github.com/vinicunca/akar/blob/v2.0.20/packages/core/src/Listbox/ListboxGroup.vue)
### GroupLabel
Used to render the label of a group. It won't be focusable using arrow keys.
**Props**
| Prop | Default | Type | Description |
| --- | --- | --- | --- |
| `as` | `"div"` | `AsTag \| Component` | The element or component this component should render as. Can be overwritten by `asChild`. |
| `asChild` | | `boolean` | Change the default rendered element for the one passed as a child, merging their props and behavior.
Read our [Composition](https://vinicunca.dev/akar/guides/composition) guide for more details. |
| `for` | | `string` | |
[ListboxGroupLabel.vue source](https://github.com/vinicunca/akar/blob/v2.0.20/packages/core/src/Listbox/ListboxGroupLabel.vue)
### Virtualizer
Virtual container to achieve list virtualization.
**Props**
| Prop | Default | Type | Description |
| --- | --- | --- | --- |
| `estimateSize` | | `number \| ((index: number) => number)` | Estimated size (in px) of each item |
| `options*` | | `T` | List of items |
| `overscan` | | `number` | Number of items rendered outside the visible area |
| `textContent` | | `((option: T) => string)` | Text content for each item to achieve type-ahead feature |
**Slots**
| Slot | Payload | Description |
| --- | --- | --- |
| `option` | `T` | |
| `virtualizer` | `Virtualizer
If omitted, inherits globally from `ConfigProvider` or assumes LTR (left-to-right) reading mode. |
| `loop` | `false` | `boolean` | When `true`, keyboard navigation will loop from last item to first, and vice versa. |
| `modelValue` | | `string` | The controlled value of the menu to open. Can be used as `v-model`. |
**Events**
| Event | Payload | Description |
| --- | --- | --- |
| `update:modelValue` | `value: boolean` | Event handler called when the value changes. |
**Slots**
| Slot | Payload | Description |
| --- | --- | --- |
| `modelValue` | `string` | Current input values |
[MenubarRoot.vue source](https://github.com/vinicunca/akar/blob/v2.0.20/packages/core/src/Menubar/MenubarRoot.vue)
### Menu
A top level menu item, contains a trigger with content combination.
**Props**
| Prop | Default | Type | Description |
| --- | --- | --- | --- |
| `value` | | `string` | A unique value that associates the item with an active value when the navigation menu is controlled.
This prop is managed automatically when uncontrolled. |
[MenubarMenu.vue source](https://github.com/vinicunca/akar/blob/v2.0.20/packages/core/src/Menubar/MenubarMenu.vue)
### Trigger
The button that toggles the content. By default, the `MenubarContent` will position itself against the trigger.
**Props**
| Prop | Default | Type | Description |
| --- | --- | --- | --- |
| `as` | `"button"` | `AsTag \| Component` | The element or component this component should render as. Can be overwritten by `asChild`. |
| `asChild` | | `boolean` | Change the default rendered element for the one passed as a child, merging their props and behavior.
Read our [Composition](https://vinicunca.dev/akar/guides/composition) guide for more details. |
| `disabled` | | `boolean` | When `true`, prevents the user from interacting with item |
[MenubarTrigger.vue source](https://github.com/vinicunca/akar/blob/v2.0.20/packages/core/src/Menubar/MenubarTrigger.vue)
| Data attribute | Value |
| --- | --- |
| `[data-state]` | "open" \\| "closed" |
| `[data-highlighted]` | Present when highlighted |
| `[data-disabled]` | Present when disabled |
### Portal
When used, portals the content part into the `body`.
**Props**
| Prop | Default | Type | Description |
| --- | --- | --- | --- |
| `defer` | | `boolean` | Defer the resolving of a Teleport target until other parts of the
application have mounted (requires Vue 3.5.0+)
[reference](https://vuejs.org/guide/built-ins/teleport.html#deferred-teleport) |
| `disabled` | | `boolean` | Disable teleport and render the component inline
[reference](https://vuejs.org/guide/built-ins/teleport.html#disabling-teleport) |
| `forceMount` | | `boolean` | Used to force mounting when more control is needed. Useful when
controlling animation with Vue animation libraries. |
| `to` | | `string \| HTMLElement` | Vue native teleport component prop `:to`
[reference](https://vuejs.org/guide/built-ins/teleport.html#basic-usage) |
[MenubarPortal.vue source](https://github.com/vinicunca/akar/blob/v2.0.20/packages/core/src/Menubar/MenubarPortal.vue)
### Content
The component that pops out when a menu is open.
**Props**
| Prop | Default | Type | Description |
| --- | --- | --- | --- |
| `align` | `"start"` | `"start" \| "center" \| "end"` | The preferred alignment against the trigger.
May change when collisions occur. |
| `alignFlip` | `true` | `boolean` | Flip alignment when colliding with boundary.
May only occur when `prioritizePosition` is true. |
| `alignOffset` | `0` | `number` | An offset in pixels from the `start` or `end` alignment options. |
| `arrowPadding` | `0` | `number` | The padding between the arrow and the edges of the content.
If your content has border-radius, this will prevent it from
overflowing the corners. |
| `as` | `"div"` | `AsTag \| Component` | The element or component this component should render as. Can be overwritten by `asChild`. |
| `asChild` | | `boolean` | Change the default rendered element for the one passed as a child, merging their props and behavior.
Read our [Composition](https://vinicunca.dev/akar/guides/composition) guide for more details. |
| `avoidCollisions` | `true` | `boolean` | When `true`, overrides the side and align preferences
to prevent collisions with boundary edges. |
| `collisionBoundary` | `[]` | `Element \| (Element \| null)[] \| null` | The element used as the collision boundary. By default
this is the viewport, though you can provide additional
element(s) to be included in this check. |
| `collisionPadding` | `0` | `number \| Partial
detection should occur. Accepts a number (same for all sides),
or a partial padding object, for example: { top: 20, left: 20 }. |
| `disableUpdateOnLayoutShift` | `false` | `boolean` | Whether to disable the update position for the content when the layout shifted. |
| `forceMount` | | `boolean` | Used to force mounting when more control is needed. Useful when
controlling animation with Vue animation libraries. |
| `hideShiftedArrow` | `true` | `boolean` | When `true`, hides the arrow when it cannot be centered
to the reference element. |
| `hideWhenDetached` | `false` | `boolean` | Whether to hide the content when the trigger becomes fully occluded. |
| `loop` | `false` | `boolean` | When `true`, keyboard navigation will loop from last item to first, and vice versa. |
| `memoDependencies` | | `unknown[]` | Reactive dependencies that should invalidate the memoized content subtree. |
| `positionStrategy` | | `"fixed" \| "absolute"` | The type of CSS position property to use. |
| `prioritizePosition` | `false` | `boolean` | Force content to be position within the viewport.
Might overlap the reference element, which may not be desired. |
| `reference` | | `ReferenceElement` | The custom element or virtual element that will be set as the reference
to position the floating element.
If provided, it will replace the default anchor element. |
| `side` | `"bottom"` | `"top" \| "right" \| "bottom" \| "left"` | The preferred side of the trigger to render against when open.
Will be reversed when collisions occur and avoidCollisions
is enabled. |
| `sideFlip` | `true` | `boolean` | Flip to the opposite side when colliding with boundary. |
| `sideOffset` | `0` | `number` | The distance in pixels from the trigger. |
| `sticky` | `"partial"` | `"partial" \| "always"` | The sticky behavior on the align axis. `partial` will keep the
content in the boundary as long as the trigger is at least partially
in the boundary whilst "always" will keep the content in the boundary
regardless. |
| `updatePositionStrategy` | `'optimized'` | `"always" \| "optimized"` | Strategy to update the position of the floating element on every animation frame. |
**Events**
| Event | Payload | Description |
| --- | --- | --- |
| `closeAutoFocus` | `event: Event` | Event handler called when auto-focusing on close.
Can be prevented. |
| `escapeKeyDown` | `event: KeyboardEvent` | Event handler called when the escape key is down.
Can be prevented. |
| `focusOutside` | `event: FocusOutsideEvent` | Event handler called when the focus moves outside of the `DismissableLayer`.
Can be prevented. |
| `interactOutside` | `event: PointerDownOutsideEvent \| FocusOutsideEvent` | Event handler called when an interaction happens outside the `DismissableLayer`.
Specifically, when a `pointerdown` event happens outside or focus moves outside of it.
Can be prevented. |
| `openAutoFocus` | `event: Event` | |
| `pointerDownOutside` | `event: PointerDownOutsideEvent` | Event handler called when a `pointerdown` event happens outside of the `DismissableLayer`.
Can be prevented. |
[MenubarContent.vue source](https://github.com/vinicunca/akar/blob/v2.0.20/packages/core/src/Menubar/MenubarContent.vue)
| Data attribute | Value |
| --- | --- |
| `[data-state]` | "open" \\| "closed" |
| `[data-side]` | "left" \\| "right" \\| "bottom" \\| "top" |
| `[data-align]` | "start" \\| "end" \\| "center" |
| CSS variable | Description |
| --- | --- |
| `--akar-menubar-content-transform-origin` | The `transform-origin` computed from the content and arrow positions/offsets |
| `--akar-menubar-content-available-width` | The remaining width between the trigger and the boundary edge |
| `--akar-menubar-content-available-height` | The remaining height between the trigger and the boundary edge |
| `--akar-menubar-trigger-width` | The width of the trigger |
| `--akar-menubar-trigger-height` | The height of the trigger |
### Arrow
An optional arrow element to render alongside a menubar menu. This can be used to help visually link the trigger with the `MenubarContent`. Must be rendered inside `MenubarContent`.
**Props**
| Prop | Default | Type | Description |
| --- | --- | --- | --- |
| `as` | `"svg"` | `AsTag \| Component` | The element or component this component should render as. Can be overwritten by `asChild`. |
| `asChild` | | `boolean` | Change the default rendered element for the one passed as a child, merging their props and behavior.
Read our [Composition](https://vinicunca.dev/akar/guides/composition) guide for more details. |
| `height` | `5` | `number` | The height of the arrow in pixels. |
| `rounded` | `false` | `boolean` | When `true`, render the rounded version of arrow. Do not work with `as`/`asChild` |
| `width` | `10` | `number` | The width of the arrow in pixels. |
[MenubarArrow.vue source](https://github.com/vinicunca/akar/blob/v2.0.20/packages/core/src/Menubar/MenubarArrow.vue)
### Item
The component that contains the menubar items.
**Props**
| Prop | Default | Type | Description |
| --- | --- | --- | --- |
| `as` | `"div"` | `AsTag \| Component` | The element or component this component should render as. Can be overwritten by `asChild`. |
| `asChild` | | `boolean` | Change the default rendered element for the one passed as a child, merging their props and behavior.
Read our [Composition](https://vinicunca.dev/akar/guides/composition) guide for more details. |
| `disabled` | | `boolean` | When `true`, prevents the user from interacting with the item. |
| `textValue` | | `string` | Optional text used for typeahead purposes. By default the typeahead behavior will use the `.textContent` of the item.
Use this when the content is complex, or you have non-textual content inside. |
**Events**
| Event | Payload | Description |
| --- | --- | --- |
| `select` | `event: Event` | Event handler called when the user selects an item (via mouse or keyboard).
Calling `event.preventDefault` in this handler will prevent the menu from closing when selecting that item. |
[MenubarItem.vue source](https://github.com/vinicunca/akar/blob/v2.0.20/packages/core/src/Menubar/MenubarItem.vue)
| Data attribute | Value |
| --- | --- |
| `[data-highlighted]` | Present when highlighted |
| `[data-disabled]` | Present when disabled |
### Group
Used to group multiple `MenubarItem`s.
**Props**
| Prop | Default | Type | Description |
| --- | --- | --- | --- |
| `as` | `"div"` | `AsTag \| Component` | The element or component this component should render as. Can be overwritten by `asChild`. |
| `asChild` | | `boolean` | Change the default rendered element for the one passed as a child, merging their props and behavior.
Read our [Composition](https://vinicunca.dev/akar/guides/composition) guide for more details. |
[MenubarGroup.vue source](https://github.com/vinicunca/akar/blob/v2.0.20/packages/core/src/Menubar/MenubarGroup.vue)
### Label
Used to render a label. It won't be focusable using arrow keys.
**Props**
| Prop | Default | Type | Description |
| --- | --- | --- | --- |
| `as` | `"div"` | `AsTag \| Component` | The element or component this component should render as. Can be overwritten by `asChild`. |
| `asChild` | | `boolean` | Change the default rendered element for the one passed as a child, merging their props and behavior.
Read our [Composition](https://vinicunca.dev/akar/guides/composition) guide for more details. |
[MenubarLabel.vue source](https://github.com/vinicunca/akar/blob/v2.0.20/packages/core/src/Menubar/MenubarLabel.vue)
### CheckboxItem
An item that can be controlled and rendered like a checkbox.
**Props**
| Prop | Default | Type | Description |
| --- | --- | --- | --- |
| `as` | `"div"` | `AsTag \| Component` | The element or component this component should render as. Can be overwritten by `asChild`. |
| `asChild` | | `boolean` | Change the default rendered element for the one passed as a child, merging their props and behavior.
Read our [Composition](https://vinicunca.dev/akar/guides/composition) guide for more details. |
| `disabled` | | `boolean` | When `true`, prevents the user from interacting with the item. |
| `modelValue` | | `false \| true \| "indeterminate"` | The controlled checked state of the item. Can be used as `v-model`. |
| `textValue` | | `string` | Optional text used for typeahead purposes. By default the typeahead behavior will use the `.textContent` of the item.
Use this when the content is complex, or you have non-textual content inside. |
**Events**
| Event | Payload | Description |
| --- | --- | --- |
| `select` | `event: Event` | Event handler called when the user selects an item (via mouse or keyboard).
Calling `event.preventDefault` in this handler will prevent the menu from closing when selecting that item. |
| `update:modelValue` | `payload: boolean` | Event handler called when the checked state changes. |
**Slots**
| Slot | Payload | Description |
| --- | --- | --- |
| `checked` | `false \| true \| "indeterminate"` | Current checked state |
| `modelValue` | `CheckedState` | Current modelValue state |
[MenubarCheckboxItem.vue source](https://github.com/vinicunca/akar/blob/v2.0.20/packages/core/src/Menubar/MenubarCheckboxItem.vue)
| Data attribute | Value |
| --- | --- |
| `[data-state]` | "checked" \\| "unchecked" |
| `[data-highlighted]` | Present when highlighted |
| `[data-disabled]` | Present when disabled |
### RadioGroup
Used to group multiple `MenubarRadioItem`s.
**Props**
| Prop | Default | Type | Description |
| --- | --- | --- | --- |
| `as` | `"div"` | `AsTag \| Component` | The element or component this component should render as. Can be overwritten by `asChild`. |
| `asChild` | | `boolean` | Change the default rendered element for the one passed as a child, merging their props and behavior.
Read our [Composition](https://vinicunca.dev/akar/guides/composition) guide for more details. |
| `modelValue` | | `AcceptableValue` | The value of the selected item in the group. |
**Events**
| Event | Payload | Description |
| --- | --- | --- |
| `update:modelValue` | `payload: AcceptableValue` | Event handler called when the value changes. |
[MenubarRadioGroup.vue source](https://github.com/vinicunca/akar/blob/v2.0.20/packages/core/src/Menubar/MenubarRadioGroup.vue)
### RadioItem
An item that can be controlled and rendered like a radio.
**Props**
| Prop | Default | Type | Description |
| --- | --- | --- | --- |
| `as` | `"div"` | `AsTag \| Component` | The element or component this component should render as. Can be overwritten by `asChild`. |
| `asChild` | | `boolean` | Change the default rendered element for the one passed as a child, merging their props and behavior.
Read our [Composition](https://vinicunca.dev/akar/guides/composition) guide for more details. |
| `disabled` | | `boolean` | When `true`, prevents the user from interacting with the item. |
| `textValue` | | `string` | Optional text used for typeahead purposes. By default the typeahead behavior will use the `.textContent` of the item.
Use this when the content is complex, or you have non-textual content inside. |
| `value*` | | `AcceptableValue` | The unique value of the item. |
**Events**
| Event | Payload | Description |
| --- | --- | --- |
| `select` | `event: Event` | Event handler called when the user selects an item (via mouse or keyboard).
Calling `event.preventDefault` in this handler will prevent the menu from closing when selecting that item. |
**Slots**
| Slot | Payload | Description |
| --- | --- | --- |
| `checked` | `boolean` | Current checked state |
[MenubarRadioItem.vue source](https://github.com/vinicunca/akar/blob/v2.0.20/packages/core/src/Menubar/MenubarRadioItem.vue)
| Data attribute | Value |
| --- | --- |
| `[data-state]` | "checked" \\| "unchecked" |
| `[data-highlighted]` | Present when highlighted |
| `[data-disabled]` | Present when disabled |
### ItemIndicator
Renders when the parent `MenubarCheckboxItem` or `MenubarRadioItem` is checked. You can style this element directly, or you can use it as a wrapper to put an icon into, or both.
**Props**
| Prop | Default | Type | Description |
| --- | --- | --- | --- |
| `as` | `"div"` | `AsTag \| Component` | The element or component this component should render as. Can be overwritten by `asChild`. |
| `asChild` | | `boolean` | Change the default rendered element for the one passed as a child, merging their props and behavior.
Read our [Composition](https://vinicunca.dev/akar/guides/composition) guide for more details. |
| `forceMount` | | `boolean` | Used to force mounting when more control is needed. Useful when
controlling animation with Vue animation libraries. |
[MenubarItemIndicator.vue source](https://github.com/vinicunca/akar/blob/v2.0.20/packages/core/src/Menubar/MenubarItemIndicator.vue)
| Data attribute | Value |
| --- | --- |
| `[data-state]` | "checked" \\| "unchecked" |
### Separator
Used to visually separate items in a menubar menu.
**Props**
| Prop | Default | Type | Description |
| --- | --- | --- | --- |
| `as` | `"div"` | `AsTag \| Component` | The element or component this component should render as. Can be overwritten by `asChild`. |
| `asChild` | | `boolean` | Change the default rendered element for the one passed as a child, merging their props and behavior.
Read our [Composition](https://vinicunca.dev/akar/guides/composition) guide for more details. |
[MenubarSeparator.vue source](https://github.com/vinicunca/akar/blob/v2.0.20/packages/core/src/Menubar/MenubarSeparator.vue)
### Sub
Contains all the parts of a submenu.
**Props**
| Prop | Default | Type | Description |
| --- | --- | --- | --- |
| `defaultOpen` | | `boolean` | The open state of the submenu when it is initially rendered. Use when you do not need to control its open state. |
| `open` | | `boolean` | The controlled open state of the menu. Can be used as `v-model:open`. |
**Events**
| Event | Payload | Description |
| --- | --- | --- |
| `update:open` | `payload: boolean` | Event handler called when the open state of the submenu changes. |
**Slots**
| Slot | Payload | Description |
| --- | --- | --- |
| `open` | `boolean` | Current open state |
[MenubarSub.vue source](https://github.com/vinicunca/akar/blob/v2.0.20/packages/core/src/Menubar/MenubarSub.vue)
### SubTrigger
An item that opens a submenu. Must be rendered inside `MenubarSub`.
**Props**
| Prop | Default | Type | Description |
| --- | --- | --- | --- |
| `as` | `"div"` | `AsTag \| Component` | The element or component this component should render as. Can be overwritten by `asChild`. |
| `asChild` | | `boolean` | Change the default rendered element for the one passed as a child, merging their props and behavior.
Read our [Composition](https://vinicunca.dev/akar/guides/composition) guide for more details. |
| `disabled` | | `boolean` | When `true`, prevents the user from interacting with the item. |
| `graceDuration` | `300` | `number` | Time in milliseconds to keep a submenu open while the pointer moves from
its trigger to the submenu. |
| `textValue` | | `string` | Optional text used for typeahead purposes. By default the typeahead behavior will use the `.textContent` of the item.
Use this when the content is complex, or you have non-textual content inside. |
[MenubarSubTrigger.vue source](https://github.com/vinicunca/akar/blob/v2.0.20/packages/core/src/Menubar/MenubarSubTrigger.vue)
| Data attribute | Value |
| --- | --- |
| `[data-state]` | "open" \\| "closed" |
| `[data-highlighted]` | Present when highlighted |
| `[data-disabled]` | Present when disabled |
### SubContent
The component that pops out when a submenu is open. Must be rendered inside `MenubarSub`.
**Props**
| Prop | Default | Type | Description |
| --- | --- | --- | --- |
| `alignFlip` | `true` | `boolean` | Flip alignment when colliding with boundary.
May only occur when `prioritizePosition` is true. |
| `alignOffset` | `0` | `number` | An offset in pixels from the `start` or `end` alignment options. |
| `arrowPadding` | `0` | `number` | The padding between the arrow and the edges of the content.
If your content has border-radius, this will prevent it from
overflowing the corners. |
| `as` | `"div"` | `AsTag \| Component` | The element or component this component should render as. Can be overwritten by `asChild`. |
| `asChild` | | `boolean` | Change the default rendered element for the one passed as a child, merging their props and behavior.
Read our [Composition](https://vinicunca.dev/akar/guides/composition) guide for more details. |
| `avoidCollisions` | `true` | `boolean` | When `true`, overrides the side and align preferences
to prevent collisions with boundary edges. |
| `collisionBoundary` | `[]` | `Element \| (Element \| null)[] \| null` | The element used as the collision boundary. By default
this is the viewport, though you can provide additional
element(s) to be included in this check. |
| `collisionPadding` | `0` | `number \| Partial
detection should occur. Accepts a number (same for all sides),
or a partial padding object, for example: { top: 20, left: 20 }. |
| `disableUpdateOnLayoutShift` | `false` | `boolean` | Whether to disable the update position for the content when the layout shifted. |
| `forceMount` | | `boolean` | Used to force mounting when more control is needed. Useful when
controlling animation with Vue animation libraries. |
| `hideShiftedArrow` | `true` | `boolean` | When `true`, hides the arrow when it cannot be centered
to the reference element. |
| `hideWhenDetached` | `false` | `boolean` | Whether to hide the content when the trigger becomes fully occluded. |
| `loop` | `false` | `boolean` | When `true`, keyboard navigation will loop from last item to first, and vice versa. |
| `memoDependencies` | | `unknown[]` | Reactive dependencies that should invalidate the memoized content subtree. |
| `positionStrategy` | | `"fixed" \| "absolute"` | The type of CSS position property to use. |
| `prioritizePosition` | `false` | `boolean` | Force content to be position within the viewport.
Might overlap the reference element, which may not be desired. |
| `reference` | | `ReferenceElement` | The custom element or virtual element that will be set as the reference
to position the floating element.
If provided, it will replace the default anchor element. |
| `sideFlip` | `true` | `boolean` | Flip to the opposite side when colliding with boundary. |
| `sideOffset` | `0` | `number` | The distance in pixels from the trigger. |
| `sticky` | `"partial"` | `"partial" \| "always"` | The sticky behavior on the align axis. `partial` will keep the
content in the boundary as long as the trigger is at least partially
in the boundary whilst "always" will keep the content in the boundary
regardless. |
| `updatePositionStrategy` | `'optimized'` | `"always" \| "optimized"` | Strategy to update the position of the floating element on every animation frame. |
**Events**
| Event | Payload | Description |
| --- | --- | --- |
| `closeAutoFocus` | `event: Event` | Event handler called when auto-focusing on close.
Can be prevented. |
| `entryFocus` | `event: Event` | |
| `escapeKeyDown` | `event: KeyboardEvent` | Event handler called when the escape key is down.
Can be prevented. |
| `focusOutside` | `event: FocusOutsideEvent` | Event handler called when the focus moves outside of the `DismissableLayer`.
Can be prevented. |
| `interactOutside` | `event: PointerDownOutsideEvent \| FocusOutsideEvent` | Event handler called when an interaction happens outside the `DismissableLayer`.
Specifically, when a `pointerdown` event happens outside or focus moves outside of it.
Can be prevented. |
| `openAutoFocus` | `event: Event` | |
| `pointerDownOutside` | `event: PointerDownOutsideEvent` | Event handler called when a `pointerdown` event happens outside of the `DismissableLayer`.
Can be prevented. |
[MenubarSubContent.vue source](https://github.com/vinicunca/akar/blob/v2.0.20/packages/core/src/Menubar/MenubarSubContent.vue)
| Data attribute | Value |
| --- | --- |
| `[data-state]` | "open" \\| "closed" |
| `[data-side]` | "left" \\| "right" \\| "bottom" \\| "top" |
| `[data-align]` | "start" \\| "end" \\| "center" |
| `[data-orientation]` | "vertical" \\| "horizontal" |
| CSS variable | Description |
| --- | --- |
| `--akar-menubar-content-transform-origin` | The `transform-origin` computed from the content and arrow positions/offsets |
| `--akar-menubar-content-available-width` | The remaining width between the trigger and the boundary edge |
| `--akar-menubar-content-available-height` | The remaining height between the trigger and the boundary edge |
| `--akar-menubar-trigger-width` | The width of the trigger |
| `--akar-menubar-trigger-height` | The height of the trigger |
## Examples
### With submenus
You can create submenus by using `MenubarSub` in combination with its parts.
```vue
Adolfo Hess
Miyah Myles
MenubarTrigger, opens the associated menu.
When focus is on an item, activates the focused item.
`,
},
{
keys: ['ArrowDown'],
description: `
When focus is on MenubarTrigger, opens the associated menu.
When focus is on an item, moves focus to the next item.
`,
},
{
keys: ['ArrowUp'],
description: `When focus is on an item, moves focus to the previous item.`,
},
{
keys: ['ArrowRight', 'ArrowLeft'],
description: `
When focus is on a MenubarTrigger, moves focus to the next or previous item.
When focus is on a MenubarSubTrigger, opens or closes the submenu depending on reading direction.
When focus is within a MenubarContent, opens the next menu in the menubar
`,
},
{
keys: ['Esc'],
description: `
Closes the currently open menu and moves focus to its MenubarTrigger.
`,
},
```
]"
/>
---
- [ARIA](https://www.w3.org/WAI/ARIA/apg/patterns/menu/)
- [GitHub](https://github.com/vinicunca/akar/blob/v2.0.20/packages/core/src/Menubar)
- [npm](https://www.npmjs.com/package/akar)
# MonthPicker
> Presents a calendar view tailored for selecting months.
## Month Picker
`````vue [index.vue]
Read our [Composition](/akar/guides/composition) guide for more details. |
| `calendarLabel` | | `string` | The accessible label for the month picker |
| `defaultPlaceholder` | | `DateValue` | The default placeholder date |
| `defaultValue` | | `DateValue` | The default value for the month picker |
| `dir` | | `"ltr" \| "rtl"` | The reading direction of the calendar when applicable. If omitted, inherits globally from `ConfigProvider` or assumes LTR. |
| `disabled` | `false` | `boolean` | Whether the month picker is disabled |
| `initialFocus` | `false` | `boolean` | If true, the month picker will focus the selected month, today, or the first month of the year on mount |
| `isMonthDisabled` | | `Matcher` | A function that returns whether or not a month is disabled |
| `isMonthUnavailable` | | `Matcher` | A function that returns whether or not a month is unavailable |
| `locale` | | `string` | The locale to use for formatting dates |
| `maxValue` | | `DateValue` | The maximum date that can be selected |
| `minValue` | | `DateValue` | The minimum date that can be selected |
| `modelValue` | | `DateValue \| DateValue[] \| null` | The controlled selected month value of the month picker. Can be bound as `v-model`. |
| `multiple` | `false` | `boolean` | Whether multiple months can be selected |
| `nextPage` | | `((placeholder: DateValue) => DateValue)` | A function that returns the next page of the month picker. Receives the current placeholder as an argument. |
| `placeholder` | | `DateValue` | The placeholder date, which is used to determine what year to display when no date is selected |
| `preventDeselect` | `false` | `boolean` | Whether or not to prevent the user from deselecting a date without selecting another date first |
| `prevPage` | | `((placeholder: DateValue) => DateValue)` | A function that returns the previous page of the month picker. Receives the current placeholder as an argument. |
| `readonly` | `false` | `boolean` | Whether the month picker is readonly |
**Events**
| Event | Payload | Description |
| --- | --- | --- |
| `update:modelValue` | `date: DateValue \| DateValue[]` | Event handler called whenever the model value changes |
| `update:placeholder` | `date: DateValue` | Event handler called whenever the placeholder value changes |
**Slots**
| Slot | Payload | Description |
| --- | --- | --- |
| `date` | `DateValue` | The current date of the placeholder |
| `grid` | `Grid
Read our [Composition](/akar/guides/composition) guide for more details. |
[MonthPickerHeader.vue source](https://github.com/vinicunca/akar/blob/v2.0.20/packages/core/src/MonthPicker/MonthPickerHeader.vue)
### Prev Button
Calendar navigation button. It navigates the calendar one year in the past.
**Props**
| Prop | Default | Type | Description |
| --- | --- | --- | --- |
| `as` | `"button"` | `AsTag \| Component` | The element or component this component should render as. Can be overwritten by `asChild`. |
| `asChild` | | `boolean` | Change the default rendered element for the one passed as a child, merging their props and behavior.
Read our [Composition](/akar/guides/composition) guide for more details. |
| `prevPage` | | `((placeholder: DateValue) => DateValue)` | The function to be used for the prev page. Overwrites the `prevPage` function set on the `MonthPickerRoot`. |
**Slots**
| Slot | Payload | Description |
| --- | --- | --- |
| `disabled` | `boolean` | Current disable state |
[MonthPickerPrev.vue source](https://github.com/vinicunca/akar/blob/v2.0.20/packages/core/src/MonthPicker/MonthPickerPrev.vue)
| Data attribute | Value |
| --- | --- |
| `[data-disabled]` | Present when disabled |
### Next Button
Calendar navigation button. It navigates the calendar one year in the future.
**Props**
| Prop | Default | Type | Description |
| --- | --- | --- | --- |
| `as` | `"button"` | `AsTag \| Component` | The element or component this component should render as. Can be overwritten by `asChild`. |
| `asChild` | | `boolean` | Change the default rendered element for the one passed as a child, merging their props and behavior.
Read our [Composition](/akar/guides/composition) guide for more details. |
| `nextPage` | | `((placeholder: DateValue) => DateValue)` | The function to be used for the next page. Overwrites the `nextPage` function set on the `MonthPickerRoot`. |
**Slots**
| Slot | Payload | Description |
| --- | --- | --- |
| `disabled` | `boolean` | Current disable state |
[MonthPickerNext.vue source](https://github.com/vinicunca/akar/blob/v2.0.20/packages/core/src/MonthPicker/MonthPickerNext.vue)
| Data attribute | Value |
| --- | --- |
| `[data-disabled]` | Present when disabled |
### Heading
Heading for displaying the current year.
**Props**
| Prop | Default | Type | Description |
| --- | --- | --- | --- |
| `as` | `"div"` | `AsTag \| Component` | The element or component this component should render as. Can be overwritten by `asChild`. |
| `asChild` | | `boolean` | Change the default rendered element for the one passed as a child, merging their props and behavior.
Read our [Composition](/akar/guides/composition) guide for more details. |
**Slots**
| Slot | Payload | Description |
| --- | --- | --- |
| `headingValue` | `string` | Current year heading |
[MonthPickerHeading.vue source](https://github.com/vinicunca/akar/blob/v2.0.20/packages/core/src/MonthPicker/MonthPickerHeading.vue)
| Data attribute | Value |
| --- | --- |
| `[data-disabled]` | Present when disabled |
### Grid
Container for wrapping the month picker grid.
**Props**
| Prop | Default | Type | Description |
| --- | --- | --- | --- |
| `as` | `"table"` | `AsTag \| Component` | The element or component this component should render as. Can be overwritten by `asChild`. |
| `asChild` | | `boolean` | Change the default rendered element for the one passed as a child, merging their props and behavior.
Read our [Composition](/akar/guides/composition) guide for more details. |
[MonthPickerGrid.vue source](https://github.com/vinicunca/akar/blob/v2.0.20/packages/core/src/MonthPicker/MonthPickerGrid.vue)
| Data attribute | Value |
| --- | --- |
| `[data-readonly]` | Present when readonly |
| `[data-disabled]` | Present when disabled |
### Grid Body
Container for wrapping the grid body.
**Props**
| Prop | Default | Type | Description |
| --- | --- | --- | --- |
| `as` | `"tbody"` | `AsTag \| Component` | The element or component this component should render as. Can be overwritten by `asChild`. |
| `asChild` | | `boolean` | Change the default rendered element for the one passed as a child, merging their props and behavior.
Read our [Composition](/akar/guides/composition) guide for more details. |
[MonthPickerGridBody.vue source](https://github.com/vinicunca/akar/blob/v2.0.20/packages/core/src/MonthPicker/MonthPickerGridBody.vue)
### Grid Row
Container for wrapping the grid row.
**Props**
| Prop | Default | Type | Description |
| --- | --- | --- | --- |
| `as` | `"tr"` | `AsTag \| Component` | The element or component this component should render as. Can be overwritten by `asChild`. |
| `asChild` | | `boolean` | Change the default rendered element for the one passed as a child, merging their props and behavior.
Read our [Composition](/akar/guides/composition) guide for more details. |
[MonthPickerGridRow.vue source](https://github.com/vinicunca/akar/blob/v2.0.20/packages/core/src/MonthPicker/MonthPickerGridRow.vue)
### Cell
Container for wrapping the month picker cells.
**Props**
| Prop | Default | Type | Description |
| --- | --- | --- | --- |
| `as` | `"td"` | `AsTag \| Component` | The element or component this component should render as. Can be overwritten by `asChild`. |
| `asChild` | | `boolean` | Change the default rendered element for the one passed as a child, merging their props and behavior.
Read our [Composition](/akar/guides/composition) guide for more details. |
| `date*` | | `DateValue` | The date value for the cell |
[MonthPickerCell.vue source](https://github.com/vinicunca/akar/blob/v2.0.20/packages/core/src/MonthPicker/MonthPickerCell.vue)
| Data attribute | Value |
| --- | --- |
| `[data-disabled]` | Present when disabled |
### Cell Trigger
Interactable container for displaying the cell months. Clicking it selects the month.
**Props**
| Prop | Default | Type | Description |
| --- | --- | --- | --- |
| `as` | `"div"` | `AsTag \| Component` | The element or component this component should render as. Can be overwritten by `asChild`. |
| `asChild` | | `boolean` | Change the default rendered element for the one passed as a child, merging their props and behavior.
Read our [Composition](/akar/guides/composition) guide for more details. |
| `month*` | | `DateValue` | The date value provided to the cell trigger |
**Slots**
| Slot | Payload | Description |
| --- | --- | --- |
| `monthValue` | `string` | Current month value (short name) |
| `disabled` | `boolean` | Current disable state |
| `selected` | `boolean` | Current selected state |
| `today` | `boolean` | Current month/year is today state |
| `unavailable` | `boolean` | Current unavailable state |
[MonthPickerCellTrigger.vue source](https://github.com/vinicunca/akar/blob/v2.0.20/packages/core/src/MonthPicker/MonthPickerCellTrigger.vue)
| Data attribute | Value |
| --- | --- |
| `[data-selected]` | Present when selected |
| `[data-value]` | The ISO string value of the date. |
| `[data-disabled]` | Present when disabled |
| `[data-unavailable]` | Present when unavailable |
| `[data-today]` | Present when the month is the current month |
| `[data-focused]` | Present when focused |
## Accessibility
### Keyboard Interactions
| Key | Description |
| --- | --- |
| Tab | When focus moves onto the month picker, focuses the first navigation button. |
| Space | When the focus is on either `MonthPickerNext` or `MonthPickerPrev`, it navigates the calendar. Otherwise, it selects the month. |
| Enter | When the focus is on either `MonthPickerNext` or `MonthPickerPrev`, it navigates the calendar. Otherwise, it selects the month. |
| ArrowLeft / ArrowRight / ArrowUp / ArrowDown | When the focus is on `MonthPickerCellTrigger`, it navigates the months, changing the year if necessary. |
| PageUp | When the focus is on `MonthPickerCellTrigger`, it navigates to the same month in the previous year. |
| PageDown | When the focus is on `MonthPickerCellTrigger`, it navigates to the same month in the next year. |
---
- [GitHub](https://github.com/vinicunca/akar/blob/v2.0.20/packages/core/src/MonthPicker)
- [npm](https://www.npmjs.com/package/akar)
# MonthRangePicker
> Presents a calendar view tailored for selecting month ranges.
## Month Range Picker
`````vue [index.vue]
Read our [Composition](/akar/guides/composition) guide for more details. |
| `calendarLabel` | | `string` | The accessible label for the calendar |
| `defaultPlaceholder` | | `DateValue` | The default placeholder date |
| `defaultValue` | `{ start: undefined, end: undefined }` | `DateRange` | The default value for the calendar |
| `dir` | | `"ltr" \| "rtl"` | The reading direction of the calendar when applicable. |
| `disabled` | `false` | `boolean` | Whether or not the calendar is disabled |
| `fixedDate` | | `"start" \| "end"` | Which part of the range should be fixed |
| `initialFocus` | `false` | `boolean` | If true, the calendar will focus the selected month on mount |
| `isMonthDisabled` | | `Matcher` | A function that returns whether or not a month is disabled |
| `isMonthUnavailable` | | `Matcher` | A function that returns whether or not a month is unavailable |
| `locale` | | `string` | The locale to use for formatting dates |
| `maximumMonths` | | `number` | The maximum number of months that can be selected in a range |
| `maxValue` | | `DateValue` | The maximum date that can be selected |
| `minValue` | | `DateValue` | The minimum date that can be selected |
| `modelValue` | | `DateRange \| null` | The controlled selected month range of the month range picker. Can be bound as `v-model`. |
| `nextPage` | | `((placeholder: DateValue) => DateValue)` | A function that returns the next page of the calendar. |
| `placeholder` | | `DateValue` | The placeholder date, which is used to determine what year to display when no date is selected. |
| `preventDeselect` | `false` | `boolean` | Whether or not to prevent the user from deselecting a date without selecting another date first |
| `prevPage` | | `((placeholder: DateValue) => DateValue)` | A function that returns the previous page of the calendar. |
| `readonly` | `false` | `boolean` | Whether or not the calendar is readonly |
**Events**
| Event | Payload | Description |
| --- | --- | --- |
| `update:modelValue` | `date: DateRange` | Event handler called whenever the model value changes |
| `update:placeholder` | `date: DateValue` | Event handler called whenever the placeholder value changes |
| `update:startValue` | `date: DateValue` | Event handler called whenever the start value changes |
**Slots**
| Slot | Payload | Description |
| --- | --- | --- |
| `date` | `DateValue` | The current date of the placeholder |
| `grid` | `Grid
Read our [Composition](/akar/guides/composition) guide for more details. |
[MonthRangePickerHeader.vue source](https://github.com/vinicunca/akar/blob/v2.0.20/packages/core/src/MonthRangePicker/MonthRangePickerHeader.vue)
### Prev Button
Calendar navigation button. It navigates the calendar one year in the past.
**Props**
| Prop | Default | Type | Description |
| --- | --- | --- | --- |
| `as` | `"button"` | `AsTag \| Component` | The element or component this component should render as. Can be overwritten by `asChild`. |
| `asChild` | | `boolean` | Change the default rendered element for the one passed as a child, merging their props and behavior.
Read our [Composition](/akar/guides/composition) guide for more details. |
| `prevPage` | | `((placeholder: DateValue) => DateValue)` | The function to be used for the prev page. Overwrites the `prevPage` function set on the Root. |
**Slots**
| Slot | Payload | Description |
| --- | --- | --- |
| `disabled` | `boolean` | Current disable state |
[MonthRangePickerPrev.vue source](https://github.com/vinicunca/akar/blob/v2.0.20/packages/core/src/MonthRangePicker/MonthRangePickerPrev.vue)
| Data attribute | Value |
| --- | --- |
| `[data-disabled]` | Present when disabled |
### Next Button
Calendar navigation button. It navigates the calendar one year in the future.
**Props**
| Prop | Default | Type | Description |
| --- | --- | --- | --- |
| `as` | `"button"` | `AsTag \| Component` | The element or component this component should render as. Can be overwritten by `asChild`. |
| `asChild` | | `boolean` | Change the default rendered element for the one passed as a child, merging their props and behavior.
Read our [Composition](/akar/guides/composition) guide for more details. |
| `nextPage` | | `((placeholder: DateValue) => DateValue)` | The function to be used for the next page. Overwrites the `nextPage` function set on the Root. |
**Slots**
| Slot | Payload | Description |
| --- | --- | --- |
| `disabled` | `boolean` | Current disable state |
[MonthRangePickerNext.vue source](https://github.com/vinicunca/akar/blob/v2.0.20/packages/core/src/MonthRangePicker/MonthRangePickerNext.vue)
| Data attribute | Value |
| --- | --- |
| `[data-disabled]` | Present when disabled |
### Heading
Heading for displaying the current year.
**Props**
| Prop | Default | Type | Description |
| --- | --- | --- | --- |
| `as` | `"div"` | `AsTag \| Component` | The element or component this component should render as. Can be overwritten by `asChild`. |
| `asChild` | | `boolean` | Change the default rendered element for the one passed as a child, merging their props and behavior.
Read our [Composition](/akar/guides/composition) guide for more details. |
**Slots**
| Slot | Payload | Description |
| --- | --- | --- |
| `headingValue` | `string` | Current year heading |
[MonthRangePickerHeading.vue source](https://github.com/vinicunca/akar/blob/v2.0.20/packages/core/src/MonthRangePicker/MonthRangePickerHeading.vue)
| Data attribute | Value |
| --- | --- |
| `[data-disabled]` | Present when disabled |
### Grid
Container for wrapping the month range picker grid.
**Props**
| Prop | Default | Type | Description |
| --- | --- | --- | --- |
| `as` | `"table"` | `AsTag \| Component` | The element or component this component should render as. Can be overwritten by `asChild`. |
| `asChild` | | `boolean` | Change the default rendered element for the one passed as a child, merging their props and behavior.
Read our [Composition](/akar/guides/composition) guide for more details. |
[MonthRangePickerGrid.vue source](https://github.com/vinicunca/akar/blob/v2.0.20/packages/core/src/MonthRangePicker/MonthRangePickerGrid.vue)
| Data attribute | Value |
| --- | --- |
| `[data-readonly]` | Present when readonly |
| `[data-disabled]` | Present when disabled |
### Grid Body
Container for wrapping the grid body.
**Props**
| Prop | Default | Type | Description |
| --- | --- | --- | --- |
| `as` | `"tbody"` | `AsTag \| Component` | The element or component this component should render as. Can be overwritten by `asChild`. |
| `asChild` | | `boolean` | Change the default rendered element for the one passed as a child, merging their props and behavior.
Read our [Composition](/akar/guides/composition) guide for more details. |
[MonthRangePickerGridBody.vue source](https://github.com/vinicunca/akar/blob/v2.0.20/packages/core/src/MonthRangePicker/MonthRangePickerGridBody.vue)
### Grid Row
Container for wrapping the grid row.
**Props**
| Prop | Default | Type | Description |
| --- | --- | --- | --- |
| `as` | `"tr"` | `AsTag \| Component` | The element or component this component should render as. Can be overwritten by `asChild`. |
| `asChild` | | `boolean` | Change the default rendered element for the one passed as a child, merging their props and behavior.
Read our [Composition](/akar/guides/composition) guide for more details. |
[MonthRangePickerGridRow.vue source](https://github.com/vinicunca/akar/blob/v2.0.20/packages/core/src/MonthRangePicker/MonthRangePickerGridRow.vue)
### Cell
Container for wrapping the month range picker cells.
**Props**
| Prop | Default | Type | Description |
| --- | --- | --- | --- |
| `as` | `"td"` | `AsTag \| Component` | The element or component this component should render as. Can be overwritten by `asChild`. |
| `asChild` | | `boolean` | Change the default rendered element for the one passed as a child, merging their props and behavior.
Read our [Composition](/akar/guides/composition) guide for more details. |
| `date*` | | `DateValue` | The date value for the cell |
[MonthRangePickerCell.vue source](https://github.com/vinicunca/akar/blob/v2.0.20/packages/core/src/MonthRangePicker/MonthRangePickerCell.vue)
| Data attribute | Value |
| --- | --- |
| `[data-disabled]` | Present when disabled |
### Cell Trigger
Interactable container for displaying the cell months. Clicking it selects the month.
**Props**
| Prop | Default | Type | Description |
| --- | --- | --- | --- |
| `as` | `"div"` | `AsTag \| Component` | The element or component this component should render as. Can be overwritten by `asChild`. |
| `asChild` | | `boolean` | Change the default rendered element for the one passed as a child, merging their props and behavior.
Read our [Composition](/akar/guides/composition) guide for more details. |
| `month*` | | `DateValue` | The date value provided to the cell trigger |
**Slots**
| Slot | Payload | Description |
| --- | --- | --- |
| `monthValue` | `string` | Current month value (short name) |
| `disabled` | `boolean` | Current disable state |
| `selected` | `boolean` | Current selected state |
| `today` | `boolean` | Current month is today's month state |
| `unavailable` | `boolean` | Current unavailable state |
| `highlighted` | `boolean` | Current highlighted state |
| `highlightedStart` | `boolean` | Current highlighted start state |
| `highlightedEnd` | `boolean` | Current highlighted end state |
| `selectionStart` | `boolean` | Current selection start state |
| `selectionEnd` | `boolean` | Current selection end state |
[MonthRangePickerCellTrigger.vue source](https://github.com/vinicunca/akar/blob/v2.0.20/packages/core/src/MonthRangePicker/MonthRangePickerCellTrigger.vue)
| Data attribute | Value |
| --- | --- |
| `[data-selected]` | Present when selected |
| `[data-value]` | The ISO string value of the date. |
| `[data-disabled]` | Present when disabled |
| `[data-unavailable]` | Present when unavailable |
| `[data-today]` | Present when the month is the current month |
| `[data-selection-start]` | Present when the month is the start of the selection. |
| `[data-selection-end]` | Present when the month is the end of the selection. |
| `[data-highlighted]` | Present when the month is highlighted by the user as they select a range. |
| `[data-highlighted-start]` | Present when the month is the start of the range that is highlighted by the user. |
| `[data-highlighted-end]` | Present when the month is the end of the range that is highlighted by the user. |
| `[data-focused]` | Present when focused |
## Accessibility
### Keyboard Interactions
| Key | Description |
| --- | --- |
| Tab | When focus moves onto the month range picker, focuses the first navigation button. |
| Space | When the focus is on either `MonthRangePickerNext` or `MonthRangePickerPrev`, it navigates the calendar. Otherwise, it selects the month. |
| Enter | When the focus is on either `MonthRangePickerNext` or `MonthRangePickerPrev`, it navigates the calendar. Otherwise, it selects the month. |
| ArrowLeft / ArrowRight / ArrowUp / ArrowDown | When the focus is on `MonthRangePickerCellTrigger`, it navigates the months, changing the year if necessary. |
| PageUp | When the focus is on `MonthRangePickerCellTrigger`, it navigates to the same month in the previous year. |
| PageDown | When the focus is on `MonthRangePickerCellTrigger`, it navigates to the same month in the next year. |
| Escape | Cancels the current range selection and restores the previous valid range. |
---
- [GitHub](https://github.com/vinicunca/akar/blob/v2.0.20/packages/core/src/MonthRangePicker)
- [npm](https://www.npmjs.com/package/akar)
# Navigation Menu
> A collection of links for navigating websites.
```vue [index.vue]
```
```css [styles.css]
@import '../_colors/black-alpha.css';
@import '../_colors/indigo.css';
@import '../_colors/mauve.css';
@import '../_colors/green.css';
@import '../_colors/grass.css';
@scope (.akar-demo-NavigationMenu) {
/* reset */
button,
p {
all: unset;
}
.NavigationMenuRoot {
position: relative;
display: flex;
justify-content: center;
width: 100vw;
z-index: 1;
}
.NavigationMenuList {
display: flex;
justify-content: center;
background-color: white;
padding: 4px;
border-radius: 6px;
list-style: none;
box-shadow: 0 2px 10px var(--black-a7);
margin: 0;
}
.NavigationMenuTrigger,
.NavigationMenuLink {
padding: 8px 12px;
outline: none;
user-select: none;
font-weight: 500;
line-height: 1;
border-radius: 4px;
font-size: 15px;
color: var(--grass-11);
}
.NavigationMenuTrigger:focus,
.NavigationMenuLink:focus {
box-shadow: 0 0 0 2px var(--grass-7);
}
.NavigationMenuTrigger:hover,
.NavigationMenuLink:hover {
background-color: var(--grass-3);
}
.NavigationMenuTrigger {
display: flex;
align-items: center;
justify-content: space-between;
gap: 2px;
}
.NavigationMenuLink {
display: block;
text-decoration: none;
font-size: 15px;
line-height: 1;
}
.NavigationMenuContent {
position: absolute;
top: 0;
left: 0;
width: 100%;
animation-duration: 250ms;
animation-timing-function: ease;
}
.NavigationMenuContent[data-motion='from-start'] {
animation-name: enterFromLeft;
}
.NavigationMenuContent[data-motion='from-end'] {
animation-name: enterFromRight;
}
.NavigationMenuContent[data-motion='to-start'] {
animation-name: exitToLeft;
}
.NavigationMenuContent[data-motion='to-end'] {
animation-name: exitToRight;
}
@media only screen and (min-width: 600px) {
.NavigationMenuContent {
width: auto;
}
}
.NavigationMenuIndicator {
display: flex;
align-items: flex-end;
justify-content: center;
height: 10px;
top: 100%;
overflow: hidden;
z-index: 1;
transition: width, transform 250ms ease;
}
.NavigationMenuIndicator[data-state='visible'] {
animation: fadeIn 200ms ease;
}
.NavigationMenuIndicator[data-state='hidden'] {
animation: fadeOut 200ms ease;
}
.NavigationMenuViewport {
position: relative;
transform-origin: top center;
margin-top: 10px;
width: 100%;
background-color: white;
border-radius: 6px;
overflow: hidden;
box-shadow: hsl(206 22% 7% / 35%) 0px 10px 38px -10px, hsl(206 22% 7% / 20%) 0px 10px 20px -15px;
height: var(--akar-navigation-menu-viewport-height);
transition: width, height, 300ms ease;
}
.NavigationMenuViewport[data-state='open'] {
animation: scaleIn 200ms ease;
}
.NavigationMenuViewport[data-state='closed'] {
animation: scaleOut 200ms ease;
}
@media only screen and (min-width: 600px) {
.NavigationMenuViewport {
width: var(--akar-navigation-menu-viewport-width);
}
}
.List {
display: grid;
padding: 22px;
margin: 0;
column-gap: 10px;
list-style: none;
}
@media only screen and (min-width: 600px) {
.List.one {
width: 500px;
grid-template-columns: 0.75fr 1fr;
}
.List.two {
width: 600px;
grid-auto-flow: column;
grid-template-rows: repeat(3, 1fr);
}
}
.ListItemLink {
display: block;
outline: none;
text-decoration: none;
user-select: none;
padding: 12px;
border-radius: 6px;
font-size: 15px;
line-height: 1;
}
.ListItemLink:focus {
box-shadow: 0 0 0 2px var(--grass-7);
}
.ListItemLink:hover {
background-color: var(--mauve-3);
}
.ListItemHeading {
font-weight: 500;
line-height: 1.2;
margin-bottom: 5px;
color: var(--grass-12);
}
.ListItemText {
color: var(--mauve-11);
line-height: 1.4;
font-weight: initial;
}
.Callout {
display: flex;
justify-content: flex-end;
flex-direction: column;
width: 100%;
height: 100%;
background: linear-gradient(135deg, var(--green-9) 0%, var(--indigo-9) 100%);
border-radius: 6px;
padding: 25px;
text-decoration: none;
outline: none;
user-select: none;
}
.Callout:focus {
box-shadow: 0 0 0 2px var(--grass-7);
}
.CalloutHeading {
color: white;
font-size: 18px;
font-weight: 500;
line-height: 1.2;
margin-top: 16px;
margin-bottom: 7px;
}
.CalloutText {
color: var(--mauve-4);
font-size: 14px;
line-height: 1.3;
}
.ViewportPosition {
position: absolute;
display: flex;
justify-content: center;
width: 100%;
top: 100%;
left: 0;
perspective: 2000px;
}
.CaretDown {
position: relative;
color: var(--grass-10);
top: 1px;
transition: transform 250ms ease;
}
[data-state='open'] > .CaretDown {
transform: rotate(-180deg);
}
.Arrow {
position: relative;
top: 70%;
background-color: white;
width: 10px;
height: 10px;
transform: rotate(45deg);
border-top-left-radius: 2px;
}
@keyframes enterFromRight {
from {
opacity: 0;
transform: translateX(200px);
}
to {
opacity: 1;
transform: translateX(0);
}
}
@keyframes enterFromLeft {
from {
opacity: 0;
transform: translateX(-200px);
}
to {
opacity: 1;
transform: translateX(0);
}
}
@keyframes exitToRight {
from {
opacity: 1;
transform: translateX(0);
}
to {
opacity: 0;
transform: translateX(200px);
}
}
@keyframes exitToLeft {
from {
opacity: 1;
transform: translateX(0);
}
to {
opacity: 0;
transform: translateX(-200px);
}
}
@keyframes scaleIn {
from {
opacity: 0;
transform: rotateX(-30deg) scale(0.9);
}
to {
opacity: 1;
transform: rotateX(0deg) scale(1);
}
}
@keyframes scaleOut {
from {
opacity: 1;
transform: rotateX(0deg) scale(1);
}
to {
opacity: 0;
transform: rotateX(-10deg) scale(0.95);
}
}
@keyframes fadeIn {
from {
opacity: 0;
}
to {
opacity: 1;
}
}
@keyframes fadeOut {
from {
opacity: 1;
}
to {
opacity: 0;
}
}
}
```
## Features
- Can be controlled or uncontrolled.
- Flexible layout structure with managed tab focus.
- Supports submenus.
- Optional active item indicator.
- Full keyboard navigation.
- Exposes CSS variables for advanced animation.
- Supports custom timings.
## Installation
Install the component from your command line.
```bash [pnpm]
pnpm add akar
```
```bash [yarn]
yarn add akar
```
```bash [npm]
npm install akar
```
```bash [bun]
bun add akar
```
## Anatomy
Import all parts and piece them together.
```vue
Read our [Composition](https://vinicunca.dev/akar/guides/composition) guide for more details. |
| `defaultValue` | | `string` | The value of the menu item that should be active when initially rendered.
Use when you do not need to control the value state. |
| `delayDuration` | `200` | `number` | The duration from when the pointer enters the trigger until the tooltip gets opened. |
| `dir` | | `"ltr" \| "rtl"` | The reading direction of the combobox when applicable.
If omitted, inherits globally from `ConfigProvider` or assumes LTR (left-to-right) reading mode. |
| `disableClickTrigger` | `false` | `boolean` | If `true`, menu cannot be open by click on trigger |
| `disableHoverTrigger` | `false` | `boolean` | If `true`, menu cannot be open by hover on trigger |
| `disablePointerLeaveClose` | `false` | `boolean` | If `true`, menu will not close during pointer leave event |
| `modelValue` | | `string` | The controlled value of the menu item to activate. Can be used as `v-model`. |
| `orientation` | `"horizontal"` | `"vertical" \| "horizontal"` | The orientation of the menu. |
| `skipDelayDuration` | `300` | `number` | How much time a user has to enter another trigger without incurring a delay again. |
| `unmountOnHide` | `true` | `boolean` | When `true`, the element will be unmounted on closed state. |
**Events**
| Event | Payload | Description |
| --- | --- | --- |
| `update:modelValue` | `value: string` | Event handler called when the value changes. |
**Slots**
| Slot | Payload | Description |
| --- | --- | --- |
| `modelValue` | `string` | Current input values |
[NavigationMenuRoot.vue source](https://github.com/vinicunca/akar/blob/v2.0.20/packages/core/src/NavigationMenu/NavigationMenuRoot.vue)
| Data attribute | Value |
| --- | --- |
| `[data-orientation]` | "vertical" \\| "horizontal" |
### Sub
Signifies a submenu. Use it in place of the root part when nested to create a submenu.
**Props**
| Prop | Default | Type | Description |
| --- | --- | --- | --- |
| `as` | `"div"` | `AsTag \| Component` | The element or component this component should render as. Can be overwritten by `asChild`. |
| `asChild` | | `boolean` | Change the default rendered element for the one passed as a child, merging their props and behavior.
Read our [Composition](https://vinicunca.dev/akar/guides/composition) guide for more details. |
| `defaultValue` | | `string` | The value of the menu item that should be active when initially rendered.
Use when you do not need to control the value state. |
| `modelValue` | | `string` | The controlled value of the sub menu item to activate. Can be used as `v-model`. |
| `orientation` | `"horizontal"` | `"vertical" \| "horizontal"` | The orientation of the menu. |
**Events**
| Event | Payload | Description |
| --- | --- | --- |
| `update:modelValue` | `value: string` | Event handler called when the value changes. |
**Slots**
| Slot | Payload | Description |
| --- | --- | --- |
| `modelValue` | `string` | Current input values |
[NavigationMenuSub.vue source](https://github.com/vinicunca/akar/blob/v2.0.20/packages/core/src/NavigationMenu/NavigationMenuSub.vue)
| Data attribute | Value |
| --- | --- |
| `[data-orientation]` | "vertical" \\| "horizontal" |
### List
Contains the top level menu items.
**Props**
| Prop | Default | Type | Description |
| --- | --- | --- | --- |
| `as` | `"ul"` | `AsTag \| Component` | The element or component this component should render as. Can be overwritten by `asChild`. |
| `asChild` | | `boolean` | Change the default rendered element for the one passed as a child, merging their props and behavior.
Read our [Composition](https://vinicunca.dev/akar/guides/composition) guide for more details. |
[NavigationMenuList.vue source](https://github.com/vinicunca/akar/blob/v2.0.20/packages/core/src/NavigationMenu/NavigationMenuList.vue)
| Data attribute | Value |
| --- | --- |
| `[data-orientation]` | "vertical" \\| "horizontal" |
### Item
A top level menu item, contains a link or trigger with content combination.
**Props**
| Prop | Default | Type | Description |
| --- | --- | --- | --- |
| `as` | `"li"` | `AsTag \| Component` | The element or component this component should render as. Can be overwritten by `asChild`. |
| `asChild` | | `boolean` | Change the default rendered element for the one passed as a child, merging their props and behavior.
Read our [Composition](https://vinicunca.dev/akar/guides/composition) guide for more details. |
| `value` | | `string` | A unique value that associates the item with an active value when the navigation menu is controlled.
This prop is managed automatically when uncontrolled. |
[NavigationMenuItem.vue source](https://github.com/vinicunca/akar/blob/v2.0.20/packages/core/src/NavigationMenu/NavigationMenuItem.vue)
### Trigger
The button that toggles the content.
**Props**
| Prop | Default | Type | Description |
| --- | --- | --- | --- |
| `as` | `"button"` | `AsTag \| Component` | The element or component this component should render as. Can be overwritten by `asChild`. |
| `asChild` | | `boolean` | Change the default rendered element for the one passed as a child, merging their props and behavior.
Read our [Composition](https://vinicunca.dev/akar/guides/composition) guide for more details. |
| `disabled` | | `boolean` | When `true`, prevents the user from interacting with item |
[NavigationMenuTrigger.vue source](https://github.com/vinicunca/akar/blob/v2.0.20/packages/core/src/NavigationMenu/NavigationMenuTrigger.vue)
| Data attribute | Value |
| --- | --- |
| `[data-state]` | "open" \\| "closed" |
| `[data-disabled]` | Present when disabled |
### Content
Contains the content associated with each trigger.
> [!NOTE]
>
> Defer mounting with `forceMount` / [`Presence`](https://vinicunca.dev/akar/utilities/presence). See the [animation guide](https://vinicunca.dev/akar/guides/animation).
**Props**
| Prop | Default | Type | Description |
| --- | --- | --- | --- |
| `as` | `"div"` | `AsTag \| Component` | The element or component this component should render as. Can be overwritten by `asChild`. |
| `asChild` | | `boolean` | Change the default rendered element for the one passed as a child, merging their props and behavior.
Read our [Composition](https://vinicunca.dev/akar/guides/composition) guide for more details. |
| `disableOutsidePointerEvents` | | `boolean` | When `true`, hover/focus/click interactions will be disabled on elements outside
the `DismissableLayer`. Users will need to click twice on outside elements to
interact with them: once to close the `DismissableLayer`, and again to trigger the element. |
| `forceMount` | | `boolean` | Used to force mounting when more control is needed. Useful when
controlling animation with Vue animation libraries. |
**Events**
| Event | Payload | Description |
| --- | --- | --- |
| `escapeKeyDown` | `event: KeyboardEvent` | Event handler called when the escape key is down.
Can be prevented. |
| `focusOutside` | `event: FocusOutsideEvent` | Event handler called when the focus moves outside of the `DismissableLayer`.
Can be prevented. |
| `interactOutside` | `event: PointerDownOutsideEvent \| FocusOutsideEvent` | Event handler called when an interaction happens outside the `DismissableLayer`.
Specifically, when a `pointerdown` event happens outside or focus moves outside of it.
Can be prevented. |
| `pointerDownOutside` | `event: PointerDownOutsideEvent` | Event handler called when a `pointerdown` event happens outside of the `DismissableLayer`.
Can be prevented. |
[NavigationMenuContent.vue source](https://github.com/vinicunca/akar/blob/v2.0.20/packages/core/src/NavigationMenu/NavigationMenuContent.vue)
| Data attribute | Value |
| --- | --- |
| `[data-state]` | "open" \\| "closed" |
| `[data-motion]` | "to-start" \\| "to-end" \\| "from-start" \\| "from-end" |
| `[data-orientation]` | "vertical" \\| "horizontal" |
### Link
A navigational link.
**Props**
| Prop | Default | Type | Description |
| --- | --- | --- | --- |
| `active` | | `boolean` | Used to identify the link as the currently active page. |
| `as` | `"a"` | `AsTag \| Component` | The element or component this component should render as. Can be overwritten by `asChild`. |
| `asChild` | | `boolean` | Change the default rendered element for the one passed as a child, merging their props and behavior.
Read our [Composition](https://vinicunca.dev/akar/guides/composition) guide for more details. |
**Events**
| Event | Payload | Description |
| --- | --- | --- |
| `select` | `payload: CustomEvent<{ originalEvent: Event; }>` | Event handler called when the user selects a link (via mouse or keyboard).
Calling `event.preventDefault` in this handler will prevent the navigation menu from closing when selecting that link. |
[NavigationMenuLink.vue source](https://github.com/vinicunca/akar/blob/v2.0.20/packages/core/src/NavigationMenu/NavigationMenuLink.vue)
| Data attribute | Value |
| --- | --- |
| `[data-active]` | Present when active |
### Indicator
An optional indicator element that renders below the list, is used to highlight the currently active trigger.
> [!NOTE]
>
> Defer mounting with `forceMount` / [`Presence`](https://vinicunca.dev/akar/utilities/presence). See the [animation guide](https://vinicunca.dev/akar/guides/animation).
**Props**
| Prop | Default | Type | Description |
| --- | --- | --- | --- |
| `as` | `"div"` | `AsTag \| Component` | The element or component this component should render as. Can be overwritten by `asChild`. |
| `asChild` | | `boolean` | Change the default rendered element for the one passed as a child, merging their props and behavior.
Read our [Composition](https://vinicunca.dev/akar/guides/composition) guide for more details. |
| `forceMount` | | `boolean` | Used to force mounting when more control is needed. Useful when
controlling animation with Vue animation libraries. |
[NavigationMenuIndicator.vue source](https://github.com/vinicunca/akar/blob/v2.0.20/packages/core/src/NavigationMenu/NavigationMenuIndicator.vue)
| Data attribute | Value |
| --- | --- |
| `[data-state]` | "visible" \\| "hidden" |
| `[data-orientation]` | "vertical" \\| "horizontal" |
| CSS variable | Description |
| --- | --- |
| `--akar-navigation-menu-indicator-size` | The size of the indicator. |
| `--akar-navigation-menu-indicator-position` | The position of the indicator |
### Viewport
An optional viewport element that is used to render active content outside of the list.
> [!NOTE]
>
> Defer mounting with `forceMount` / [`Presence`](https://vinicunca.dev/akar/utilities/presence). See the [animation guide](https://vinicunca.dev/akar/guides/animation).
**Props**
| Prop | Default | Type | Description |
| --- | --- | --- | --- |
| `align` | `"center"` | `"start" \| "center" \| "end"` | Placement of the viewport for css variables `(--akar-navigation-menu-viewport-left, --akar-navigation-menu-viewport-top)`. |
| `as` | `"div"` | `AsTag \| Component` | The element or component this component should render as. Can be overwritten by `asChild`. |
| `asChild` | | `boolean` | Change the default rendered element for the one passed as a child, merging their props and behavior.
Read our [Composition](https://vinicunca.dev/akar/guides/composition) guide for more details. |
| `forceMount` | | `boolean` | Used to force mounting when more control is needed. Useful when
controlling animation with Vue animation libraries. |
[NavigationMenuViewport.vue source](https://github.com/vinicunca/akar/blob/v2.0.20/packages/core/src/NavigationMenu/NavigationMenuViewport.vue)
| Data attribute | Value |
| --- | --- |
| `[data-state]` | "visible" \\| "hidden" |
| `[data-orientation]` | "vertical" \\| "horizontal" |
| CSS variable | Description |
| --- | --- |
| `--akar-navigation-menu-viewport-width` | The width of the viewport when visible/hidden, computed from the active content |
| `--akar-navigation-menu-viewport-height` | The height of the viewport when visible/hidden, computed from the active content |
## Examples
### Vertical
You can create a vertical menu by using the `orientation` prop.
```vue
NavigationMenuTrigger or
NavigationMenuLink.
`,
},
{
keys: ['ArrowUp'],
description: `
Moves focus to the previous NavigationMenuTrigger or
NavigationMenuLink.
`,
},
{
keys: ['ArrowRight', 'ArrowLeft'],
description: `
When vertical and focus is on an open
NavigationMenuTrigger, moves focus into its
NavigationMenuContent.
Moves focus to the next / previous NavigationMenuTrigger or NavigationMenuLink.
`,
},
{
keys: ['Home', 'End'],
description: `
Moves focus to the first/last NavigationMenu.Trigger or
NavigationMenu.Link.
`,
},
{
keys: ['Esc'],
description: `
Closes open NavigationMenu.Content and moves focus to its
NavigationMenu.Trigger.
`,
},
```
]"
/>
---
- [ARIA](https://www.w3.org/TR/wai-aria/#navigation)
- [GitHub](https://github.com/vinicunca/akar/blob/v2.0.20/packages/core/src/NavigationMenu)
- [npm](https://www.npmjs.com/package/akar)
# Number Field
> A number field allows a user to enter a number and increment or decrement the value using stepper buttons.
```vue [index.vue]
Read our [Composition](https://vinicunca.dev/akar/guides/composition) guide for more details. |
| `defaultValue` | | `number` | |
| `disabled` | | `boolean` | When `true`, prevents the user from interacting with the Number Field. |
| `disableWheelChange` | | `boolean` | When `true`, prevents the value from changing on wheel scroll. |
| `focusOnChange` | `true` | `boolean` | When `true`, the input will be focused when the value changes. |
| `formatOptions` | | `Intl.NumberFormatOptions` | Formatting options for the value displayed in the number field. This also affects what characters are allowed to be typed by the user. |
| `id` | | `string` | Id of the element |
| `invertWheelChange` | | `boolean` | When `true`, inverts the direction of the wheel change. |
| `locale` | | `string` | The locale to use for formatting and currencies |
| `max` | | `number` | The largest value allowed for the input. |
| `min` | | `number` | The smallest value allowed for the input. |
| `modelValue` | | `number \| null` | |
| `name` | | `string` | The name of the field. Submitted with its owning form as part of a name/value pair. |
| `readonly` | | `boolean` | When `true`, the Number Field is read-only. |
| `required` | | `boolean` | When `true`, indicates that the user must set the value before the owning form can be submitted. |
| `step` | `1` | `number` | The amount that the input value changes with each increment or decrement "tick". |
| `stepSnapping` | `true` | `boolean` | When `false`, prevents the value from snapping to the nearest increment of the step value |
**Events**
| Event | Payload | Description |
| --- | --- | --- |
| `update:modelValue` | `val: number` | |
**Slots**
| Slot | Payload | Description |
| --- | --- | --- |
| `modelValue` | `number` | |
| `textValue` | `string` | |
| `readonly` | `boolean` | |
[NumberFieldRoot.vue source](https://github.com/vinicunca/akar/blob/v2.0.20/packages/core/src/NumberField/NumberFieldRoot.vue)
| Data attribute | Value |
| --- | --- |
| `[data-disabled]` | Present when disabled |
### Input
Input
The input component that renders the text value based on value and format options.
**Props**
| Prop | Default | Type | Description |
| --- | --- | --- | --- |
| `as` | `"input"` | `AsTag \| Component` | The element or component this component should render as. Can be overwritten by `asChild`. |
| `asChild` | | `boolean` | Change the default rendered element for the one passed as a child, merging their props and behavior.
Read our [Composition](https://vinicunca.dev/akar/guides/composition) guide for more details. |
[NumberFieldInput.vue source](https://github.com/vinicunca/akar/blob/v2.0.20/packages/core/src/NumberField/NumberFieldInput.vue)
| Data attribute | Value |
| --- | --- |
| `[data-disabled]` | Present when disabled |
### Increment
The button that increases the value.
**Props**
| Prop | Default | Type | Description |
| --- | --- | --- | --- |
| `as` | `"button"` | `AsTag \| Component` | The element or component this component should render as. Can be overwritten by `asChild`. |
| `asChild` | | `boolean` | Change the default rendered element for the one passed as a child, merging their props and behavior.
Read our [Composition](https://vinicunca.dev/akar/guides/composition) guide for more details. |
| `disabled` | | `boolean` | |
[NumberFieldIncrement.vue source](https://github.com/vinicunca/akar/blob/v2.0.20/packages/core/src/NumberField/NumberFieldIncrement.vue)
| Data attribute | Value |
| --- | --- |
| `[data-pressed]` | Present when pressed |
| `[data-disabled]` | Present when disabled |
### Decrement
The button that decreases the value.
**Props**
| Prop | Default | Type | Description |
| --- | --- | --- | --- |
| `as` | `"button"` | `AsTag \| Component` | The element or component this component should render as. Can be overwritten by `asChild`. |
| `asChild` | | `boolean` | Change the default rendered element for the one passed as a child, merging their props and behavior.
Read our [Composition](https://vinicunca.dev/akar/guides/composition) guide for more details. |
| `disabled` | | `boolean` | |
[NumberFieldDecrement.vue source](https://github.com/vinicunca/akar/blob/v2.0.20/packages/core/src/NumberField/NumberFieldDecrement.vue)
| Data attribute | Value |
| --- | --- |
| `[data-pressed]` | Present when pressed |
| `[data-disabled]` | Present when disabled |
## Example
### Decimal
All options supported by `Intl.NumberFormat` are supported, including configuration of minimum and maximum fraction digits, sign display, grouping separators, etc.
```vue
Read our [Composition](https://vinicunca.dev/akar/guides/composition) guide for more details. |
| `defaultPage` | `1` | `number` | The value of the page that should be active when initially rendered.
Use when you do not need to control the value state. |
| `disabled` | | `boolean` | When `true`, prevents the user from interacting with item |
| `itemsPerPage*` | | `number` | Number of items per page |
| `page` | | `number` | The controlled value of the current page. Can be binded as `v-model:page`. |
| `showEdges` | `false` | `boolean` | When `true`, always show first page, last page, and ellipsis |
| `siblingCount` | `2` | `number` | Number of sibling should be shown around the current page |
| `total` | `0` | `number` | Number of items in your list |
**Events**
| Event | Payload | Description |
| --- | --- | --- |
| `update:page` | `value: number` | Event handler called when the page value changes |
**Slots**
| Slot | Payload | Description |
| --- | --- | --- |
| `page` | `number` | Current page state |
| `pageCount` | `number` | Number of pages |
[PaginationRoot.vue source](https://github.com/vinicunca/akar/blob/v2.0.20/packages/core/src/Pagination/PaginationRoot.vue)
### List
Used to show the list of pages. It also makes pagination accessible to assistive technologies.
**Props**
| Prop | Default | Type | Description |
| --- | --- | --- | --- |
| `as` | `"div"` | `AsTag \| Component` | The element or component this component should render as. Can be overwritten by `asChild`. |
| `asChild` | | `boolean` | Change the default rendered element for the one passed as a child, merging their props and behavior.
Read our [Composition](https://vinicunca.dev/akar/guides/composition) guide for more details. |
**Slots**
| Slot | Payload | Description |
| --- | --- | --- |
| `items` | `{ type: "ellipsis"; } \| { type: "page"; value: number; }` | Pages item |
[PaginationList.vue source](https://github.com/vinicunca/akar/blob/v2.0.20/packages/core/src/Pagination/PaginationList.vue)
### Item
Used to render the button that changes the current page. Reka's docs called this part `PaginationItem`; in Akar v2.0.20 the export is `PaginationListItem`.
**Props**
| Prop | Default | Type | Description |
| --- | --- | --- | --- |
| `as` | `"button"` | `AsTag \| Component` | The element or component this component should render as. Can be overwritten by `asChild`. |
| `asChild` | | `boolean` | Change the default rendered element for the one passed as a child, merging their props and behavior.
Read our [Composition](https://vinicunca.dev/akar/guides/composition) guide for more details. |
| `value*` | | `number` | Value for the page |
[PaginationListItem.vue source](https://github.com/vinicunca/akar/blob/v2.0.20/packages/core/src/Pagination/PaginationListItem.vue)
| Data attribute | Value |
| --- | --- |
| `[data-selected]` | "true" \\| "" |
| `[data-type]` | "page" |
### Ellipsis
Placeholder element when the list is long, and only a small amount of `siblingCount` was set and `showEdges` was set to `true`.
**Props**
| Prop | Default | Type | Description |
| --- | --- | --- | --- |
| `as` | `"div"` | `AsTag \| Component` | The element or component this component should render as. Can be overwritten by `asChild`. |
| `asChild` | | `boolean` | Change the default rendered element for the one passed as a child, merging their props and behavior.
Read our [Composition](https://vinicunca.dev/akar/guides/composition) guide for more details. |
[PaginationEllipsis.vue source](https://github.com/vinicunca/akar/blob/v2.0.20/packages/core/src/Pagination/PaginationEllipsis.vue)
| Data attribute | Value |
| --- | --- |
| `[data-type]` | "ellipsis" |
### First
Triggers that set the page value to 1
**Props**
| Prop | Default | Type | Description |
| --- | --- | --- | --- |
| `as` | `"button"` | `AsTag \| Component` | The element or component this component should render as. Can be overwritten by `asChild`. |
| `asChild` | | `boolean` | Change the default rendered element for the one passed as a child, merging their props and behavior.
Read our [Composition](https://vinicunca.dev/akar/guides/composition) guide for more details. |
[PaginationFirst.vue source](https://github.com/vinicunca/akar/blob/v2.0.20/packages/core/src/Pagination/PaginationFirst.vue)
### Prev
Triggers that set the page value to the previous page
**Props**
| Prop | Default | Type | Description |
| --- | --- | --- | --- |
| `as` | `"button"` | `AsTag \| Component` | The element or component this component should render as. Can be overwritten by `asChild`. |
| `asChild` | | `boolean` | Change the default rendered element for the one passed as a child, merging their props and behavior.
Read our [Composition](https://vinicunca.dev/akar/guides/composition) guide for more details. |
[PaginationPrev.vue source](https://github.com/vinicunca/akar/blob/v2.0.20/packages/core/src/Pagination/PaginationPrev.vue)
### Next
Triggers that set the page value to the next page
**Props**
| Prop | Default | Type | Description |
| --- | --- | --- | --- |
| `as` | `"button"` | `AsTag \| Component` | The element or component this component should render as. Can be overwritten by `asChild`. |
| `asChild` | | `boolean` | Change the default rendered element for the one passed as a child, merging their props and behavior.
Read our [Composition](https://vinicunca.dev/akar/guides/composition) guide for more details. |
[PaginationNext.vue source](https://github.com/vinicunca/akar/blob/v2.0.20/packages/core/src/Pagination/PaginationNext.vue)
### Last
Triggers that set the page value to the last page
**Props**
| Prop | Default | Type | Description |
| --- | --- | --- | --- |
| `as` | `"button"` | `AsTag \| Component` | The element or component this component should render as. Can be overwritten by `asChild`. |
| `asChild` | | `boolean` | Change the default rendered element for the one passed as a child, merging their props and behavior.
Read our [Composition](https://vinicunca.dev/akar/guides/composition) guide for more details. |
[PaginationLast.vue source](https://github.com/vinicunca/akar/blob/v2.0.20/packages/core/src/Pagination/PaginationLast.vue)
## Examples
### With ellipsis
You can add `PaginationEllipsis` as a visual cue for more previous and after items.
```vue
Read our [Composition](https://vinicunca.dev/akar/guides/composition) guide for more details. |
| `defaultValue` | | `PinInputValue
If omitted, inherits globally from `ConfigProvider` or assumes LTR (left-to-right) reading mode. |
| `disabled` | | `boolean` | When `true`, prevents the user from interacting with the pin input |
| `id` | | `string` | Id of the element |
| `mask` | | `boolean` | When `true`, pin inputs will be treated as password. |
| `modelValue` | | `PinInputValue
Read our [Composition](https://vinicunca.dev/akar/guides/composition) guide for more details. |
| `disabled` | | `boolean` | When `true`, prevents the user from interacting with the pin input |
| `index*` | | `number` | Position of the value this input binds to. |
[PinInputInput.vue source](https://github.com/vinicunca/akar/blob/v2.0.20/packages/core/src/PinInput/PinInputInput.vue)
| Data attribute | Value |
| --- | --- |
| `[data-complete]` | Present when completed |
| `[data-disabled]` | Present when disabled |
## Examples
### OTP mode
You can set the pin input to `otp` mode by setting otp to `true`.
```vue
Read our [Composition](https://vinicunca.dev/akar/guides/composition) guide for more details. |
[PopoverTrigger.vue source](https://github.com/vinicunca/akar/blob/v2.0.20/packages/core/src/Popover/PopoverTrigger.vue)
| Data attribute | Value |
| --- | --- |
| `[data-state]` | "open" \\| "closed" |
### Anchor
An optional element to position the `PopoverContent` against. If this part is not used, the content will position alongside the `PopoverTrigger`.
**Props**
| Prop | Default | Type | Description |
| --- | --- | --- | --- |
| `as` | `"div"` | `AsTag \| Component` | The element or component this component should render as. Can be overwritten by `asChild`. |
| `asChild` | | `boolean` | Change the default rendered element for the one passed as a child, merging their props and behavior.
Read our [Composition](https://vinicunca.dev/akar/guides/composition) guide for more details. |
| `reference` | | `ReferenceElement` | The reference (or anchor) element that is being referred to for positioning.
If not provided will use the current component as anchor. |
[PopoverAnchor.vue source](https://github.com/vinicunca/akar/blob/v2.0.20/packages/core/src/Popover/PopoverAnchor.vue)
### Portal
When used, portals the content part into the `body`.
**Props**
| Prop | Default | Type | Description |
| --- | --- | --- | --- |
| `defer` | | `boolean` | Defer the resolving of a Teleport target until other parts of the
application have mounted (requires Vue 3.5.0+)
[reference](https://vuejs.org/guide/built-ins/teleport.html#deferred-teleport) |
| `disabled` | | `boolean` | Disable teleport and render the component inline
[reference](https://vuejs.org/guide/built-ins/teleport.html#disabling-teleport) |
| `forceMount` | | `boolean` | Used to force mounting when more control is needed. Useful when
controlling animation with Vue animation libraries. |
| `to` | | `string \| HTMLElement` | Vue native teleport component prop `:to`
[reference](https://vuejs.org/guide/built-ins/teleport.html#basic-usage) |
[PopoverPortal.vue source](https://github.com/vinicunca/akar/blob/v2.0.20/packages/core/src/Popover/PopoverPortal.vue)
### Content
The component that pops out when the popover is open.
> [!NOTE]
>
> Defer mounting with `forceMount` / [`Presence`](https://vinicunca.dev/akar/utilities/presence). See the [animation guide](https://vinicunca.dev/akar/guides/animation).
**Props**
| Prop | Default | Type | Description |
| --- | --- | --- | --- |
| `align` | `"center"` | `"start" \| "center" \| "end"` | The preferred alignment against the trigger.
May change when collisions occur. |
| `alignFlip` | `true` | `boolean` | Flip alignment when colliding with boundary.
May only occur when `prioritizePosition` is true. |
| `alignOffset` | `0` | `number` | An offset in pixels from the `start` or `end` alignment options. |
| `arrowPadding` | `0` | `number` | The padding between the arrow and the edges of the content.
If your content has border-radius, this will prevent it from
overflowing the corners. |
| `as` | `"div"` | `AsTag \| Component` | The element or component this component should render as. Can be overwritten by `asChild`. |
| `asChild` | | `boolean` | Change the default rendered element for the one passed as a child, merging their props and behavior.
Read our [Composition](https://vinicunca.dev/akar/guides/composition) guide for more details. |
| `avoidCollisions` | `true` | `boolean` | When `true`, overrides the side and align preferences
to prevent collisions with boundary edges. |
| `collisionBoundary` | `[]` | `Element \| (Element \| null)[] \| null` | The element used as the collision boundary. By default
this is the viewport, though you can provide additional
element(s) to be included in this check. |
| `collisionPadding` | `0` | `number \| Partial
detection should occur. Accepts a number (same for all sides),
or a partial padding object, for example: { top: 20, left: 20 }. |
| `dir` | | `"ltr" \| "rtl"` | The reading direction of the popper content when applicable.
If omitted, inherits globally from `ConfigProvider` or assumes LTR (left-to-right) reading mode. |
| `disableOutsidePointerEvents` | | `boolean` | When `true`, hover/focus/click interactions will be disabled on elements outside
the `DismissableLayer`. Users will need to click twice on outside elements to
interact with them: once to close the `DismissableLayer`, and again to trigger the element. |
| `disableUpdateOnLayoutShift` | `false` | `boolean` | Whether to disable the update position for the content when the layout shifted. |
| `forceMount` | | `boolean` | Used to force mounting when more control is needed. Useful when
controlling animation with Vue animation libraries. |
| `hideShiftedArrow` | `true` | `boolean` | When `true`, hides the arrow when it cannot be centered
to the reference element. |
| `hideWhenDetached` | `false` | `boolean` | Whether to hide the content when the trigger becomes fully occluded. |
| `memoDependencies` | | `unknown[]` | Reactive dependencies that should invalidate the memoized content subtree. |
| `positionStrategy` | | `"fixed" \| "absolute"` | The type of CSS position property to use. |
| `prioritizePosition` | `false` | `boolean` | Force content to be position within the viewport.
Might overlap the reference element, which may not be desired. |
| `reference` | | `ReferenceElement` | The custom element or virtual element that will be set as the reference
to position the floating element.
If provided, it will replace the default anchor element. |
| `side` | `"bottom"` | `"top" \| "right" \| "bottom" \| "left"` | The preferred side of the trigger to render against when open.
Will be reversed when collisions occur and avoidCollisions
is enabled. |
| `sideFlip` | `true` | `boolean` | Flip to the opposite side when colliding with boundary. |
| `sideOffset` | `0` | `number` | The distance in pixels from the trigger. |
| `sticky` | `"partial"` | `"partial" \| "always"` | The sticky behavior on the align axis. `partial` will keep the
content in the boundary as long as the trigger is at least partially
in the boundary whilst "always" will keep the content in the boundary
regardless. |
| `updatePositionStrategy` | `'optimized'` | `"always" \| "optimized"` | Strategy to update the position of the floating element on every animation frame. |
**Events**
| Event | Payload | Description |
| --- | --- | --- |
| `closeAutoFocus` | `event: Event` | Event handler called when auto-focusing on close.
Can be prevented. |
| `escapeKeyDown` | `event: KeyboardEvent` | Event handler called when the escape key is down.
Can be prevented. |
| `focusOutside` | `event: FocusOutsideEvent` | Event handler called when the focus moves outside of the `DismissableLayer`.
Can be prevented. |
| `interactOutside` | `event: PointerDownOutsideEvent \| FocusOutsideEvent` | Event handler called when an interaction happens outside the `DismissableLayer`.
Specifically, when a `pointerdown` event happens outside or focus moves outside of it.
Can be prevented. |
| `openAutoFocus` | `event: Event` | Event handler called when auto-focusing on open.
Can be prevented. |
| `pointerDownOutside` | `event: PointerDownOutsideEvent` | Event handler called when a `pointerdown` event happens outside of the `DismissableLayer`.
Can be prevented. |
[PopoverContent.vue source](https://github.com/vinicunca/akar/blob/v2.0.20/packages/core/src/Popover/PopoverContent.vue)
| Data attribute | Value |
| --- | --- |
| `[data-state]` | "open" \\| "closed" |
| `[data-side]` | "left" \\| "right" \\| "bottom" \\| "top" |
| `[data-align]` | "start" \\| "end" \\| "center" |
| CSS variable | Description |
| --- | --- |
| `--akar-popover-content-transform-origin` | The `transform-origin` computed from the content and arrow positions/offsets |
| `--akar-popover-content-available-width` | The remaining width between the trigger and the boundary edge |
| `--akar-popover-content-available-height` | The remaining height between the trigger and the boundary edge |
| `--akar-popover-trigger-width` | The width of the trigger |
| `--akar-popover-trigger-height` | The height of the trigger |
### Arrow
An optional arrow element to render alongside the popover. This can be used to help visually link the anchor with the `PopoverContent`. Must be rendered inside `PopoverContent`.
**Props**
| Prop | Default | Type | Description |
| --- | --- | --- | --- |
| `as` | `"svg"` | `AsTag \| Component` | The element or component this component should render as. Can be overwritten by `asChild`. |
| `asChild` | | `boolean` | Change the default rendered element for the one passed as a child, merging their props and behavior.
Read our [Composition](https://vinicunca.dev/akar/guides/composition) guide for more details. |
| `height` | `5` | `number` | The height of the arrow in pixels. |
| `rounded` | `false` | `boolean` | When `true`, render the rounded version of arrow. Do not work with `as`/`asChild` |
| `width` | `10` | `number` | The width of the arrow in pixels. |
[PopoverArrow.vue source](https://github.com/vinicunca/akar/blob/v2.0.20/packages/core/src/Popover/PopoverArrow.vue)
### Close
The button that closes an open popover.
**Props**
| Prop | Default | Type | Description |
| --- | --- | --- | --- |
| `as` | `"button"` | `AsTag \| Component` | The element or component this component should render as. Can be overwritten by `asChild`. |
| `asChild` | | `boolean` | Change the default rendered element for the one passed as a child, merging their props and behavior.
Read our [Composition](https://vinicunca.dev/akar/guides/composition) guide for more details. |
[PopoverClose.vue source](https://github.com/vinicunca/akar/blob/v2.0.20/packages/core/src/Popover/PopoverClose.vue)
## Examples
### Constrain the content size
You may want to constrain the width of the content so that it matches the trigger width. You may also want to constrain its height to not exceed the viewport.
We expose several CSS custom properties such as `--akar-popover-trigger-width` and `--akar-popover-content-available-height` to support this. Use them to constrain the content dimensions.
```vue
Read our [Composition](https://vinicunca.dev/akar/guides/composition) guide for more details. |
| `getValueLabel` | `isNumber(value) ? `${Math.round((value / max) * DEFAULT_MAX)}%` : undefined` | `((value: number \| null, max: number) => string)` | A function to get the accessible label text in a human-readable format.
If not provided, the value label will be read as the numeric value as a percentage of the max value. |
| `getValueText` | | `((value: number \| null, max: number) => string)` | A function to get the accessible value text representing the current value in a human-readable format. |
| `max` | `DEFAULT_MAX` | `number` | The maximum progress value. |
| `modelValue` | | `number \| null` | The progress value. Can be bind as `v-model`. |
**Events**
| Event | Payload | Description |
| --- | --- | --- |
| `update:max` | `value: number` | Event handler called when the max value changes |
| `update:modelValue` | `value: string[]` | Event handler called when the progress value changes |
**Slots**
| Slot | Payload | Description |
| --- | --- | --- |
| `modelValue` | `number \| null` | Current input values |
[ProgressRoot.vue source](https://github.com/vinicunca/akar/blob/v2.0.20/packages/core/src/Progress/ProgressRoot.vue)
| Data attribute | Value |
| --- | --- |
| `[data-state]` | "complete" \\| "indeterminate" \\| "loading" |
| `[data-value]` | The current value |
| `[data-max]` | The max value |
### Indicator
Used to show the progress visually. It also makes progress accessible to assistive technologies.
**Props**
| Prop | Default | Type | Description |
| --- | --- | --- | --- |
| `as` | `"div"` | `AsTag \| Component` | The element or component this component should render as. Can be overwritten by `asChild`. |
| `asChild` | | `boolean` | Change the default rendered element for the one passed as a child, merging their props and behavior.
Read our [Composition](https://vinicunca.dev/akar/guides/composition) guide for more details. |
[ProgressIndicator.vue source](https://github.com/vinicunca/akar/blob/v2.0.20/packages/core/src/Progress/ProgressIndicator.vue)
| Data attribute | Value |
| --- | --- |
| `[data-state]` | "complete" \\| "indeterminate" \\| "loading" |
| `[data-value]` | The current value |
| `[data-max]` | The max value |
---
- [ARIA](https://www.w3.org/WAI/ARIA/apg/patterns/meter)
- [GitHub](https://github.com/vinicunca/akar/blob/v2.0.20/packages/core/src/Progress)
- [npm](https://www.npmjs.com/package/akar)
# Radio Group
> A set of checkable buttons—known as radio buttons—where no more than one of the buttons can be checked at a time.
## RadioGroup
```vue [index.vue]
Read our [Composition](https://vinicunca.dev/akar/guides/composition) guide for more details. |
| `defaultValue` | | `AcceptableValue` | The value of the radio item that should be checked when initially rendered.
Use when you do not need to control the state of the radio items. |
| `dir` | | `"ltr" \| "rtl"` | The reading direction of the combobox when applicable.
If omitted, inherits globally from `ConfigProvider` or assumes LTR (left-to-right) reading mode. |
| `disabled` | `false` | `boolean` | When `true`, prevents the user from interacting with radio items. |
| `loop` | `true` | `boolean` | When `true`, keyboard navigation will loop from last item to first, and vice versa. |
| `modelValue` | | `AcceptableValue` | The controlled value of the radio item to check. Can be binded as `v-model`. |
| `name` | | `string` | The name of the field. Submitted with its owning form as part of a name/value pair. |
| `orientation` | | `"vertical" \| "horizontal"` | The orientation of the component. |
| `required` | `false` | `boolean` | When `true`, indicates that the user must set the value before the owning form can be submitted. |
**Events**
| Event | Payload | Description |
| --- | --- | --- |
| `update:modelValue` | `payload: AcceptableValue` | Event handler called when the radio group value changes |
**Slots**
| Slot | Payload | Description |
| --- | --- | --- |
| `modelValue` | `null \| string \| number \| bigint \| Record
Read our [Composition](https://vinicunca.dev/akar/guides/composition) guide for more details. |
| `disabled` | `false` | `boolean` | When `true`, prevents the user from interacting with the radio item. |
| `id` | | `string` | |
| `name` | | `string` | The name of the field. Submitted with its owning form as part of a name/value pair. |
| `required` | | `boolean` | When `true`, indicates that the user must set the value before the owning form can be submitted. |
| `value` | | `AcceptableValue` | The value given as data when submitted with a `name`. |
**Events**
| Event | Payload | Description |
| --- | --- | --- |
| `select` | `event: SelectEvent` | |
**Slots**
| Slot | Payload | Description |
| --- | --- | --- |
| `checked` | `boolean` | Current checked state |
| `required` | `boolean` | Required state |
| `disabled` | `boolean` | Disabled state |
[RadioGroupItem.vue source](https://github.com/vinicunca/akar/blob/v2.0.20/packages/core/src/RadioGroup/RadioGroupItem.vue)
| Data attribute | Value |
| --- | --- |
| `[data-state]` | "checked" \\| "unchecked" |
| `[data-disabled]` | Present when disabled |
### Indicator
Renders when the radio item is in a checked state. You can style this element directly, or you can use it as a wrapper to put an icon into, or both.
> [!NOTE]
>
> Defer mounting with `forceMount` / [`Presence`](https://vinicunca.dev/akar/utilities/presence). See the [animation guide](https://vinicunca.dev/akar/guides/animation).
**Props**
| Prop | Default | Type | Description |
| --- | --- | --- | --- |
| `as` | `"span"` | `AsTag \| Component` | The element or component this component should render as. Can be overwritten by `asChild`. |
| `asChild` | | `boolean` | Change the default rendered element for the one passed as a child, merging their props and behavior.
Read our [Composition](https://vinicunca.dev/akar/guides/composition) guide for more details. |
| `forceMount` | | `boolean` | Used to force mounting when more control is needed. Useful when
controlling animation with Vue animation libraries. |
[RadioGroupIndicator.vue source](https://github.com/vinicunca/akar/blob/v2.0.20/packages/core/src/RadioGroup/RadioGroupIndicator.vue)
| Data attribute | Value |
| --- | --- |
| `[data-state]` | "checked" \\| "unchecked" |
| `[data-disabled]` | Present when disabled |
## Accessibility
Adheres to the [Radio Group WAI-ARIA design pattern](https://www.w3.org/WAI/ARIA/apg/patterns/radiobutton) and uses [roving tabindex](https://www.w3.org/TR/wai-aria-practices-1.2/examples/radio/radio.html) to manage focus movement among radio items.
### Keyboard Interactions
| Key | Description |
| --- | --- |
| Tab | Moves focus to either the checked radio item or the first radio item in the group. |
| Space | When focus is on an unchecked radio item, checks it. |
| ArrowDown | Moves focus and checks the next radio item in the group. |
| ArrowRight | Moves focus and checks the next radio item in the group. |
| ArrowUp | Moves focus to the previous radio item in the group. |
| ArrowLeft | Moves focus to the previous radio item in the group. |
---
- [ARIA](https://www.w3.org/WAI/ARIA/apg/patterns/radiobutton)
- [GitHub](https://github.com/vinicunca/akar/blob/v2.0.20/packages/core/src/RadioGroup)
- [npm](https://www.npmjs.com/package/akar)
# RangeCalendar
> Presents a calendar view tailored for selecting date ranges.
## Range Calendar
`````vue [index.vue]
Read our [Composition](/akar/guides/composition) guide for more details. |
| `calendarLabel` | | `string` | The accessible label for the calendar |
| `defaultPlaceholder` | | `DateValue` | The default placeholder date |
| `defaultValue` | `{ start: undefined, end: undefined }` | `DateRange` | The default value for the calendar |
| `dir` | | `"ltr" \| "rtl"` | The reading direction of the calendar when applicable.
If omitted, inherits globally from `ConfigProvider` or assumes LTR (left-to-right) reading mode. |
| `disabled` | `false` | `boolean` | Whether or not the calendar is disabled |
| `disableDaysOutsideCurrentView` | `false` | `boolean` | Whether or not to disable days outside the current view. |
| `fixedDate` | | `"start" \| "end"` | Which part of the range should be fixed |
| `fixedWeeks` | `false` | `boolean` | Whether or not to always display 6 weeks in the calendar |
| `initialFocus` | `false` | `boolean` | If true, the calendar will focus the selected day, today, or the first day of the month depending on what is visible when the calendar is mounted |
| `isDateDisabled` | | `Matcher` | A function that returns whether or not a date is disabled |
| `isDateHighlightable` | | `Matcher` | A function that returns whether or not a date is hightable |
| `isDateUnavailable` | | `Matcher` | A function that returns whether or not a date is unavailable |
| `locale` | | `string` | The locale to use for formatting dates |
| `maximumDays` | | `number` | The maximum number of days that can be selected in a range |
| `maxValue` | | `DateValue` | The maximum date that can be selected |
| `minValue` | | `DateValue` | The minimum date that can be selected |
| `modelValue` | | `DateRange \| null` | The controlled selected date range of the calendar. Can be bound as `v-model`. |
| `nextPage` | | `((placeholder: DateValue) => DateValue)` | A function that returns the next page of the calendar. It receives the current placeholder as an argument inside the component. |
| `numberOfMonths` | `1` | `number` | The number of months to display at once |
| `pagedNavigation` | `false` | `boolean` | This property causes the previous and next buttons to navigate by the number of months displayed at once, rather than one month |
| `placeholder` | | `DateValue` | The placeholder date, which is used to determine what month to display when no date is selected. This updates as the user navigates the calendar and can be used to programmatically control the calendar view |
| `preventDeselect` | `false` | `boolean` | Whether or not to prevent the user from deselecting a date without selecting another date first |
| `prevPage` | | `((placeholder: DateValue) => DateValue)` | A function that returns the previous page of the calendar. It receives the current placeholder as an argument inside the component. |
| `readonly` | `false` | `boolean` | Whether or not the calendar is readonly |
| `weekdayFormat` | `"narrow"` | `"narrow" \| "short" \| "long"` | The format to use for the weekday strings provided via the weekdays slot prop |
| `weekStartsOn` | | `0 \| 1 \| 2 \| 3 \| 4 \| 5 \| 6` | The day of the week to start the calendar on |
**Events**
| Event | Payload | Description |
| --- | --- | --- |
| `update:modelValue` | `date: DateRange` | Event handler called whenever the model value changes |
| `update:placeholder` | `date: DateValue` | Event handler called whenever the placeholder value changes |
| `update:startValue` | `date: DateValue` | Event handler called whenever the start value changes |
| `update:validModelValue` | `date: DateRange` | Event handler called whenever there is a new validModel |
**Slots**
| Slot | Payload | Description |
| --- | --- | --- |
| `date` | `DateValue` | The current date of the placeholder |
| `grid` | `Grid
Read our [Composition](/akar/guides/composition) guide for more details. |
[RangeCalendarHeader.vue source](https://github.com/vinicunca/akar/blob/v2.0.20/packages/core/src/RangeCalendar/RangeCalendarHeader.vue)
### Prev Button
Calendar navigation button. It navigates the calendar one month/year/decade in the past based on the current calendar view.
| Data attribute | Value |
| --- | --- |
| `[data-disabled]` | Present when disabled |
**Props**
| Prop | Default | Type | Description |
| --- | --- | --- | --- |
| `as` | `"button"` | `AsTag \| Component` | The element or component this component should render as. Can be overwritten by `asChild`. |
| `asChild` | | `boolean` | Change the default rendered element for the one passed as a child, merging their props and behavior.
Read our [Composition](/akar/guides/composition) guide for more details. |
| `prevPage` | | `((placeholder: DateValue) => DateValue)` | The function to be used for the prev page. Overwrites the `prevPage` function set on the `RangeCalendarRoot`. |
**Slots**
| Slot | Payload | Description |
| --- | --- | --- |
| `disabled` | `boolean` | Current disable state |
[RangeCalendarPrev.vue source](https://github.com/vinicunca/akar/blob/v2.0.20/packages/core/src/RangeCalendar/RangeCalendarPrev.vue)
### Next Button
Calendar navigation button. It navigates the calendar one month/year/decade in the future based on the current calendar view.
**Props**
| Prop | Default | Type | Description |
| --- | --- | --- | --- |
| `as` | `"button"` | `AsTag \| Component` | The element or component this component should render as. Can be overwritten by `asChild`. |
| `asChild` | | `boolean` | Change the default rendered element for the one passed as a child, merging their props and behavior.
Read our [Composition](/akar/guides/composition) guide for more details. |
| `nextPage` | | `((placeholder: DateValue) => DateValue)` | The function to be used for the next page. Overwrites the `nextPage` function set on the `RangeCalendarRoot`. |
**Slots**
| Slot | Payload | Description |
| --- | --- | --- |
| `disabled` | `boolean` | Current disable state |
[RangeCalendarNext.vue source](https://github.com/vinicunca/akar/blob/v2.0.20/packages/core/src/RangeCalendar/RangeCalendarNext.vue)
| Data attribute | Value |
| --- | --- |
| `[data-disabled]` | Present when disabled |
### Heading
Heading for displaying the current month and year.
**Props**
| Prop | Default | Type | Description |
| --- | --- | --- | --- |
| `as` | `"div"` | `AsTag \| Component` | The element or component this component should render as. Can be overwritten by `asChild`. |
| `asChild` | | `boolean` | Change the default rendered element for the one passed as a child, merging their props and behavior.
Read our [Composition](/akar/guides/composition) guide for more details. |
**Slots**
| Slot | Payload | Description |
| --- | --- | --- |
| `headingValue` | `string` | Current month and year |
[RangeCalendarHeading.vue source](https://github.com/vinicunca/akar/blob/v2.0.20/packages/core/src/RangeCalendar/RangeCalendarHeading.vue)
| Data attribute | Value |
| --- | --- |
| `[data-disabled]` | Present when disabled |
### Grid
Container for wrapping the calendar grid.
**Props**
| Prop | Default | Type | Description |
| --- | --- | --- | --- |
| `as` | `"table"` | `AsTag \| Component` | The element or component this component should render as. Can be overwritten by `asChild`. |
| `asChild` | | `boolean` | Change the default rendered element for the one passed as a child, merging their props and behavior.
Read our [Composition](/akar/guides/composition) guide for more details. |
[RangeCalendarGrid.vue source](https://github.com/vinicunca/akar/blob/v2.0.20/packages/core/src/RangeCalendar/RangeCalendarGrid.vue)
| Data attribute | Value |
| --- | --- |
| `[data-readonly]` | Present when readonly |
| `[data-disabled]` | Present when disabled |
### Grid Head
Container for wrapping the grid head.
**Props**
| Prop | Default | Type | Description |
| --- | --- | --- | --- |
| `as` | `"thead"` | `AsTag \| Component` | The element or component this component should render as. Can be overwritten by `asChild`. |
| `asChild` | | `boolean` | Change the default rendered element for the one passed as a child, merging their props and behavior.
Read our [Composition](/akar/guides/composition) guide for more details. |
[RangeCalendarGridHead.vue source](https://github.com/vinicunca/akar/blob/v2.0.20/packages/core/src/RangeCalendar/RangeCalendarGridHead.vue)
### Grid Body
Container for wrapping the grid body.
**Props**
| Prop | Default | Type | Description |
| --- | --- | --- | --- |
| `as` | `"tbody"` | `AsTag \| Component` | The element or component this component should render as. Can be overwritten by `asChild`. |
| `asChild` | | `boolean` | Change the default rendered element for the one passed as a child, merging their props and behavior.
Read our [Composition](/akar/guides/composition) guide for more details. |
[RangeCalendarGridBody.vue source](https://github.com/vinicunca/akar/blob/v2.0.20/packages/core/src/RangeCalendar/RangeCalendarGridBody.vue)
### Grid Row
Container for wrapping the grid row.
**Props**
| Prop | Default | Type | Description |
| --- | --- | --- | --- |
| `as` | `"tr"` | `AsTag \| Component` | The element or component this component should render as. Can be overwritten by `asChild`. |
| `asChild` | | `boolean` | Change the default rendered element for the one passed as a child, merging their props and behavior.
Read our [Composition](/akar/guides/composition) guide for more details. |
[RangeCalendarGridRow.vue source](https://github.com/vinicunca/akar/blob/v2.0.20/packages/core/src/RangeCalendar/RangeCalendarGridRow.vue)
### Head Cell
Container for wrapping the head cell. Used for displaying the week days.
**Props**
| Prop | Default | Type | Description |
| --- | --- | --- | --- |
| `as` | `"th"` | `AsTag \| Component` | The element or component this component should render as. Can be overwritten by `asChild`. |
| `asChild` | | `boolean` | Change the default rendered element for the one passed as a child, merging their props and behavior.
Read our [Composition](/akar/guides/composition) guide for more details. |
[RangeCalendarHeadCell.vue source](https://github.com/vinicunca/akar/blob/v2.0.20/packages/core/src/RangeCalendar/RangeCalendarHeadCell.vue)
### Cell
Container for wrapping the calendar cells.
**Props**
| Prop | Default | Type | Description |
| --- | --- | --- | --- |
| `as` | `"td"` | `AsTag \| Component` | The element or component this component should render as. Can be overwritten by `asChild`. |
| `asChild` | | `boolean` | Change the default rendered element for the one passed as a child, merging their props and behavior.
Read our [Composition](/akar/guides/composition) guide for more details. |
| `date*` | | `DateValue` | |
[RangeCalendarCell.vue source](https://github.com/vinicunca/akar/blob/v2.0.20/packages/core/src/RangeCalendar/RangeCalendarCell.vue)
| Data attribute | Value |
| --- | --- |
| `[data-disabled]` | Present when disabled |
### Cell Trigger
Interactable container for displaying the cell dates. Clicking it selects the date.
**Props**
| Prop | Default | Type | Description |
| --- | --- | --- | --- |
| `as` | `"div"` | `AsTag \| Component` | The element or component this component should render as. Can be overwritten by `asChild`. |
| `asChild` | | `boolean` | Change the default rendered element for the one passed as a child, merging their props and behavior.
Read our [Composition](/akar/guides/composition) guide for more details. |
| `day*` | | `DateValue` | |
| `month*` | | `DateValue` | |
**Slots**
| Slot | Payload | Description |
| --- | --- | --- |
| `dayValue` | `string` | Current day |
| `disabled` | `boolean` | Current disable state |
| `selected` | `boolean` | Current selected state |
| `today` | `boolean` | Current today state |
| `outsideView` | `boolean` | Current outside view state |
| `outsideVisibleView` | `boolean` | Current outside visible view state |
| `unavailable` | `boolean` | Current unavailable state |
| `highlighted` | `boolean` | Current highlighted state |
| `highlightedStart` | `boolean` | Current highlighted start state |
| `highlightedEnd` | `boolean` | Current highlighted end state |
| `selectionStart` | `boolean` | Current selection start state |
| `selectionEnd` | `boolean` | Current selection end state |
[RangeCalendarCellTrigger.vue source](https://github.com/vinicunca/akar/blob/v2.0.20/packages/core/src/RangeCalendar/RangeCalendarCellTrigger.vue)
| Data attribute | Value |
| --- | --- |
| `[data-selected]` | Present when selected |
| `[data-value]` | The ISO string value of the date. |
| `[data-disabled]` | Present when disabled |
| `[data-unavailable]` | Present when unavailable |
| `[data-today]` | Present when today |
| `[data-outside-view]` | Present when the date is outside the current month it is displayed in. |
| `[data-outside-visible-view]` | Present when the date is outside the months that are visible on the calendar. |
| `[data-selection-start]` | Present when the date is the start of the selection. |
| `[data-selection-end]` | Present when the date is the end of the selection. |
| `[data-highlighted]` | Present when the date is highlighted by the user as they select a range. |
| `[data-highlighted-start]` | Present when the date is the start of the range that is highlighted by the user. |
| `[data-highlighted-end]` | Present when the date is the end of the range that is highlighted by the user. |
| `[data-focused]` | Present when focused |
## Accessibility
### Keyboard Interactions
| Key | Description |
| --- | --- |
| Tab | When focus moves onto the calendar, focuses the first navigation button. |
| Space | When the focus is on either `RangeCalendarNext` or `RangeCalendarPrev`, it navigates the calendar. Otherwise, it selects the date. |
| Enter | When the focus is on either `RangeCalendarNext` or `RangeCalendarPrev`, it navigates the calendar. Otherwise, it selects the date. |
| ArrowLeft / ArrowRight / ArrowUp / ArrowDown | When the focus is on `RangeCalendarCellTrigger`, it navigates the dates, changing the month/year/decade if necessary. |
| Home | When the focus is on `RangeCalendarCellTrigger`, it moves focus to the first day of the current week. |
| End | When the focus is on `RangeCalendarCellTrigger`, it moves focus to the last day of the current week. |
| PageUp | When the focus is on `RangeCalendarCellTrigger`, it moves to the previous month while preserving the day of the month when possible, or clamps to the last day of the month. |
| PageDown | When the focus is on `RangeCalendarCellTrigger`, it moves to the next month while preserving the day of the month when possible, or clamps to the last day of the month. |
| Shift+PageUp | When the focus is on `RangeCalendarCellTrigger`, it moves to the previous year while preserving the month and day when possible, or clamps to the last day of the month. |
| Shift+PageDown | When the focus is on `RangeCalendarCellTrigger`, it moves to the next year while preserving the month and day when possible, or clamps to the last day of the month. |
---
- [GitHub](https://github.com/vinicunca/akar/blob/v2.0.20/packages/core/src/RangeCalendar)
- [npm](https://www.npmjs.com/package/akar)
# Rating
> A star-rating input where the user selects a score, with support for fractional values.
```vue [index.vue]
Read our [Composition](https://vinicunca.dev/akar/guides/composition) guide for more details. |
| `clearable` | | `boolean` | When `true`, clicking the currently selected rating resets the value to `0`. |
| `defaultValue` | | `number` | The rating value when initially rendered. Use when you do not need to control the state of the rating. |
| `dir` | | `"ltr" \| "rtl"` | The reading direction of the combobox when applicable.
If omitted, inherits globally from `ConfigProvider` or assumes LTR (left-to-right) reading mode. |
| `disabled` | | `boolean` | When `true`, prevents the user from interacting with radio items. |
| `hoverable` | | `boolean` | When `true`, the rating previews the value under the pointer on hover. |
| `length` | `5` | `number` | The number of rating items to render. |
| `loop` | | `boolean` | When `true`, keyboard navigation will loop from last item to first, and vice versa. |
| `modelValue` | | `number` | The controlled rating value. Can be bound with `v-model`. |
| `name` | | `string` | The name of the field. Submitted with its owning form as part of a name/value pair. |
| `orientation` | `"horizontal"` | `"vertical" \| "horizontal"` | The orientation of the component. |
| `required` | | `boolean` | When `true`, indicates that the user must set the value before the owning form can be submitted. |
| `step` | `1` | `1 \| 0.5 \| 0.25 \| 0.1` | The granularity each rating item is divided into. |
**Events**
| Event | Payload | Description |
| --- | --- | --- |
| `update:modelValue` | `payload: number` | Event handler called when the value changes |
**Slots**
| Slot | Payload | Description |
| --- | --- | --- |
| `modelValue` | `number` | |
| `items` | `number[]` | |
[RatingRoot.vue source](https://github.com/vinicunca/akar/blob/v2.0.20/packages/core/src/Rating/RatingRoot.vue)
| Data attribute | Value |
| --- | --- |
| `[data-disabled]` | Present when disabled |
| `[data-orientation]` | "vertical" \\| "horizontal" |
### Item
Wraps a single rating value (e.g. a single star). It computes the list of `steps` that compose this item based on the root's `step` prop, exposed via the default slot. Renders a `label` by default.
**Props**
| Prop | Default | Type | Description |
| --- | --- | --- | --- |
| `as` | `"label"` | `AsTag \| Component` | The element or component this component should render as. Can be overwritten by `asChild`. |
| `asChild` | | `boolean` | Change the default rendered element for the one passed as a child, merging their props and behavior.
Read our [Composition](https://vinicunca.dev/akar/guides/composition) guide for more details. |
| `item*` | | `number` | The 1-based index of this item within the rating (e.g. the 3rd star). |
**Slots**
| Slot | Payload | Description |
| --- | --- | --- |
| `steps` | `number[]` | |
[RatingItem.vue source](https://github.com/vinicunca/akar/blob/v2.0.20/packages/core/src/Rating/RatingItem.vue)
### ItemIndicator
The interactive indicator rendered for each step of an item. It reflects whether the step is active based on the current (or hovered) value.
**Props**
| Prop | Default | Type | Description |
| --- | --- | --- | --- |
| `as` | `"div"` | `AsTag \| Component` | The element or component this component should render as. Can be overwritten by `asChild`. |
| `asChild` | | `boolean` | Change the default rendered element for the one passed as a child, merging their props and behavior.
Read our [Composition](https://vinicunca.dev/akar/guides/composition) guide for more details. |
| `step*` | | `number` | The step value this indicator represents. |
[RatingItemIndicator.vue source](https://github.com/vinicunca/akar/blob/v2.0.20/packages/core/src/Rating/RatingItemIndicator.vue)
| Data attribute | Value |
| --- | --- |
| `[data-state]` | "active" |
| `[data-disabled]` | Present when disabled |
To render partial steps (for `step` values below `1`), `RatingItemIndicator` exposes the following CSS variables:
| CSS Variable | Description |
| --- | --- |
| `--akar-rating-item-step-width` | The width this step should occupy within the item, e.g. `50%` for a half step. |
| `--akar-rating-item-step-opacity` | `1` when the step should be visible, `0` otherwise (used to stack overlapping steps). |
| `--akar-rating-item-step-z-index` | The stacking order of the step so smaller steps render above larger ones. |
A typical fractional indicator clips its width and stacks steps using these variables:
```vue
Read our [Composition](https://vinicunca.dev/akar/guides/composition) guide for more details. |
| `dir` | | `"ltr" \| "rtl"` | The reading direction of the combobox when applicable.
If omitted, inherits globally from `ConfigProvider` or assumes LTR (left-to-right) reading mode. |
| `scrollHideDelay` | `600` | `number` | If type is set to either `scroll` or `hover`, this prop determines the length of time, in milliseconds,
before the scrollbars are hidden after the user stops interacting with scrollbars. |
| `type` | `"hover"` | `"scroll" \| "always" \| "hover" \| "auto" \| "glimpse"` | Describes the nature of scrollbar visibility, similar to how the scrollbar preferences in MacOS control visibility of native scrollbars.
`auto` - means that scrollbars are visible when content is overflowing on the corresponding orientation.
`always` - means that scrollbars are always visible regardless of whether the content is overflowing.
`scroll` - means that scrollbars are visible when the user is scrolling along its corresponding orientation.
`hover` - when the user is scrolling along its corresponding orientation and when the user is hovering over the scroll area.
`glimpse` - a hybrid approach that briefly shows scrollbars when the user enters the scroll area, then hides them until further interaction. |
**Methods**
| Method | Type | Description |
| --- | --- | --- |
| `scrollTop` | `() => void` | Scroll viewport to top |
| `scrollTopLeft` | `() => void` | Scroll viewport to top-left |
[ScrollAreaRoot.vue source](https://github.com/vinicunca/akar/blob/v2.0.20/packages/core/src/ScrollArea/ScrollAreaRoot.vue)
### Viewport
The viewport area of the scroll area.
**Props**
| Prop | Default | Type | Description |
| --- | --- | --- | --- |
| `as` | `"div"` | `AsTag \| Component` | The element or component this component should render as. Can be overwritten by `asChild`. |
| `asChild` | | `boolean` | Change the default rendered element for the one passed as a child, merging their props and behavior.
Read our [Composition](https://vinicunca.dev/akar/guides/composition) guide for more details. |
| `nonce` | | `string` | Will add `nonce` attribute to the style tag which can be used by Content Security Policy.
If omitted, inherits globally from `ConfigProvider`. |
[ScrollAreaViewport.vue source](https://github.com/vinicunca/akar/blob/v2.0.20/packages/core/src/ScrollArea/ScrollAreaViewport.vue)
### Scrollbar
The vertical scrollbar. Add a second `Scrollbar` with an `orientation` prop to enable horizontal scrolling.
> [!NOTE]
>
> Defer mounting with `forceMount` / [`Presence`](https://vinicunca.dev/akar/utilities/presence). See the [animation guide](https://vinicunca.dev/akar/guides/animation).
**Props**
| Prop | Default | Type | Description |
| --- | --- | --- | --- |
| `as` | `"div"` | `AsTag \| Component` | The element or component this component should render as. Can be overwritten by `asChild`. |
| `asChild` | | `boolean` | Change the default rendered element for the one passed as a child, merging their props and behavior.
Read our [Composition](https://vinicunca.dev/akar/guides/composition) guide for more details. |
| `forceMount` | | `boolean` | Used to force mounting when more control is needed. Useful when
controlling animation with Vue animation libraries. |
| `orientation` | `"vertical"` | `"vertical" \| "horizontal"` | The orientation of the scrollbar |
[ScrollAreaScrollbar.vue source](https://github.com/vinicunca/akar/blob/v2.0.20/packages/core/src/ScrollArea/ScrollAreaScrollbar.vue)
| Data attribute | Value |
| --- | --- |
| `[data-state]` | "visible" \\| "hidden" |
| `[data-orientation]` | "vertical" \\| "horizontal" |
### Thumb
The thumb to be used in `ScrollAreaScrollbar`.
**Props**
| Prop | Default | Type | Description |
| --- | --- | --- | --- |
| `as` | `"div"` | `AsTag \| Component` | The element or component this component should render as. Can be overwritten by `asChild`. |
| `asChild` | | `boolean` | Change the default rendered element for the one passed as a child, merging their props and behavior.
Read our [Composition](https://vinicunca.dev/akar/guides/composition) guide for more details. |
[ScrollAreaThumb.vue source](https://github.com/vinicunca/akar/blob/v2.0.20/packages/core/src/ScrollArea/ScrollAreaThumb.vue)
| Data attribute | Value |
| --- | --- |
| `[data-state]` | "visible" \\| "hidden" |
### Corner
The corner where both vertical and horizontal scrollbars meet.
**Props**
| Prop | Default | Type | Description |
| --- | --- | --- | --- |
| `as` | `"div"` | `AsTag \| Component` | The element or component this component should render as. Can be overwritten by `asChild`. |
| `asChild` | | `boolean` | Change the default rendered element for the one passed as a child, merging their props and behavior.
Read our [Composition](https://vinicunca.dev/akar/guides/composition) guide for more details. |
[ScrollAreaCorner.vue source](https://github.com/vinicunca/akar/blob/v2.0.20/packages/core/src/ScrollArea/ScrollAreaCorner.vue)
## Examples
### Custom Scroll
Use the exposed `viewport` to modify / or set the scroll position outside default methods
```vue
If omitted, inherits globally from `ConfigProvider` or assumes LTR (left-to-right) reading mode. |
| `disabled` | | `boolean` | When `true`, prevents the user from interacting with Select |
| `modelValue` | | `T \| T[]` | The controlled value of the Select. Can be bind as `v-model`. |
| `multiple` | | `boolean` | Whether multiple options can be selected or not. |
| `name` | | `string` | The name of the field. Submitted with its owning form as part of a name/value pair. |
| `nullableValue` | `""` | `string` | The value of the hidden native select option when the model value is nullish. |
| `open` | | `boolean` | The controlled open state of the Select. Can be bind as `v-model:open`. |
| `required` | | `boolean` | When `true`, indicates that the user must set the value before the owning form can be submitted. |
**Events**
| Event | Payload | Description |
| --- | --- | --- |
| `update:modelValue` | `value: T` | Event handler called when the value changes. |
| `update:open` | `value: boolean` | Event handler called when the open state of the context menu changes. |
**Slots**
| Slot | Payload | Description |
| --- | --- | --- |
| `modelValue` | `T \| T[]` | Current input values |
| `open` | `boolean` | Current open state |
[SelectRoot.vue source](https://github.com/vinicunca/akar/blob/v2.0.20/packages/core/src/Select/SelectRoot.vue)
### Trigger
The button that toggles the Select The `SelectContent` will position itself by aligning over the trigger.
**Props**
| Prop | Default | Type | Description |
| --- | --- | --- | --- |
| `as` | `"button"` | `AsTag \| Component` | The element or component this component should render as. Can be overwritten by `asChild`. |
| `asChild` | | `boolean` | Change the default rendered element for the one passed as a child, merging their props and behavior.
Read our [Composition](https://vinicunca.dev/akar/guides/composition) guide for more details. |
| `disabled` | | `boolean` | |
| `reference` | | `ReferenceElement` | The reference (or anchor) element that is being referred to for positioning.
If not provided will use the current component as anchor. |
[SelectTrigger.vue source](https://github.com/vinicunca/akar/blob/v2.0.20/packages/core/src/Select/SelectTrigger.vue)
| Data attribute | Value |
| --- | --- |
| `[data-state]` | "open" \\| "closed" |
| `[data-disabled]` | Present when disabled |
| `[data-placeholder]` | Present when has placeholder |
### Value
The part that reflects the selected value. By default the selected item's text will be rendered. if you require more control, you can instead control the select and pass your own `children`. It should not be styled to ensure correct positioning. An optional `placeholder` prop is also available for when the select has no value.
**Props**
| Prop | Default | Type | Description |
| --- | --- | --- | --- |
| `as` | `"span"` | `AsTag \| Component` | The element or component this component should render as. Can be overwritten by `asChild`. |
| `asChild` | | `boolean` | Change the default rendered element for the one passed as a child, merging their props and behavior.
Read our [Composition](https://vinicunca.dev/akar/guides/composition) guide for more details. |
| `placeholder` | `""` | `string` | The content that will be rendered inside the `SelectValue` when no `value` or `defaultValue` is set. |
**Slots**
| Slot | Payload | Description |
| --- | --- | --- |
| `selectedLabel` | `string[]` | |
| `modelValue` | `AcceptableValue \| AcceptableValue[]` | |
[SelectValue.vue source](https://github.com/vinicunca/akar/blob/v2.0.20/packages/core/src/Select/SelectValue.vue)
### Icon
A small icon often displayed next to the value as a visual affordance for the fact it can be open. By default renders ▼ but you can use your own icon via `asChild` or use `children`.
**Props**
| Prop | Default | Type | Description |
| --- | --- | --- | --- |
| `as` | `"div"` | `AsTag \| Component` | The element or component this component should render as. Can be overwritten by `asChild`. |
| `asChild` | | `boolean` | Change the default rendered element for the one passed as a child, merging their props and behavior.
Read our [Composition](https://vinicunca.dev/akar/guides/composition) guide for more details. |
| `disabled` | | `boolean` | When `true`, prevents the user from interacting with the item. |
| `textValue` | | `string` | Optional text used for typeahead purposes.
By default the typeahead behavior will use the `.textContent` of the `SelectItemText` part.
Use this when the content is complex, or you have non-textual content inside. |
| `value*` | | `AcceptableValue` | The value given as data when submitted with a `name`. |
**Events**
| Event | Payload | Description |
| --- | --- | --- |
| `select` | `event: SelectEvent
It can be prevented by calling `event.preventDefault`. |
**Slots**
| Slot | Payload | Description |
| --- | --- | --- |
| `selected` | `boolean` | Whether the item is currently selected |
[SelectItem.vue source](https://github.com/vinicunca/akar/blob/v2.0.20/packages/core/src/Select/SelectItem.vue)
### Portal
When used, portals the content part into the `body`.
**Props**
| Prop | Default | Type | Description |
| --- | --- | --- | --- |
| `defer` | | `boolean` | Defer the resolving of a Teleport target until other parts of the
application have mounted (requires Vue 3.5.0+)
[reference](https://vuejs.org/guide/built-ins/teleport.html#deferred-teleport) |
| `disabled` | | `boolean` | Disable teleport and render the component inline
[reference](https://vuejs.org/guide/built-ins/teleport.html#disabling-teleport) |
| `forceMount` | | `boolean` | Used to force mounting when more control is needed. Useful when
controlling animation with Vue animation libraries. |
| `to` | | `string \| HTMLElement` | Vue native teleport component prop `:to`
[reference](https://vuejs.org/guide/built-ins/teleport.html#basic-usage) |
[SelectPortal.vue source](https://github.com/vinicunca/akar/blob/v2.0.20/packages/core/src/Select/SelectPortal.vue)
### Content
The component that pops out when the select is open.
> [!NOTE]
>
> Defer mounting with `forceMount` / [`Presence`](https://vinicunca.dev/akar/utilities/presence). See the [animation guide](https://vinicunca.dev/akar/guides/animation).
**Props**
| Prop | Default | Type | Description |
| --- | --- | --- | --- |
| `align` | `"center"` | `"start" \| "center" \| "end"` | The preferred alignment against the trigger.
May change when collisions occur. |
| `alignFlip` | `true` | `boolean` | Flip alignment when colliding with boundary.
May only occur when `prioritizePosition` is true. |
| `alignOffset` | `0` | `number` | An offset in pixels from the `start` or `end` alignment options. |
| `arrowPadding` | `0` | `number` | The padding between the arrow and the edges of the content.
If your content has border-radius, this will prevent it from
overflowing the corners. |
| `as` | `"div"` | `AsTag \| Component` | The element or component this component should render as. Can be overwritten by `asChild`. |
| `asChild` | | `boolean` | Change the default rendered element for the one passed as a child, merging their props and behavior.
Read our [Composition](https://vinicunca.dev/akar/guides/composition) guide for more details. |
| `avoidCollisions` | `true` | `boolean` | When `true`, overrides the side and align preferences
to prevent collisions with boundary edges. |
| `bodyLock` | `true` | `boolean` | The document.body will be lock, and scrolling will be disabled. |
| `collisionBoundary` | `[]` | `Element \| (Element \| null)[] \| null` | The element used as the collision boundary. By default
this is the viewport, though you can provide additional
element(s) to be included in this check. |
| `collisionPadding` | `0` | `number \| Partial
detection should occur. Accepts a number (same for all sides),
or a partial padding object, for example: { top: 20, left: 20 }. |
| `dir` | | `"ltr" \| "rtl"` | The reading direction of the popper content when applicable.
If omitted, inherits globally from `ConfigProvider` or assumes LTR (left-to-right) reading mode. |
| `disableOutsidePointerEvents` | | `boolean` | When `true`, hover/focus/click interactions will be disabled on elements outside
the `DismissableLayer`. Users will need to click twice on outside elements to
interact with them: once to close the `DismissableLayer`, and again to trigger the element. |
| `disableUpdateOnLayoutShift` | `false` | `boolean` | Whether to disable the update position for the content when the layout shifted. |
| `forceMount` | | `boolean` | Used to force mounting when more control is needed. Useful when
controlling animation with Vue animation libraries. |
| `hideShiftedArrow` | `true` | `boolean` | When `true`, hides the arrow when it cannot be centered
to the reference element. |
| `hideWhenDetached` | `false` | `boolean` | Whether to hide the content when the trigger becomes fully occluded. |
| `memoDependencies` | | `unknown[]` | Reactive dependencies that should invalidate the memoized content subtree. |
| `position` | | `"popper" \| "item-aligned"` | The positioning mode to use
`item-aligned (default)` - behaves similarly to a native MacOS menu by positioning content relative to the active item.
`popper` - positions content in the same way as our other primitives, for example `Popover` or `DropdownMenu`. |
| `positionStrategy` | | `"fixed" \| "absolute"` | The type of CSS position property to use. |
| `prioritizePosition` | `false` | `boolean` | Force content to be position within the viewport.
Might overlap the reference element, which may not be desired. |
| `reference` | | `ReferenceElement` | The custom element or virtual element that will be set as the reference
to position the floating element.
If provided, it will replace the default anchor element. |
| `side` | `"bottom"` | `"top" \| "right" \| "bottom" \| "left"` | The preferred side of the trigger to render against when open.
Will be reversed when collisions occur and avoidCollisions
is enabled. |
| `sideFlip` | `true` | `boolean` | Flip to the opposite side when colliding with boundary. |
| `sideOffset` | `0` | `number` | The distance in pixels from the trigger. |
| `sticky` | `"partial"` | `"partial" \| "always"` | The sticky behavior on the align axis. `partial` will keep the
content in the boundary as long as the trigger is at least partially
in the boundary whilst "always" will keep the content in the boundary
regardless. |
| `updatePositionStrategy` | `'optimized'` | `"always" \| "optimized"` | Strategy to update the position of the floating element on every animation frame. |
**Events**
| Event | Payload | Description |
| --- | --- | --- |
| `closeAutoFocus` | `event: Event` | |
| `escapeKeyDown` | `event: KeyboardEvent` | Event handler called when the escape key is down.
Can be prevented. |
| `pointerDownOutside` | `event: PointerDownOutsideEvent` | Event handler called when a `pointerdown` event happens outside of the `DismissableLayer`.
Can be prevented. |
[SelectContent.vue source](https://github.com/vinicunca/akar/blob/v2.0.20/packages/core/src/Select/SelectContent.vue)
| Data attribute | Value |
| --- | --- |
| `[data-state]` | "open" \\| "closed" |
| `[data-side]` | "left" \\| "right" \\| "bottom" \\| "top" |
| `[data-align]` | "start" \\| "end" \\| "center" |
| CSS variable | Description |
| --- | --- |
| `--akar-select-content-transform-origin` | The `transform-origin` computed from the content and arrow positions/offsets. Only present when `position="popper"`. |
| `--akar-select-content-available-width` | The remaining width between the trigger and the boundary edge. Only present when `position="popper"`. |
| `--akar-select-content-available-height` | The remaining height between the trigger and the boundary edge. Only present when `position="popper"`. |
| `--akar-select-trigger-width` | The width of the trigger. Only present when `position="popper"`. |
| `--akar-select-trigger-height` | The height of the trigger. Only present when `position="popper"`. |
### Viewport
The scrolling viewport that contains all of the items.
**Props**
| Prop | Default | Type | Description |
| --- | --- | --- | --- |
| `as` | `"div"` | `AsTag \| Component` | The element or component this component should render as. Can be overwritten by `asChild`. |
| `asChild` | | `boolean` | Change the default rendered element for the one passed as a child, merging their props and behavior.
Read our [Composition](https://vinicunca.dev/akar/guides/composition) guide for more details. |
| `nonce` | | `string` | Will add `nonce` attribute to the style tag which can be used by Content Security Policy.
If omitted, inherits globally from `ConfigProvider`. |
[SelectViewport.vue source](https://github.com/vinicunca/akar/blob/v2.0.20/packages/core/src/Select/SelectViewport.vue)
### Item
The component that contains the select items.
**Props**
| Prop | Default | Type | Description |
| --- | --- | --- | --- |
| `as` | `"div"` | `AsTag \| Component` | The element or component this component should render as. Can be overwritten by `asChild`. |
| `asChild` | | `boolean` | Change the default rendered element for the one passed as a child, merging their props and behavior.
Read our [Composition](https://vinicunca.dev/akar/guides/composition) guide for more details. |
| `disabled` | | `boolean` | When `true`, prevents the user from interacting with the item. |
| `textValue` | | `string` | Optional text used for typeahead purposes.
By default the typeahead behavior will use the `.textContent` of the `SelectItemText` part.
Use this when the content is complex, or you have non-textual content inside. |
| `value*` | | `AcceptableValue` | The value given as data when submitted with a `name`. |
**Events**
| Event | Payload | Description |
| --- | --- | --- |
| `select` | `event: SelectEvent
It can be prevented by calling `event.preventDefault`. |
**Slots**
| Slot | Payload | Description |
| --- | --- | --- |
| `selected` | `boolean` | Whether the item is currently selected |
[SelectItem.vue source](https://github.com/vinicunca/akar/blob/v2.0.20/packages/core/src/Select/SelectItem.vue)
| Data attribute | Value |
| --- | --- |
| `[data-state]` | "checked" \\| "unchecked" |
| `[data-highlighted]` | Present when highlighted |
| `[data-disabled]` | Present when disabled |
### ItemText
The textual part of the item. It should only contain the text you want to see in the trigger when that item is selected. It should not be styled to ensure correct positioning.
**Props**
| Prop | Default | Type | Description |
| --- | --- | --- | --- |
| `as` | `"span"` | `AsTag \| Component` | The element or component this component should render as. Can be overwritten by `asChild`. |
| `asChild` | | `boolean` | Change the default rendered element for the one passed as a child, merging their props and behavior.
Read our [Composition](https://vinicunca.dev/akar/guides/composition) guide for more details. |
[SelectItemText.vue source](https://github.com/vinicunca/akar/blob/v2.0.20/packages/core/src/Select/SelectItemText.vue)
### ItemIndicator
Renders when the item is selected. You can style this element directly, or you can use it as a wrapper to put an icon into, or both.
**Props**
| Prop | Default | Type | Description |
| --- | --- | --- | --- |
| `as` | `"span"` | `AsTag \| Component` | The element or component this component should render as. Can be overwritten by `asChild`. |
| `asChild` | | `boolean` | Change the default rendered element for the one passed as a child, merging their props and behavior.
Read our [Composition](https://vinicunca.dev/akar/guides/composition) guide for more details. |
| `forceMount` | | `boolean` | Used to force mounting when more control is needed. Useful when
controlling animation with Vue animation libraries. |
[SelectItemIndicator.vue source](https://github.com/vinicunca/akar/blob/v2.0.20/packages/core/src/Select/SelectItemIndicator.vue)
### ScrollUpButton
An optional button used as an affordance to show the viewport overflow as well as functionally enable scrolling upwards.
**Props**
| Prop | Default | Type | Description |
| --- | --- | --- | --- |
| `as` | `"div"` | `AsTag \| Component` | The element or component this component should render as. Can be overwritten by `asChild`. |
| `asChild` | | `boolean` | Change the default rendered element for the one passed as a child, merging their props and behavior.
Read our [Composition](https://vinicunca.dev/akar/guides/composition) guide for more details. |
[SelectScrollUpButton.vue source](https://github.com/vinicunca/akar/blob/v2.0.20/packages/core/src/Select/SelectScrollUpButton.vue)
### ScrollDownButton
An optional button used as an affordance to show the viewport overflow as well as functionally enable scrolling downwards.
**Props**
| Prop | Default | Type | Description |
| --- | --- | --- | --- |
| `as` | `"div"` | `AsTag \| Component` | The element or component this component should render as. Can be overwritten by `asChild`. |
| `asChild` | | `boolean` | Change the default rendered element for the one passed as a child, merging their props and behavior.
Read our [Composition](https://vinicunca.dev/akar/guides/composition) guide for more details. |
[SelectScrollDownButton.vue source](https://github.com/vinicunca/akar/blob/v2.0.20/packages/core/src/Select/SelectScrollDownButton.vue)
### Group
Used to group multiple items. use in conjunction with `SelectLabel` to ensure good accessibility via automatic labelling.
**Props**
| Prop | Default | Type | Description |
| --- | --- | --- | --- |
| `as` | `"div"` | `AsTag \| Component` | The element or component this component should render as. Can be overwritten by `asChild`. |
| `asChild` | | `boolean` | Change the default rendered element for the one passed as a child, merging their props and behavior.
Read our [Composition](https://vinicunca.dev/akar/guides/composition) guide for more details. |
[SelectGroup.vue source](https://github.com/vinicunca/akar/blob/v2.0.20/packages/core/src/Select/SelectGroup.vue)
### Label
Used to render the label of a group. It won't be focusable using arrow keys.
**Props**
| Prop | Default | Type | Description |
| --- | --- | --- | --- |
| `as` | `"div"` | `AsTag \| Component` | The element or component this component should render as. Can be overwritten by `asChild`. |
| `asChild` | | `boolean` | Change the default rendered element for the one passed as a child, merging their props and behavior.
Read our [Composition](https://vinicunca.dev/akar/guides/composition) guide for more details. |
| `for` | | `string` | |
[SelectLabel.vue source](https://github.com/vinicunca/akar/blob/v2.0.20/packages/core/src/Select/SelectLabel.vue)
### Separator
Used to visually separate items in the Select
**Props**
| Prop | Default | Type | Description |
| --- | --- | --- | --- |
| `as` | `"div"` | `AsTag \| Component` | The element or component this component should render as. Can be overwritten by `asChild`. |
| `asChild` | | `boolean` | Change the default rendered element for the one passed as a child, merging their props and behavior.
Read our [Composition](https://vinicunca.dev/akar/guides/composition) guide for more details. |
[SelectSeparator.vue source](https://github.com/vinicunca/akar/blob/v2.0.20/packages/core/src/Select/SelectSeparator.vue)
### Arrow
An optional arrow element to render alongside the content. This can be used to help visually link the trigger with the `SelectContent`. Must be rendered inside `SelectContent`. Only available when `position` is set to `popper`.
**Props**
| Prop | Default | Type | Description |
| --- | --- | --- | --- |
| `as` | `"svg"` | `AsTag \| Component` | The element or component this component should render as. Can be overwritten by `asChild`. |
| `asChild` | | `boolean` | Change the default rendered element for the one passed as a child, merging their props and behavior.
Read our [Composition](https://vinicunca.dev/akar/guides/composition) guide for more details. |
| `height` | `5` | `number` | The height of the arrow in pixels. |
| `rounded` | `false` | `boolean` | When `true`, render the rounded version of arrow. Do not work with `as`/`asChild` |
| `width` | `10` | `number` | The width of the arrow in pixels. |
[SelectArrow.vue source](https://github.com/vinicunca/akar/blob/v2.0.20/packages/core/src/Select/SelectArrow.vue)
## Examples
### Change the positioning mode
By default, `Select` will behave similarly to a native MacOS menu by positioning `SelectContent` relative to the active item. If you would prefer an alternative positioning approach similar to `Popover` or `DropdownMenu` then you can set `position` to `popper` and make use of additional alignment options such as `side`, `sideOffset` and more.
```vue
// index.vue
Adolfo Hess
Read our [Composition](https://vinicunca.dev/akar/guides/composition) guide for more details. |
| `decorative` | | `boolean` | Whether or not the component is purely decorative.
When `true`, accessibility-related attributes
are updated so that that the rendered element is removed from the accessibility tree. |
| `orientation` | `"horizontal"` | `"vertical" \| "horizontal"` | Orientation of the component.
Either `vertical` or `horizontal`. Defaults to `horizontal`. |
[Separator.vue source](https://github.com/vinicunca/akar/blob/v2.0.20/packages/core/src/Separator/Separator.vue)
| Data attribute | Value |
| --- | --- |
| `[data-orientation]` | "vertical" \\| "horizontal" |
## Accessibility
Adheres to the [`separator` role requirements](https://www.w3.org/TR/wai-aria-1.2/#separator).
---
- [ARIA](https://www.w3.org/TR/wai-aria-1.2/#separator)
- [GitHub](https://github.com/vinicunca/akar/blob/v2.0.20/packages/core/src/Separator)
- [npm](https://www.npmjs.com/package/akar)
# Slider
> An input where the user selects a value from within a given range.
```vue [index.vue]
Read our [Composition](https://vinicunca.dev/akar/guides/composition) guide for more details. |
| `defaultValue` | `[0]` | `number[]` | The value of the slider when initially rendered. Use when you do not need to control the state of the slider. |
| `dir` | | `"ltr" \| "rtl"` | The reading direction of the combobox when applicable.
If omitted, inherits globally from `ConfigProvider` or assumes LTR (left-to-right) reading mode. |
| `disabled` | `false` | `boolean` | When `true`, prevents the user from interacting with the slider. |
| `inverted` | `false` | `boolean` | Whether the slider is visually inverted. |
| `max` | `100` | `number` | The maximum value for the range. |
| `min` | `0` | `number` | The minimum value for the range. |
| `minStepsBetweenThumbs` | `0` | `number` | The minimum permitted steps between multiple thumbs. |
| `modelValue` | | `number[] \| null` | The controlled value of the slider. Can be bind as `v-model`. |
| `name` | | `string` | The name of the field. Submitted with its owning form as part of a name/value pair. |
| `orientation` | `"horizontal"` | `"vertical" \| "horizontal"` | The orientation of the slider. |
| `required` | | `boolean` | When `true`, indicates that the user must set the value before the owning form can be submitted. |
| `step` | `1` | `number` | The stepping interval. |
| `thumbAlignment` | `"contain"` | `"contain" \| "overflow"` | The alignment of the slider thumb.
- `contain`: thumbs will be contained within the bounds of the track.
- `overflow`: thumbs will not be bound by the track. No extra offset will be added. |
**Events**
| Event | Payload | Description |
| --- | --- | --- |
| `update:modelValue` | `payload: number[]` | Event handler called when the slider value changes |
| `valueCommit` | `payload: number[]` | Event handler called when the value changes at the end of an interaction.
Useful when you only need to capture a final value e.g. to update a backend service. |
**Slots**
| Slot | Payload | Description |
| --- | --- | --- |
| `modelValue` | `number[] \| null` | Current slider values |
[SliderRoot.vue source](https://github.com/vinicunca/akar/blob/v2.0.20/packages/core/src/Slider/SliderRoot.vue)
| Data attribute | Value |
| --- | --- |
| `[data-disabled]` | Present when disabled |
| `[data-orientation]` | "vertical" \\| "horizontal" |
### Track
The track that contains the `SliderRange`.
**Props**
| Prop | Default | Type | Description |
| --- | --- | --- | --- |
| `as` | `"span"` | `AsTag \| Component` | The element or component this component should render as. Can be overwritten by `asChild`. |
| `asChild` | | `boolean` | Change the default rendered element for the one passed as a child, merging their props and behavior.
Read our [Composition](https://vinicunca.dev/akar/guides/composition) guide for more details. |
[SliderTrack.vue source](https://github.com/vinicunca/akar/blob/v2.0.20/packages/core/src/Slider/SliderTrack.vue)
| Data attribute | Value |
| --- | --- |
| `[data-disabled]` | Present when disabled |
| `[data-orientation]` | "vertical" \\| "horizontal" |
### Range
The range part. Must live inside `SliderTrack`.
**Props**
| Prop | Default | Type | Description |
| --- | --- | --- | --- |
| `as` | `"span"` | `AsTag \| Component` | The element or component this component should render as. Can be overwritten by `asChild`. |
| `asChild` | | `boolean` | Change the default rendered element for the one passed as a child, merging their props and behavior.
Read our [Composition](https://vinicunca.dev/akar/guides/composition) guide for more details. |
[SliderRange.vue source](https://github.com/vinicunca/akar/blob/v2.0.20/packages/core/src/Slider/SliderRange.vue)
| Data attribute | Value |
| --- | --- |
| `[data-disabled]` | Present when disabled |
| `[data-orientation]` | "vertical" \\| "horizontal" |
### Thumb
A draggable thumb. You can render multiple thumbs.
**Props**
| Prop | Default | Type | Description |
| --- | --- | --- | --- |
| `as` | `"span"` | `AsTag \| Component` | The element or component this component should render as. Can be overwritten by `asChild`. |
| `asChild` | | `boolean` | Change the default rendered element for the one passed as a child, merging their props and behavior.
Read our [Composition](https://vinicunca.dev/akar/guides/composition) guide for more details. |
[SliderThumb.vue source](https://github.com/vinicunca/akar/blob/v2.0.20/packages/core/src/Slider/SliderThumb.vue)
| Data attribute | Value |
| --- | --- |
| `[data-disabled]` | Present when disabled |
| `[data-orientation]` | "vertical" \\| "horizontal" |
## Examples
### Vertical orientation
Use the `orientation` prop to create a vertical slider.
```vue
// index.vue
Read our [Composition](https://vinicunca.dev/akar/guides/composition) guide for more details. |
| `autoSaveId` | `null` | `string \| null` | Unique id used to auto-save group arrangement via `localStorage`. |
| `direction*` | | `"vertical" \| "horizontal"` | The group orientation of splitter. |
| `id` | | `string \| null` | Group id; falls back to `useId` when not provided. |
| `keyboardResizeBy` | `10` | `number \| null` | Step size when arrow key was pressed. |
| `storage` | `defaultStorage` | `PanelGroupStorage` | Custom storage API; defaults to localStorage |
**Events**
| Event | Payload | Description |
| --- | --- | --- |
| `layout` | `val: number[]` | Event handler called when group layout changes |
**Slots**
| Slot | Payload | Description |
| --- | --- | --- |
| `layout` | `number[]` | Current size of layout |
[SplitterGroup.vue source](https://github.com/vinicunca/akar/blob/v2.0.20/packages/core/src/Splitter/SplitterGroup.vue)
| Data attribute | Value |
| --- | --- |
| `[data-orientation]` | "vertical" \\| "horizontal" |
| `[data-state]` | "collapsed" \\| "expanded" \\| "Present when collapsbile" |
### Panel
A collapsible section.
**Props**
| Prop | Default | Type | Description |
| --- | --- | --- | --- |
| `as` | `"div"` | `AsTag \| Component` | The element or component this component should render as. Can be overwritten by `asChild`. |
| `asChild` | | `boolean` | Change the default rendered element for the one passed as a child, merging their props and behavior.
Read our [Composition](https://vinicunca.dev/akar/guides/composition) guide for more details. |
| `collapsedSize` | | `number` | The size of panel when it is collapsed; interpreted using `sizeUnit`. |
| `collapsible` | | `boolean` | Should panel collapse when resized beyond its `minSize`. When `true`, it will be collapsed to `collapsedSize`. |
| `defaultSize` | | `number` | Initial size of panel, interpreted using `sizeUnit` (percent by default). |
| `id` | | `string` | Panel id (unique within group); falls back to `useId` when not provided |
| `maxSize` | | `number` | The maximum allowable size of panel, interpreted using `sizeUnit`; defaults to `100` (percent). |
| `minSize` | | `number` | The minimum allowable size of panel, interpreted using `sizeUnit`; defaults to `10` (percent). |
| `order` | | `number` | The order of panel within group; required for groups with conditionally rendered panels |
| `sizeUnit` | | `"%" \| "px"` | Unit used for sizing values; `%` by default, or `px` for fixed sizing. |
**Events**
| Event | Payload | Description |
| --- | --- | --- |
| `collapse` | | Event handler called when panel is collapsed. |
| `expand` | | Event handler called when panel is expanded. |
| `resize` | `size: number, prevSize: number` | Event handler called when panel is resized; size parameter is a numeric value between 1-100. |
**Slots**
| Slot | Payload | Description |
| --- | --- | --- |
| `isCollapsed` | `boolean` | Is the panel collapsed |
| `isExpanded` | `boolean` | Is the panel expanded |
| `collapse` | `(): void` | If panel is `collapsible`, collapse it fully. |
| `expand` | `(): void` | If panel is currently collapsed, expand it to its most recent size. |
| `resize` | `(size: number): void` | Resize panel to the specified percentage (1 - 100). |
**Methods**
| Method | Type | Description |
| --- | --- | --- |
| `collapse` | `() => void` | If panel is `collapsible`, collapse it fully. |
| `expand` | `() => void` | If panel is currently collapsed, expand it to its most recent size. |
| `getSize` | `() => number` | Gets the current size of the panel (in the panel's sizeUnit: percentage for '%', pixels for 'px'). |
| `resize` | `(size: number) => void` | Resize panel to the specified size (in the panel's sizeUnit: percentage for '%', pixels for 'px'). |
[SplitterPanel.vue source](https://github.com/vinicunca/akar/blob/v2.0.20/packages/core/src/Splitter/SplitterPanel.vue)
### Resize Handle
Handle that use for resizing.
**Props**
| Prop | Default | Type | Description |
| --- | --- | --- | --- |
| `as` | `"div"` | `AsTag \| Component` | The element or component this component should render as. Can be overwritten by `asChild`. |
| `asChild` | | `boolean` | Change the default rendered element for the one passed as a child, merging their props and behavior.
Read our [Composition](https://vinicunca.dev/akar/guides/composition) guide for more details. |
| `disabled` | | `boolean` | Disable drag handle |
| `hitAreaMargins` | | `PointerHitAreaMargins` | Allow this much margin when determining resizable handle hit detection |
| `id` | | `string` | Resize handle id (unique within group); falls back to `useId` when not provided |
| `nonce` | | `string` | Will add `nonce` attribute to the style tag which can be used by Content Security Policy.
If omitted, inherits globally from `ConfigProvider`. |
| `tabindex` | `0` | `number` | Tabindex for the handle |
**Events**
| Event | Payload | Description |
| --- | --- | --- |
| `dragging` | `isDragging: boolean` | Event handler called when dragging the handler. |
[SplitterResizeHandle.vue source](https://github.com/vinicunca/akar/blob/v2.0.20/packages/core/src/Splitter/SplitterResizeHandle.vue)
| Data attribute | Value |
| --- | --- |
| `[data-state]` | "drag" \\| "hover" \\| "inactive" |
| `[data-disabled]` | Present when disabled |
| `[data-orientation]` | "vertical" \\| "horizontal" |
## Examples
### Collapsible
Use the `collapsible` prop to allow the panel to collapse into `collapsedSize` when `minSize` is reached.
(`collapsedSize` and `minSize` props are required.)
```vue
Read our [Composition](https://vinicunca.dev/akar/guides/composition) guide for more details. |
| `defaultValue` | `1` | `number` | The value of the step that should be active when initially rendered. Use when you do not need to control the state of the steps. |
| `dir` | | `"ltr" \| "rtl"` | The reading direction of the combobox when applicable.
If omitted, inherits globally from `ConfigProvider` or assumes LTR (left-to-right) reading mode. |
| `linear` | `true` | `boolean` | Whether or not the steps must be completed in order. |
| `modelValue` | | `number` | The controlled value of the step to activate. Can be bound as `v-model`. |
| `orientation` | `"horizontal"` | `"vertical" \| "horizontal"` | The orientation the steps are laid out.
Mainly so arrow navigation is done accordingly (left & right vs. up & down). |
**Events**
| Event | Payload | Description |
| --- | --- | --- |
| `update:modelValue` | `payload: number` | Event handler called when the value changes |
**Slots**
| Slot | Payload | Description |
| --- | --- | --- |
| `modelValue` | `number` | Current step |
| `totalSteps` | `number` | Total number of steps |
| `isNextDisabled` | `boolean` | Whether or not the next step is disabled |
| `isPrevDisabled` | `boolean` | Whether or not the previous step is disabled |
| `isFirstStep` | `boolean` | Whether or not the first step is active |
| `isLastStep` | `boolean` | Whether or not the last step is active |
| `goToStep` | `(step: number): void` | Go to a specific step |
| `nextStep` | `(): void` | Go to the next step |
| `prevStep` | `(): void` | Go to the previous step |
| `hasNext` | `(): boolean` | Whether or not there is a next step |
| `hasPrev` | `(): boolean` | Whether or not there is a previous step |
**Methods**
| Method | Type | Description |
| --- | --- | --- |
| `goToStep` | `(step: number) => void` | |
| `nextStep` | `() => void` | |
| `prevStep` | `() => void` | |
| `hasNext` | `() => boolean` | |
| `hasPrev` | `() => boolean` | |
[StepperRoot.vue source](https://github.com/vinicunca/akar/blob/v2.0.20/packages/core/src/Stepper/StepperRoot.vue)
| Data attribute | Value |
| --- | --- |
| `[data-orientation]` | "vertical" \\| "horizontal" |
| `[data-linear]` | Present when linear |
### Item
The step item component.
**Props**
| Prop | Default | Type | Description |
| --- | --- | --- | --- |
| `as` | `"div"` | `AsTag \| Component` | The element or component this component should render as. Can be overwritten by `asChild`. |
| `asChild` | | `boolean` | Change the default rendered element for the one passed as a child, merging their props and behavior.
Read our [Composition](https://vinicunca.dev/akar/guides/composition) guide for more details. |
| `completed` | `false` | `boolean` | Shows whether the step is completed. |
| `disabled` | `false` | `boolean` | When `true`, prevents the user from interacting with the step. |
| `step*` | | `number` | A unique value that associates the stepper item with an index |
**Slots**
| Slot | Payload | Description |
| --- | --- | --- |
| `state` | `"active" \| "completed" \| "inactive"` | The current state of the stepper item |
[StepperItem.vue source](https://github.com/vinicunca/akar/blob/v2.0.20/packages/core/src/Stepper/StepperItem.vue)
| Data attribute | Value |
| --- | --- |
| `[data-state]` | "active" \\| "inactive" \\| "completed" |
| `[data-disabled]` | Present when disabled |
| `[data-orientation]` | "vertical" \\| "horizontal" |
### Trigger
The trigger that toggles the step.
**Props**
| Prop | Default | Type | Description |
| --- | --- | --- | --- |
| `as` | `"button"` | `AsTag \| Component` | The element or component this component should render as. Can be overwritten by `asChild`. |
| `asChild` | | `boolean` | Change the default rendered element for the one passed as a child, merging their props and behavior.
Read our [Composition](https://vinicunca.dev/akar/guides/composition) guide for more details. |
[StepperTrigger.vue source](https://github.com/vinicunca/akar/blob/v2.0.20/packages/core/src/Stepper/StepperTrigger.vue)
| Data attribute | Value |
| --- | --- |
| `[data-state]` | "active" \\| "inactive" \\| "completed" |
| `[data-disabled]` | Present when disabled |
| `[data-orientation]` | "vertical" \\| "horizontal" |
### Indicator
The indicator for the step.
**Props**
| Prop | Default | Type | Description |
| --- | --- | --- | --- |
| `as` | `"span"` | `AsTag \| Component` | The element or component this component should render as. Can be overwritten by `asChild`. |
| `asChild` | | `boolean` | Change the default rendered element for the one passed as a child, merging their props and behavior.
Read our [Composition](https://vinicunca.dev/akar/guides/composition) guide for more details. |
**Slots**
| Slot | Payload | Description |
| --- | --- | --- |
| `step` | `number` | Current step |
[StepperIndicator.vue source](https://github.com/vinicunca/akar/blob/v2.0.20/packages/core/src/Stepper/StepperIndicator.vue)
### Title
An accessible title to be announced when the stepper trigger is focused.
If you want to hide the title, wrap it inside our Visually Hidden utility like this `
Read our [Composition](https://vinicunca.dev/akar/guides/composition) guide for more details. |
[StepperTitle.vue source](https://github.com/vinicunca/akar/blob/v2.0.20/packages/core/src/Stepper/StepperTitle.vue)
### Description
An optional accessible description to be announced when the stepper trigger is focused.
If you want to hide the description, wrap it inside our Visually Hidden utility like this `
Read our [Composition](https://vinicunca.dev/akar/guides/composition) guide for more details. |
| `completed` | `false` | `boolean` | Shows whether the step is completed. |
| `disabled` | `false` | `boolean` | When `true`, prevents the user from interacting with the step. |
| `step*` | | `number` | A unique value that associates the stepper item with an index |
**Slots**
| Slot | Payload | Description |
| --- | --- | --- |
| `state` | `"active" \| "completed" \| "inactive"` | The current state of the stepper item |
[StepperItem.vue source](https://github.com/vinicunca/akar/blob/v2.0.20/packages/core/src/Stepper/StepperItem.vue)
## Examples
### Vertical
You can create vertical steps by using the `orientation` prop.
```vue
Read our [Composition](https://vinicunca.dev/akar/guides/composition) guide for more details. |
| `defaultValue` | | `T` | The state of the switch when it is initially rendered. Use when you do not need to control its state. |
| `disabled` | | `boolean` | When `true`, prevents the user from interacting with the switch. |
| `falseValue` | `(() => false) as unknown as undefined` | `T` | The value used when the switch is off. Defaults to `false`. |
| `id` | | `string` | |
| `modelValue` | | `null \| T` | The controlled state of the switch. Can be bind as `v-model`. |
| `name` | | `string` | The name of the field. Submitted with its owning form as part of a name/value pair. |
| `required` | | `boolean` | When `true`, indicates that the user must set the value before the owning form can be submitted. |
| `trueValue` | `(() => true) as unknown as undefined` | `T` | The value used when the switch is on. Defaults to `true`. |
| `value` | `"on"` | `string` | The value given as data when submitted with a `name`. |
**Events**
| Event | Payload | Description |
| --- | --- | --- |
| `update:modelValue` | `payload: T` | Event handler called when the value of the switch changes. |
**Slots**
| Slot | Payload | Description |
| --- | --- | --- |
| `modelValue` | `T` | Current value |
| `checked` | `boolean` | Whether the switch is checked |
[SwitchRoot.vue source](https://github.com/vinicunca/akar/blob/v2.0.20/packages/core/src/Switch/SwitchRoot.vue)
| Data attribute | Value |
| --- | --- |
| `[data-state]` | "checked" \\| "unchecked" |
| `[data-disabled]` | Present when disabled |
### Thumb
The thumb that is used to visually indicate whether the switch is on or off.
**Props**
| Prop | Default | Type | Description |
| --- | --- | --- | --- |
| `as` | `"span"` | `AsTag \| Component` | The element or component this component should render as. Can be overwritten by `asChild`. |
| `asChild` | | `boolean` | Change the default rendered element for the one passed as a child, merging their props and behavior.
Read our [Composition](https://vinicunca.dev/akar/guides/composition) guide for more details. |
[SwitchThumb.vue source](https://github.com/vinicunca/akar/blob/v2.0.20/packages/core/src/Switch/SwitchThumb.vue)
| Data attribute | Value |
| --- | --- |
| `[data-state]` | "checked" \\| "unchecked" |
| `[data-disabled]` | Present when disabled |
## Examples
### Custom Values
Use the `trueValue` and `falseValue` props to specify custom values for the on and off states instead of the default `true`/`false`.
```vue
Read our [Composition](https://vinicunca.dev/akar/guides/composition) guide for more details. |
| `defaultValue` | | `T` | The value of the tab that should be active when initially rendered. Use when you do not need to control the state of the tabs |
| `dir` | | `"ltr" \| "rtl"` | The reading direction of the combobox when applicable.
If omitted, inherits globally from `ConfigProvider` or assumes LTR (left-to-right) reading mode. |
| `modelValue` | | `T` | The controlled value of the tab to activate. Can be bind as `v-model`. |
| `orientation` | `"horizontal"` | `"vertical" \| "horizontal"` | The orientation the tabs are laid out.
Mainly so arrow navigation is done accordingly (left & right vs. up & down) |
| `unmountOnHide` | `true` | `boolean` | When `true`, the element will be unmounted on closed state. |
**Events**
| Event | Payload | Description |
| --- | --- | --- |
| `update:modelValue` | `payload: T` | Event handler called when the value changes |
**Slots**
| Slot | Payload | Description |
| --- | --- | --- |
| `modelValue` | `T` | Current input values |
[TabsRoot.vue source](https://github.com/vinicunca/akar/blob/v2.0.20/packages/core/src/Tabs/TabsRoot.vue)
| Data attribute | Value |
| --- | --- |
| `[data-orientation]` | "vertical" \\| "horizontal" |
### List
Contains the triggers that are aligned along the edge of the active content.
**Props**
| Prop | Default | Type | Description |
| --- | --- | --- | --- |
| `as` | `"div"` | `AsTag \| Component` | The element or component this component should render as. Can be overwritten by `asChild`. |
| `asChild` | | `boolean` | Change the default rendered element for the one passed as a child, merging their props and behavior.
Read our [Composition](https://vinicunca.dev/akar/guides/composition) guide for more details. |
| `loop` | `true` | `boolean` | When `true`, keyboard navigation will loop from last tab to first, and vice versa. |
[TabsList.vue source](https://github.com/vinicunca/akar/blob/v2.0.20/packages/core/src/Tabs/TabsList.vue)
| Data attribute | Value |
| --- | --- |
| `[data-orientation]` | "vertical" \\| "horizontal" |
### Trigger
The button that activates its associated content.
**Props**
| Prop | Default | Type | Description |
| --- | --- | --- | --- |
| `as` | `"button"` | `AsTag \| Component` | The element or component this component should render as. Can be overwritten by `asChild`. |
| `asChild` | | `boolean` | Change the default rendered element for the one passed as a child, merging their props and behavior.
Read our [Composition](https://vinicunca.dev/akar/guides/composition) guide for more details. |
| `disabled` | `false` | `boolean` | When `true`, prevents the user from interacting with the tab. |
| `value*` | | `string \| number` | A unique value that associates the trigger with a content. |
[TabsTrigger.vue source](https://github.com/vinicunca/akar/blob/v2.0.20/packages/core/src/Tabs/TabsTrigger.vue)
| Data attribute | Value |
| --- | --- |
| `[data-state]` | "active" \\| "inactive" |
| `[data-disabled]` | Present when disabled |
| `[data-orientation]` | "vertical" \\| "horizontal" |
### Indicator
The indicator that highlights the current active tab.
**Props**
| Prop | Default | Type | Description |
| --- | --- | --- | --- |
| `as` | `"div"` | `AsTag \| Component` | The element or component this component should render as. Can be overwritten by `asChild`. |
| `asChild` | | `boolean` | Change the default rendered element for the one passed as a child, merging their props and behavior.
Read our [Composition](https://vinicunca.dev/akar/guides/composition) guide for more details. |
**Methods**
| Method | Type | Description |
| --- | --- | --- |
| `updateIndicatorStyle` | `() => void` | |
[TabsIndicator.vue source](https://github.com/vinicunca/akar/blob/v2.0.20/packages/core/src/Tabs/TabsIndicator.vue)
| CSS variable | Description |
| --- | --- |
| `--akar-tabs-indicator-size` | The size of the indicator. |
| `--akar-tabs-indicator-thickness` | The thickness of the indicator. |
| `--akar-tabs-indicator-position` | The position of the indicator |
### Content
Contains the content associated with each trigger.
> [!NOTE]
>
> Defer mounting with `forceMount` / [`Presence`](https://vinicunca.dev/akar/utilities/presence). See the [animation guide](https://vinicunca.dev/akar/guides/animation).
**Props**
| Prop | Default | Type | Description |
| --- | --- | --- | --- |
| `as` | `"div"` | `AsTag \| Component` | The element or component this component should render as. Can be overwritten by `asChild`. |
| `asChild` | | `boolean` | Change the default rendered element for the one passed as a child, merging their props and behavior.
Read our [Composition](https://vinicunca.dev/akar/guides/composition) guide for more details. |
| `forceMount` | | `boolean` | Used to force mounting when more control is needed. Useful when
controlling animation with Vue animation libraries. |
| `value*` | | `string \| number` | A unique value that associates the content with a trigger. |
[TabsContent.vue source](https://github.com/vinicunca/akar/blob/v2.0.20/packages/core/src/Tabs/TabsContent.vue)
| Data attribute | Value |
| --- | --- |
| `[data-state]` | "active" \\| "inactive" |
| `[data-orientation]` | "vertical" \\| "horizontal" |
## Examples
### Vertical
You can create vertical tabs by using the `orientation` prop.
```vue
Read our [Composition](/akar/guides/composition) guide for more details. |
| `by` | | `string \| ((a: T, b: T) => boolean)` | Use this to compare objects by a particular field, or pass your own comparison function for complete control over how objects are compared. |
| `defaultValue` | | `T \| T[]` | The value of the selected tag(s) when initially rendered. Use when you do not need to control the selection. |
| `dir` | | `"ltr" \| "rtl"` | The reading direction of the tag group when applicable.
If omitted, inherits globally from `ConfigProvider` or assumes LTR (left-to-right) reading mode. |
| `disabled` | | `boolean` | When `true`, prevents the user from interacting with the tag group and all its tags. |
| `disallowEmptySelection` | | `boolean` | When `true`, the user cannot deselect the last selected tag. |
| `escapeKeyBehavior` | `"clearSelection"` | `"none" \| "clearSelection"` | Whether pressing Escape clears the selection. |
| `loop` | `true` | `boolean` | When `true`, keyboard navigation will loop from last tag to first, and vice versa. |
| `modelValue` | | `T \| T[]` | The controlled value of the selected tag(s). Can be binded with `v-model`. An array when `selectionMode` is `multiple`. |
| `selectionMode` | `"none"` | `"single" \| "multiple" \| "none"` | The type of selection that is allowed. Tags are not selectable when `none`. |
**Events**
| Event | Payload | Description |
| --- | --- | --- |
| `remove` | `values: T[]` | Event handler called when the user removes tags, with the values to remove.
Tags are only removable when this event has a listener; remove the values from your own list to remove the tags. |
| `update:modelValue` | `value: T \| T[]` | Event handler called when the selection changes. |
**Slots**
| Slot | Payload | Description |
| --- | --- | --- |
| `modelValue` | `T \| T[]` | Current selected value(s) |
[TagGroupRoot.vue source](https://github.com/vinicunca/akar/blob/v2.0.20/packages/core/src/TagGroup/TagGroupRoot.vue)
| Data attribute | Value |
| --- | --- |
| `[data-disabled]` | Present when disabled |
| `[data-empty]` | Present when there are no tags |
### Item
A tag. Pressing `Delete` or `Backspace` on it removes it.
**Props**
| Prop | Default | Type | Description |
| --- | --- | --- | --- |
| `as` | `"div"` | `AsTag \| Component` | The element or component this component should render as. Can be overwritten by `asChild`. |
| `asChild` | | `boolean` | Change the default rendered element for the one passed as a child, merging their props and behavior.
Read our [Composition](/akar/guides/composition) guide for more details. |
| `disabled` | | `boolean` | When `true`, prevents the user from interacting with the tag. |
| `textValue` | | `string` | A string representation of the tag's contents, used for typeahead and as the tag's accessible name. Defaults to the text of `TagGroupItemText`. |
| `value*` | | `T` | The unique value of the tag. |
**Slots**
| Slot | Payload | Description |
| --- | --- | --- |
| `selected` | `boolean` | Whether the tag is selected |
| `disabled` | `boolean` | Whether the tag is disabled |
[TagGroupItem.vue source](https://github.com/vinicunca/akar/blob/v2.0.20/packages/core/src/TagGroup/TagGroupItem.vue)
| Data attribute | Value |
| --- | --- |
| `[data-state]` | "checked" \\| "unchecked" |
| `[data-disabled]` | Present when disabled |
### ItemText
The text of the tag. Used for typeahead unless the item has a `textValue`.
**Props**
| Prop | Default | Type | Description |
| --- | --- | --- | --- |
| `as` | `"span"` | `AsTag \| Component` | The element or component this component should render as. Can be overwritten by `asChild`. |
| `asChild` | | `boolean` | Change the default rendered element for the one passed as a child, merging their props and behavior.
Read our [Composition](/akar/guides/composition) guide for more details. |
[TagGroupItemText.vue source](https://github.com/vinicunca/akar/blob/v2.0.20/packages/core/src/TagGroup/TagGroupItemText.vue)
### ItemDelete
The button that removes its tag. It is labelled "Remove" followed by the tag's name; pass an `aria-label` to translate it.
**Props**
| Prop | Default | Type | Description |
| --- | --- | --- | --- |
| `as` | `"button"` | `AsTag \| Component` | The element or component this component should render as. Can be overwritten by `asChild`. |
| `asChild` | | `boolean` | Change the default rendered element for the one passed as a child, merging their props and behavior.
Read our [Composition](/akar/guides/composition) guide for more details. |
| `disabled` | | `boolean` | When `true`, prevents the user from interacting with the delete button. |
[TagGroupItemDelete.vue source](https://github.com/vinicunca/akar/blob/v2.0.20/packages/core/src/TagGroup/TagGroupItemDelete.vue)
| Data attribute | Value |
| --- | --- |
| `[data-disabled]` | Present when disabled |
## Examples
### Removing tags
Tags are removable when you listen to the `remove` event. It receives the values to remove, which you remove from your own list. Removing a selected tag with the keyboard removes every selected tag.
```vue
Read our [Composition](https://vinicunca.dev/akar/guides/composition) guide for more details. |
| `convertValue` | | `((value: string) => T)` | Convert the input value to the desired type. Mandatory when using objects as values and using `TagsInputInput` |
| `defaultValue` | `[]` | `T[]` | The value of the tags that should be added. Use when you do not need to control the state of the tags input |
| `delimiter` | `","` | `string \| RegExp` | The character or regular expression to trigger the addition of a new tag. Also used to split tags for `@paste` event |
| `dir` | | `"ltr" \| "rtl"` | The reading direction of the combobox when applicable.
If omitted, inherits globally from `ConfigProvider` or assumes LTR (left-to-right) reading mode. |
| `disabled` | | `boolean` | When `true`, prevents the user from interacting with the tags input. |
| `displayValue` | `value.toString()` | `((value: T) => string)` | Display the value of the tag. Useful when you want to apply modifications to the value like adding a suffix or when using object as values |
| `duplicate` | | `boolean` | When `true`, allow duplicated tags. |
| `id` | | `string` | |
| `max` | `0` | `number` | Maximum number of tags. |
| `modelValue` | | `T[] \| null` | The controlled value of the tags input. Can be bind as `v-model`. |
| `name` | | `string` | The name of the field. Submitted with its owning form as part of a name/value pair. |
| `required` | | `boolean` | When `true`, indicates that the user must set the value before the owning form can be submitted. |
**Events**
| Event | Payload | Description |
| --- | --- | --- |
| `addTag` | `payload: T` | Event handler called when tag is added |
| `invalid` | `payload: T` | Event handler called when the value is invalid |
| `removeTag` | `payload: T` | Event handler called when tag is removed |
| `update:modelValue` | `payload: T[]` | Event handler called when the value changes |
**Slots**
| Slot | Payload | Description |
| --- | --- | --- |
| `modelValue` | `string \| number \| bigint \| Record
Read our [Composition](https://vinicunca.dev/akar/guides/composition) guide for more details. |
| `disabled` | | `boolean` | When `true`, prevents the user from interacting with the tags input. |
| `value*` | | `string \| number \| bigint \| Record
Read our [Composition](https://vinicunca.dev/akar/guides/composition) guide for more details. |
[TagsInputItemText.vue source](https://github.com/vinicunca/akar/blob/v2.0.20/packages/core/src/TagsInput/TagsInputItemText.vue)
### ItemDelete
The button that delete the associate tag.
**Props**
| Prop | Default | Type | Description |
| --- | --- | --- | --- |
| `as` | `"button"` | `AsTag \| Component` | The element or component this component should render as. Can be overwritten by `asChild`. |
| `asChild` | | `boolean` | Change the default rendered element for the one passed as a child, merging their props and behavior.
Read our [Composition](https://vinicunca.dev/akar/guides/composition) guide for more details. |
[TagsInputItemDelete.vue source](https://github.com/vinicunca/akar/blob/v2.0.20/packages/core/src/TagsInput/TagsInputItemDelete.vue)
| Data attribute | Value |
| --- | --- |
| `[data-state]` | "active" \\| "inactive" |
| `[data-disabled]` | Present when disabled |
### Input
The input element for the tags input.
**Props**
| Prop | Default | Type | Description |
| --- | --- | --- | --- |
| `as` | `"input"` | `AsTag \| Component` | The element or component this component should render as. Can be overwritten by `asChild`. |
| `asChild` | | `boolean` | Change the default rendered element for the one passed as a child, merging their props and behavior.
Read our [Composition](https://vinicunca.dev/akar/guides/composition) guide for more details. |
| `autoFocus` | | `boolean` | Focus on element when mounted. |
| `maxLength` | | `number` | Maximum number of character allowed. |
| `placeholder` | | `string` | The placeholder character to use for empty tags input. |
[TagsInputInput.vue source](https://github.com/vinicunca/akar/blob/v2.0.20/packages/core/src/TagsInput/TagsInputInput.vue)
| Data attribute | Value |
| --- | --- |
| `[data-invalid]` | Present when input value is invalid |
### Clear
The button that remove all tags.
**Props**
| Prop | Default | Type | Description |
| --- | --- | --- | --- |
| `as` | `"button"` | `AsTag \| Component` | The element or component this component should render as. Can be overwritten by `asChild`. |
| `asChild` | | `boolean` | Change the default rendered element for the one passed as a child, merging their props and behavior.
Read our [Composition](https://vinicunca.dev/akar/guides/composition) guide for more details. |
[TagsInputClear.vue source](https://github.com/vinicunca/akar/blob/v2.0.20/packages/core/src/TagsInput/TagsInputClear.vue)
| Data attribute | Value |
| --- | --- |
| `[data-disabled]` | Present when disabled |
## Examples
### Paste behavior
You can automatically add tags on paste by passing the `add-on-paste` prop.
```vue
Read our [Composition](/akar/guides/composition) guide for more details. |
| `defaultPlaceholder` | | `TimeValue` | The default placeholder date |
| `defaultValue` | | `TimeValue` | The default value for the calendar |
| `dir` | | `"ltr" \| "rtl"` | The reading direction of the time field when applicable.
If omitted, inherits globally from `ConfigProvider` or assumes LTR (left-to-right) reading mode. |
| `disabled` | `false` | `boolean` | Whether or not the time field is disabled |
| `granularity` | | `"hour" \| "minute" \| "second"` | The granularity to use for formatting times. Defaults to minute if a Time is provided, otherwise defaults to minute. The field will render segments for each part of the date up to and including the specified granularity |
| `hideTimeZone` | | `boolean` | Whether or not to hide the time zone segment of the field |
| `hourCycle` | | `12 \| 24` | The hour cycle used for formatting times. Defaults to the local preference |
| `id` | | `string` | Id of the element |
| `locale` | | `string` | The locale to use for formatting dates |
| `maxValue` | | `TimeValue` | The maximum date that can be selected |
| `minValue` | | `TimeValue` | The minimum date that can be selected |
| `modelValue` | | `TimeValue \| null` | The controlled checked state of the field. Can be bound as `v-model`. |
| `name` | | `string` | The name of the field. Submitted with its owning form as part of a name/value pair. |
| `placeholder` | | `TimeValue` | The placeholder date, which is used to determine what time to display when no time is selected. This updates as the user navigates the field |
| `readonly` | `false` | `boolean` | Whether or not the time field is readonly |
| `required` | | `boolean` | When `true`, indicates that the user must set the value before the owning form can be submitted. |
| `step` | | `DateStep` | The stepping interval for the time fields. Defaults to `1`. |
| `stepSnapping` | `false` | `boolean` | Whether to enforce snapping the value to the nearest step increment after input. Defaults to `false`. |
**Events**
| Event | Payload | Description |
| --- | --- | --- |
| `update:modelValue` | `date: TimeValue` | Event handler called whenever the model value changes |
| `update:placeholder` | `date: TimeValue` | Event handler called whenever the placeholder value changes |
**Slots**
| Slot | Payload | Description |
| --- | --- | --- |
| `modelValue` | `TimeValue` | The current time of the field |
| `segments` | `{ part: SegmentPart; value: string; }[]` | The time field segment contents |
| `isInvalid` | `boolean` | Value if the input is invalid |
**Methods**
| Method | Type | Description |
| --- | --- | --- |
| `setFocusedElement` | `(el: HTMLElement) => void` | Helper to set the focused element inside the DateField |
[TimeFieldRoot.vue source](https://github.com/vinicunca/akar/blob/v2.0.20/packages/core/src/TimeField/TimeFieldRoot.vue)
| Data attribute | Value |
| --- | --- |
| `[data-readonly]` | Present when readonly |
| `[data-disabled]` | Present when disabled |
| `[data-invalid]` | Present when invalid |
### Input
Contains the time field segments
**Props**
| Prop | Default | Type | Description |
| --- | --- | --- | --- |
| `as` | `"div"` | `AsTag \| Component` | The element or component this component should render as. Can be overwritten by `asChild`. |
| `asChild` | | `boolean` | Change the default rendered element for the one passed as a child, merging their props and behavior.
Read our [Composition](/akar/guides/composition) guide for more details. |
| `part*` | | `"day" \| "month" \| "year" \| "hour" \| "minute" \| "second" \| "dayPeriod" \| "literal" \| "timeZoneName"` | The part of the date to render |
[TimeFieldInput.vue source](https://github.com/vinicunca/akar/blob/v2.0.20/packages/core/src/TimeField/TimeFieldInput.vue)
| Data attribute | Value |
| --- | --- |
| `[data-disabled]` | Present when disabled |
| `[data-invalid]` | Present when invalid |
| `[data-placeholder]` | Present when no value is set |
## Accessibility
### Keyboard Interactions
| Key | Description |
| --- | --- |
| Tab | When focus moves onto the time field, focuses the first segment. |
| ArrowLeft / ArrowRight | Navigates between the time field segments. |
| ArrowUp / ArrowDown | Increments/changes the value of the segment. |
| 0-9 | When the focus is on a numeric `TimeFieldInput`, it types in the number and focuses the next segment if the next input would result in an invalid value. |
| Backspace | Deletes a digit from the focused numeric segments. |
| A / P | When the focus is on the day period, it sets it to AM or PM. |
---
- [GitHub](https://github.com/vinicunca/akar/blob/v2.0.20/packages/core/src/TimeField)
- [npm](https://www.npmjs.com/package/akar)
# Time Range Field
> Allows users to input a range of times within a designated field.
`````vue [index.vue]
Read our [Composition](/akar/guides/composition) guide for more details. |
| `defaultPlaceholder` | | `TimeValue` | The default placeholder time |
| `defaultValue` | | `TimeRange` | The default value for the field |
| `dir` | | `"ltr" \| "rtl"` | The reading direction of the time field when applicable.
If omitted, inherits globally from `ConfigProvider` or assumes LTR (left-to-right) reading mode. |
| `disabled` | `false` | `boolean` | Whether or not the time field is disabled |
| `granularity` | | `"hour" \| "minute" \| "second"` | The granularity to use for formatting times. Defaults to minute. The field will render segments for each part of the time up to and including the specified granularity |
| `hideTimeZone` | | `boolean` | Whether or not to hide the time zone segment of the field |
| `hourCycle` | | `12 \| 24` | The hour cycle used for formatting times. Defaults to the local preference |
| `id` | | `string` | Id of the element |
| `isTimeUnavailable` | | `Matcher` | A function that returns whether or not a time is unavailable |
| `locale` | | `string` | The locale to use for formatting times |
| `maxValue` | | `TimeValue` | The maximum time that can be selected |
| `minValue` | | `TimeValue` | The minimum time that can be selected |
| `modelValue` | | `TimeRange \| null` | The controlled checked state of the field. Can be bound as `v-model`. |
| `name` | | `string` | The name of the field. Submitted with its owning form as part of a name/value pair. |
| `placeholder` | | `TimeValue` | The placeholder time, which is used to determine what time to display when no time is selected. This updates as the user navigates the field |
| `readonly` | `false` | `boolean` | Whether or not the time field is readonly |
| `required` | | `boolean` | When `true`, indicates that the user must set the value before the owning form can be submitted. |
| `step` | | `DateStep` | The stepping interval for the time fields. Defaults to `1`. |
**Events**
| Event | Payload | Description |
| --- | --- | --- |
| `update:modelValue` | `date: TimeRange` | Event handler called whenever the model value changes |
| `update:placeholder` | `date: TimeValue` | Event handler called whenever the placeholder value changes |
**Slots**
| Slot | Payload | Description |
| --- | --- | --- |
| `modelValue` | `TimeRange` | The current time of the field |
| `segments` | `{ start: { part: SegmentPart; value: string; }[]; end: { part: SegmentPart; value: string; }[]; }` | The time field segment contents |
| `isInvalid` | `boolean` | Value if the input is invalid |
**Methods**
| Method | Type | Description |
| --- | --- | --- |
| `setFocusedElement` | `(el: HTMLElement) => void` | Helper to set the focused element inside the TimeRangeField |
[TimeRangeFieldRoot.vue source](https://github.com/vinicunca/akar/blob/v2.0.20/packages/core/src/TimeRangeField/TimeRangeFieldRoot.vue)
| Data attribute | Value |
| --- | --- |
| `[data-readonly]` | Present when readonly |
| `[data-disabled]` | Present when disabled |
| `[data-invalid]` | Present when invalid |
### Input
Contains the time field segments.
**Props**
| Prop | Default | Type | Description |
| --- | --- | --- | --- |
| `as` | `"div"` | `AsTag \| Component` | The element or component this component should render as. Can be overwritten by `asChild`. |
| `asChild` | | `boolean` | Change the default rendered element for the one passed as a child, merging their props and behavior.
Read our [Composition](/akar/guides/composition) guide for more details. |
| `part*` | | `"day" \| "month" \| "year" \| "hour" \| "minute" \| "second" \| "dayPeriod" \| "literal" \| "timeZoneName"` | The part of the date to render |
| `type*` | | `"start" \| "end"` | The type of field to render (start or end) |
[TimeRangeFieldInput.vue source](https://github.com/vinicunca/akar/blob/v2.0.20/packages/core/src/TimeRangeField/TimeRangeFieldInput.vue)
| Data attribute | Value |
| --- | --- |
| `[data-disabled]` | Present when disabled |
| `[data-invalid]` | Present when invalid |
| `[data-placeholder]` | Present when no value is set |
## Accessibility
### Keyboard Interactions
| Key | Description |
| --- | --- |
| Tab | When focus moves onto the time field, focuses the first segment. |
| ArrowLeft / ArrowRight | Navigates between the time field segments. |
| ArrowUp / ArrowDown | Increments/changes the value of the segment. |
| 0-9 | When the focus is on a numeric `TimeRangeFieldInput`, it types in the number and focuses the next segment if the next input would result in an invalid value. |
| Backspace | Deletes a digit from the focused numeric segments. |
| A / P | When the focus is on the day period, it sets it to AM or PM. |
## Usage Examples
### Basic Usage
```vue
Book an Appointment
associate the interruption with a toast. |
| `swipeDirection` | `"right"` | `"right" \| "left" \| "down" \| "up"` | Direction of pointer swipe that should close the toast. |
| `swipeThreshold` | `50` | `number` | Distance in pixels that the swipe must pass before a close is triggered. |
[ToastProvider.vue source](https://github.com/vinicunca/akar/blob/v2.0.20/packages/core/src/Toast/ToastProvider.vue)
### Viewport
The fixed area where toasts appear. Users can jump to the viewport by pressing a hotkey. It is up to you to ensure the discoverability of the hotkey for keyboard users.
**Props**
| Prop | Default | Type | Description |
| --- | --- | --- | --- |
| `as` | `"ol"` | `AsTag \| Component` | The element or component this component should render as. Can be overwritten by `asChild`. |
| `asChild` | | `boolean` | Change the default rendered element for the one passed as a child, merging their props and behavior.
Read our [Composition](https://vinicunca.dev/akar/guides/composition) guide for more details. |
| `hotkey` | `["F8"]` | `string[]` | The keys to use as the keyboard shortcut that will move focus to the toast viewport. |
| `label` | `"Notifications ({hotkey})"` | `string \| ((hotkey: string) => string)` | An author-localized label for the toast viewport to provide context for screen reader users
when navigating page landmarks. The available `{hotkey}` placeholder will be replaced for you.
Alternatively, you can pass in a custom function to generate the label. |
[ToastViewport.vue source](https://github.com/vinicunca/akar/blob/v2.0.20/packages/core/src/Toast/ToastViewport.vue)
### Root
The toast that automatically closes. It should not be held open to [acquire a user response](https://vinicunca.dev/akar/components/toast#action).
> [!NOTE]
>
> Defer mounting with `forceMount` / [`Presence`](https://vinicunca.dev/akar/utilities/presence). See the [animation guide](https://vinicunca.dev/akar/guides/animation).
**Props**
| Prop | Default | Type | Description |
| --- | --- | --- | --- |
| `as` | `"li"` | `AsTag \| Component` | The element or component this component should render as. Can be overwritten by `asChild`. |
| `asChild` | | `boolean` | Change the default rendered element for the one passed as a child, merging their props and behavior.
Read our [Composition](https://vinicunca.dev/akar/guides/composition) guide for more details. |
| `defaultOpen` | `true` | `boolean` | The open state of the dialog when it is initially rendered. Use when you do not need to control its open state. |
| `duration` | | `number` | Time in milliseconds that toast should remain visible for. Overrides value
given to `ToastProvider`. |
| `forceMount` | | `boolean` | Used to force mounting when more control is needed. Useful when
controlling animation with Vue animation libraries. |
| `open` | | `boolean` | The controlled open state of the dialog. Can be bind as `v-model:open`. |
| `type` | `"foreground"` | `"foreground" \| "background"` | Control the sensitivity of the toast for accessibility purposes.
For toasts that are the result of a user action, choose `foreground`. Toasts generated from background tasks should use `background`. |
**Events**
| Event | Payload | Description |
| --- | --- | --- |
| `escapeKeyDown` | `event: KeyboardEvent` | Event handler called when the escape key is down. It can be prevented by calling `event.preventDefault`. |
| `pause` | | Event handler called when the dismiss timer is paused. This occurs when the pointer is moved over the viewport, the viewport is focused or when the window is blurred. |
| `resume` | | Event handler called when the dismiss timer is resumed. This occurs when the pointer is moved away from the viewport, the viewport is blurred or when the window is focused. |
| `swipeCancel` | `event: SwipeEvent` | Event handler called when swipe interaction is cancelled. It can be prevented by calling `event.preventDefault`. |
| `swipeEnd` | `event: SwipeEvent` | Event handler called at the end of a swipe interaction. It can be prevented by calling `event.preventDefault`. |
| `swipeMove` | `event: SwipeEvent` | Event handler called during a swipe interaction. It can be prevented by calling `event.preventDefault`. |
| `swipeStart` | `event: SwipeEvent` | Event handler called when starting a swipe interaction. It can be prevented by calling `event.preventDefault`. |
| `update:open` | `value: boolean` | Event handler called when the open state changes |
**Slots**
| Slot | Payload | Description |
| --- | --- | --- |
| `open` | `boolean` | Current open state |
| `remaining` | `number` | Remaining time (in ms) |
| `duration` | `number` | Total time the toast will remain visible for (in ms) |
[ToastRoot.vue source](https://github.com/vinicunca/akar/blob/v2.0.20/packages/core/src/Toast/ToastRoot.vue)
| Data attribute | Value |
| --- | --- |
| `[data-state]` | "open" \\| "closed" |
| `[data-swipe]` | "start" \\| "move" \\| "cancel" \\| "end" |
| `[data-swipe-direction]` | "up" \\| "down" \\| "left" \\| "right" |
| CSS variable | Description |
| --- | --- |
| `--akar-toast-swipe-move-x` | The offset position of the toast when horizontally swiping |
| `--akar-toast-swipe-move-y` | The offset position of the toast when vertically swiping |
| `--akar-toast-swipe-end-x` | The offset end position of the toast after horizontally swiping |
| `--akar-toast-swipe-end-y` | The offset end position of the toast after vertically swiping |
### Portal
When used, portals the content part into the `body`.
**Props**
| Prop | Default | Type | Description |
| --- | --- | --- | --- |
| `defer` | | `boolean` | Defer the resolving of a Teleport target until other parts of the
application have mounted (requires Vue 3.5.0+)
[reference](https://vuejs.org/guide/built-ins/teleport.html#deferred-teleport) |
| `disabled` | | `boolean` | Disable teleport and render the component inline
[reference](https://vuejs.org/guide/built-ins/teleport.html#disabling-teleport) |
| `forceMount` | | `boolean` | Used to force mounting when more control is needed. Useful when
controlling animation with Vue animation libraries. |
| `to` | | `string \| HTMLElement` | Vue native teleport component prop `:to`
[reference](https://vuejs.org/guide/built-ins/teleport.html#basic-usage) |
[ToastPortal.vue source](https://github.com/vinicunca/akar/blob/v2.0.20/packages/core/src/Toast/ToastPortal.vue)
### Title
An optional title for the toast
**Props**
| Prop | Default | Type | Description |
| --- | --- | --- | --- |
| `as` | `"div"` | `AsTag \| Component` | The element or component this component should render as. Can be overwritten by `asChild`. |
| `asChild` | | `boolean` | Change the default rendered element for the one passed as a child, merging their props and behavior.
Read our [Composition](https://vinicunca.dev/akar/guides/composition) guide for more details. |
[ToastTitle.vue source](https://github.com/vinicunca/akar/blob/v2.0.20/packages/core/src/Toast/ToastTitle.vue)
### Description
The toast message.
**Props**
| Prop | Default | Type | Description |
| --- | --- | --- | --- |
| `as` | `"div"` | `AsTag \| Component` | The element or component this component should render as. Can be overwritten by `asChild`. |
| `asChild` | | `boolean` | Change the default rendered element for the one passed as a child, merging their props and behavior.
Read our [Composition](https://vinicunca.dev/akar/guides/composition) guide for more details. |
[ToastDescription.vue source](https://github.com/vinicunca/akar/blob/v2.0.20/packages/core/src/Toast/ToastDescription.vue)
### Action
An action that is safe to ignore to ensure users are not expected to complete tasks with unexpected side effects as a result of a [time limit](https://www.w3.org/TR/UNDERSTANDING-WCAG20/time-limits-required-behaviors.html).
When obtaining a user response is necessary, portal an ["AlertDialog"](https://vinicunca.dev/akar/components/alert-dialog) styled as a toast into the viewport instead.
By default, clicking `ToastAction` dismisses the toast. Set `closeOnClick` to `false` when the action should run while keeping the toast visible.
```vue
who will not be able to navigate to the button easily/quickly. |
| `as` | `"button"` | `AsTag \| Component` | The element or component this component should render as. Can be overwritten by `asChild`. |
| `asChild` | | `boolean` | Change the default rendered element for the one passed as a child, merging their props and behavior.
Read our [Composition](https://vinicunca.dev/akar/guides/composition) guide for more details. |
| `closeOnClick` | `true` | `boolean` | Whether the action should close the toast when clicked. |
[ToastAction.vue source](https://github.com/vinicunca/akar/blob/v2.0.20/packages/core/src/Toast/ToastAction.vue)
### Close
A button that allows users to dismiss the toast before its duration has elapsed.
**Props**
| Prop | Default | Type | Description |
| --- | --- | --- | --- |
| `as` | `"button"` | `AsTag \| Component` | The element or component this component should render as. Can be overwritten by `asChild`. |
| `asChild` | | `boolean` | Change the default rendered element for the one passed as a child, merging their props and behavior.
Read our [Composition](https://vinicunca.dev/akar/guides/composition) guide for more details. |
[ToastClose.vue source](https://github.com/vinicunca/akar/blob/v2.0.20/packages/core/src/Toast/ToastClose.vue)
## Examples
### Custom hotkey
Override the default hotkey using the `event.code` value for each key from [keycode.info](https://keycode.info/).
```vue
Read our [Composition](https://vinicunca.dev/akar/guides/composition) guide for more details. |
| `defaultValue` | | `boolean` | The pressed state of the toggle when it is initially rendered. Use when you do not need to control its open state. |
| `disabled` | `false` | `boolean` | When `true`, prevents the user from interacting with the toggle. |
| `modelValue` | | `boolean \| null` | The controlled pressed state of the toggle. Can be bind as `v-model`. |
| `name` | | `string` | The name of the field. Submitted with its owning form as part of a name/value pair. |
| `required` | | `boolean` | When `true`, indicates that the user must set the value before the owning form can be submitted. |
**Events**
| Event | Payload | Description |
| --- | --- | --- |
| `update:modelValue` | `value: boolean` | Event handler called when the value of the toggle changes. |
**Slots**
| Slot | Payload | Description |
| --- | --- | --- |
| `modelValue` | `boolean` | Current value |
| `state` | `"on" \| "off"` | Current state |
| `pressed` | `boolean` | Current pressed state |
| `disabled` | `boolean` | Current disabled state |
[Toggle.vue source](https://github.com/vinicunca/akar/blob/v2.0.20/packages/core/src/Toggle/Toggle.vue)
| Data attribute | Value |
| --- | --- |
| `[data-state]` | "on" \\| "off" |
| `[data-disabled]` | Present when disabled |
## Accessibility
### Keyboard Interactions
| Key | Description |
| --- | --- |
| Space | Activates/deactivates the toggle. |
| Enter | Activates/deactivates the toggle. |
---
- [ARIA](https://www.w3.org/WAI/ARIA/apg/patterns/button)
- [GitHub](https://github.com/vinicunca/akar/blob/v2.0.20/packages/core/src/Toggle)
- [npm](https://www.npmjs.com/package/akar)
# Toggle Group
> A set of two-state buttons that can be toggled on or off.
## ToggleGroup
```vue [index.vue]
Read our [Composition](https://vinicunca.dev/akar/guides/composition) guide for more details. |
| `defaultValue` | | `AcceptableValue \| AcceptableValue[]` | The default active value of the item(s).
Use when you do not need to control the state of the item(s). |
| `dir` | | `"ltr" \| "rtl"` | The reading direction of the combobox when applicable.
If omitted, inherits globally from `ConfigProvider` or assumes LTR (left-to-right) reading mode. |
| `disabled` | `false` | `boolean` | When `true`, prevents the user from interacting with the toggle group and all its items. |
| `loop` | `true` | `boolean` | When `loop` and `rovingFocus` is `true`, keyboard navigation will loop from last item to first, and vice versa. |
| `modelValue` | | `AcceptableValue \| AcceptableValue[]` | The controlled value of the active item(s).
Use this when you need to control the state of the items. Can be binded with `v-model` |
| `name` | | `string` | The name of the field. Submitted with its owning form as part of a name/value pair. |
| `orientation` | | `"vertical" \| "horizontal"` | The orientation of the component, which determines how focus moves: `horizontal` for left/right arrows and `vertical` for up/down arrows. |
| `required` | | `boolean` | When `true`, indicates that the user must set the value before the owning form can be submitted. |
| `rovingFocus` | `true` | `boolean` | When `false`, navigating through the items using arrow keys will be disabled. |
| `type` | | `"single" \| "multiple"` | Determines whether a "single" or "multiple" items can be selected at a time.
This prop will overwrite the inferred type from `modelValue` and `defaultValue`. |
**Events**
| Event | Payload | Description |
| --- | --- | --- |
| `update:modelValue` | `payload: AcceptableValue \| AcceptableValue[]` | Event handler called when the value changes. |
**Slots**
| Slot | Payload | Description |
| --- | --- | --- |
| `modelValue` | `AcceptableValue \| AcceptableValue[]` | Current toggle values |
[ToggleGroupRoot.vue source](https://github.com/vinicunca/akar/blob/v2.0.20/packages/core/src/ToggleGroup/ToggleGroupRoot.vue)
| Data attribute | Value |
| --- | --- |
| `[data-orientation]` | "vertical" \\| "horizontal" |
### Item
An item in the group.
**Props**
| Prop | Default | Type | Description |
| --- | --- | --- | --- |
| `as` | `"button"` | `AsTag \| Component` | The element or component this component should render as. Can be overwritten by `asChild`. |
| `asChild` | | `boolean` | Change the default rendered element for the one passed as a child, merging their props and behavior.
Read our [Composition](https://vinicunca.dev/akar/guides/composition) guide for more details. |
| `disabled` | | `boolean` | When `true`, prevents the user from interacting with the toggle. |
| `value*` | | `AcceptableValue` | A string value for the toggle group item. All items within a toggle group should use a unique value. |
**Slots**
| Slot | Payload | Description |
| --- | --- | --- |
| `modelValue` | `boolean` | Current value |
| `state` | `"on" \| "off"` | Current state |
| `pressed` | `boolean` | Current pressed state |
| `disabled` | `boolean` | Current disabled state |
[ToggleGroupItem.vue source](https://github.com/vinicunca/akar/blob/v2.0.20/packages/core/src/ToggleGroup/ToggleGroupItem.vue)
| Data attribute | Value |
| --- | --- |
| `[data-state]` | "on" \\| "off" |
| `[data-disabled]` | Present when disabled |
| `[data-orientation]` | "vertical" \\| "horizontal" |
## Examples
### Ensuring there is always a value
You can control the component to ensure a value.
```vue
Read our [Composition](https://vinicunca.dev/akar/guides/composition) guide for more details. |
| `dir` | | `"ltr" \| "rtl"` | The reading direction of the combobox when applicable.
If omitted, inherits globally from `ConfigProvider` or assumes LTR (left-to-right) reading mode. |
| `loop` | | `boolean` | When `true`, keyboard navigation will loop from last tab to first, and vice versa. |
| `orientation` | `"horizontal"` | `"vertical" \| "horizontal"` | The orientation of the toolbar |
[ToolbarRoot.vue source](https://github.com/vinicunca/akar/blob/v2.0.20/packages/core/src/Toolbar/ToolbarRoot.vue)
| Data attribute | Value |
| --- | --- |
| `[data-orientation]` | "vertical" \\| "horizontal" |
### Button
A button item.
**Props**
| Prop | Default | Type | Description |
| --- | --- | --- | --- |
| `as` | `"button"` | `AsTag \| Component` | The element or component this component should render as. Can be overwritten by `asChild`. |
| `asChild` | | `boolean` | Change the default rendered element for the one passed as a child, merging their props and behavior.
Read our [Composition](https://vinicunca.dev/akar/guides/composition) guide for more details. |
| `disabled` | | `boolean` | |
[ToolbarButton.vue source](https://github.com/vinicunca/akar/blob/v2.0.20/packages/core/src/Toolbar/ToolbarButton.vue)
| Data attribute | Value |
| --- | --- |
| `[data-orientation]` | "vertical" \\| "horizontal" |
### Link
A link item.
**Props**
| Prop | Default | Type | Description |
| --- | --- | --- | --- |
| `as` | `"a"` | `AsTag \| Component` | The element or component this component should render as. Can be overwritten by `asChild`. |
| `asChild` | | `boolean` | Change the default rendered element for the one passed as a child, merging their props and behavior.
Read our [Composition](https://vinicunca.dev/akar/guides/composition) guide for more details. |
[ToolbarLink.vue source](https://github.com/vinicunca/akar/blob/v2.0.20/packages/core/src/Toolbar/ToolbarLink.vue)
### ToggleGroup
A set of two-state buttons that can be toggled on or off.
**Props**
| Prop | Default | Type | Description |
| --- | --- | --- | --- |
| `as` | `"div"` | `AsTag \| Component` | The element or component this component should render as. Can be overwritten by `asChild`. |
| `asChild` | | `boolean` | Change the default rendered element for the one passed as a child, merging their props and behavior.
Read our [Composition](https://vinicunca.dev/akar/guides/composition) guide for more details. |
| `defaultValue` | | `AcceptableValue \| AcceptableValue[]` | The default active value of the item(s).
Use when you do not need to control the state of the item(s). |
| `dir` | | `"ltr" \| "rtl"` | The reading direction of the combobox when applicable.
If omitted, inherits globally from `ConfigProvider` or assumes LTR (left-to-right) reading mode. |
| `disabled` | | `boolean` | When `true`, prevents the user from interacting with the toggle group and all its items. |
| `loop` | | `boolean` | When `loop` and `rovingFocus` is `true`, keyboard navigation will loop from last item to first, and vice versa. |
| `modelValue` | | `AcceptableValue \| AcceptableValue[]` | The controlled value of the active item(s).
Use this when you need to control the state of the items. Can be binded with `v-model` |
| `name` | | `string` | The name of the field. Submitted with its owning form as part of a name/value pair. |
| `orientation` | | `"vertical" \| "horizontal"` | The orientation of the component, which determines how focus moves: `horizontal` for left/right arrows and `vertical` for up/down arrows. |
| `required` | | `boolean` | When `true`, indicates that the user must set the value before the owning form can be submitted. |
| `rovingFocus` | | `boolean` | When `false`, navigating through the items using arrow keys will be disabled. |
| `type` | | `"single" \| "multiple"` | Determines whether a "single" or "multiple" items can be selected at a time.
This prop will overwrite the inferred type from `modelValue` and `defaultValue`. |
**Events**
| Event | Payload | Description |
| --- | --- | --- |
| `update:modelValue` | `payload: AcceptableValue \| AcceptableValue[]` | Event handler called when the value changes. |
[ToolbarToggleGroup.vue source](https://github.com/vinicunca/akar/blob/v2.0.20/packages/core/src/Toolbar/ToolbarToggleGroup.vue)
| Data attribute | Value |
| --- | --- |
| `[data-orientation]` | "vertical" \\| "horizontal" |
### ToggleItem
An item in the group.
**Props**
| Prop | Default | Type | Description |
| --- | --- | --- | --- |
| `as` | `"div"` | `AsTag \| Component` | The element or component this component should render as. Can be overwritten by `asChild`. |
| `asChild` | | `boolean` | Change the default rendered element for the one passed as a child, merging their props and behavior.
Read our [Composition](https://vinicunca.dev/akar/guides/composition) guide for more details. |
| `disabled` | | `boolean` | When `true`, prevents the user from interacting with the toggle. |
| `value*` | | `AcceptableValue` | A string value for the toggle group item. All items within a toggle group should use a unique value. |
[ToolbarToggleItem.vue source](https://github.com/vinicunca/akar/blob/v2.0.20/packages/core/src/Toolbar/ToolbarToggleItem.vue)
| Data attribute | Value |
| --- | --- |
| `[data-state]` | "on" \\| "off" |
| `[data-disabled]` | Present when disabled |
| `[data-orientation]` | "vertical" \\| "horizontal" |
### Separator
Used to visually separate items in the toolbar
**Props**
| Prop | Default | Type | Description |
| --- | --- | --- | --- |
| `as` | `"div"` | `AsTag \| Component` | The element or component this component should render as. Can be overwritten by `asChild`. |
| `asChild` | | `boolean` | Change the default rendered element for the one passed as a child, merging their props and behavior.
Read our [Composition](https://vinicunca.dev/akar/guides/composition) guide for more details. |
[ToolbarSeparator.vue source](https://github.com/vinicunca/akar/blob/v2.0.20/packages/core/src/Toolbar/ToolbarSeparator.vue)
| Data attribute | Value |
| --- | --- |
| `[data-orientation]` | "vertical" \\| "horizontal" |
## Examples
### Use with other primitives
All our primitives which expose a `Trigger` part, such as `Dialog`, `AlertDialog`, `Popover`, `DropdownMenu` can be composed within a toolbar by using the [`asChild` prop](https://vinicunca.dev/akar/guides/composition).
Here is an example using our `DropdownMenu` primitive.
```vue
the keyboard by matching against the `:focus-visible` selector.
This is useful if you want to avoid opening it when switching
browser tabs or closing a dialog. |
| `skipDelayDuration` | `300` | `number` | How much time a user has to enter another trigger without incurring a delay again. |
[TooltipProvider.vue source](https://github.com/vinicunca/akar/blob/v2.0.20/packages/core/src/Tooltip/TooltipProvider.vue)
### Root
Contains all the parts of a tooltip.
**Props**
| Prop | Default | Type | Description |
| --- | --- | --- | --- |
| `defaultOpen` | `false` | `boolean` | The open state of the tooltip when it is initially rendered.
Use when you do not need to control its open state. |
| `delayDuration` | `700` | `number` | Override the duration given to the `Provider` to customise
the open delay for a specific tooltip. |
| `disableClosingTrigger` | `false` | `boolean` | When `true`, clicking on trigger will not close the content. |
| `disabled` | `false` | `boolean` | When `true`, disable tooltip |
| `disableHoverableContent` | | `boolean` | Prevents Tooltip.Content from remaining open when hovering.
Disabling this has accessibility consequences. Inherits
from Tooltip.Provider. |
| `ignoreNonKeyboardFocus` | `false` | `boolean` | Prevent the tooltip from opening if the focus did not come from
the keyboard by matching against the `:focus-visible` selector.
This is useful if you want to avoid opening it when switching
browser tabs or closing a dialog. |
| `open` | | `boolean` | The controlled open state of the tooltip. |
**Events**
| Event | Payload | Description |
| --- | --- | --- |
| `update:open` | `value: boolean` | Event handler called when the open state of the tooltip changes. |
**Slots**
| Slot | Payload | Description |
| --- | --- | --- |
| `open` | `boolean` | Current open state |
[TooltipRoot.vue source](https://github.com/vinicunca/akar/blob/v2.0.20/packages/core/src/Tooltip/TooltipRoot.vue)
### Trigger
The button that toggles the tooltip. By default, the `TooltipContent` will position itself against the trigger.
**Props**
| Prop | Default | Type | Description |
| --- | --- | --- | --- |
| `as` | `"button"` | `AsTag \| Component` | The element or component this component should render as. Can be overwritten by `asChild`. |
| `asChild` | | `boolean` | Change the default rendered element for the one passed as a child, merging their props and behavior.
Read our [Composition](https://vinicunca.dev/akar/guides/composition) guide for more details. |
| `reference` | | `ReferenceElement` | The reference (or anchor) element that is being referred to for positioning.
If not provided will use the current component as anchor. |
[TooltipTrigger.vue source](https://github.com/vinicunca/akar/blob/v2.0.20/packages/core/src/Tooltip/TooltipTrigger.vue)
| Data attribute | Value |
| --- | --- |
| `[data-state]` | "closed" \\| "delayed-open" \\| "instant-open" |
### Portal
When used, portals the content part into the `body`.
**Props**
| Prop | Default | Type | Description |
| --- | --- | --- | --- |
| `defer` | | `boolean` | Defer the resolving of a Teleport target until other parts of the
application have mounted (requires Vue 3.5.0+)
[reference](https://vuejs.org/guide/built-ins/teleport.html#deferred-teleport) |
| `disabled` | | `boolean` | Disable teleport and render the component inline
[reference](https://vuejs.org/guide/built-ins/teleport.html#disabling-teleport) |
| `forceMount` | | `boolean` | Used to force mounting when more control is needed. Useful when
controlling animation with Vue animation libraries. |
| `to` | | `string \| HTMLElement` | Vue native teleport component prop `:to`
[reference](https://vuejs.org/guide/built-ins/teleport.html#basic-usage) |
[TooltipPortal.vue source](https://github.com/vinicunca/akar/blob/v2.0.20/packages/core/src/Tooltip/TooltipPortal.vue)
### Content
The component that pops out when the tooltip is open.
> [!NOTE]
>
> Defer mounting with `forceMount` / [`Presence`](https://vinicunca.dev/akar/utilities/presence). See the [animation guide](https://vinicunca.dev/akar/guides/animation).
**Props**
| Prop | Default | Type | Description |
| --- | --- | --- | --- |
| `align` | `"center"` | `"start" \| "center" \| "end"` | The preferred alignment against the trigger.
May change when collisions occur. |
| `alignOffset` | `0` | `number` | An offset in pixels from the `start` or `end` alignment options. |
| `ariaLabel` | `String` | `string` | By default, screenreaders will announce the content inside
the component. If this is not descriptive enough, or you have
content that cannot be announced, use aria-label as a more
descriptive label. |
| `arrowPadding` | `0` | `number` | The padding between the arrow and the edges of the content.
If your content has border-radius, this will prevent it from
overflowing the corners. |
| `as` | `"div"` | `AsTag \| Component` | The element or component this component should render as. Can be overwritten by `asChild`. |
| `asChild` | | `boolean` | Change the default rendered element for the one passed as a child, merging their props and behavior.
Read our [Composition](https://vinicunca.dev/akar/guides/composition) guide for more details. |
| `avoidCollisions` | `true` | `boolean` | When `true`, overrides the side and align preferences
to prevent collisions with boundary edges. |
| `collisionBoundary` | `[]` | `Element \| (Element \| null)[] \| null` | The element used as the collision boundary. By default
this is the viewport, though you can provide additional
element(s) to be included in this check. |
| `collisionPadding` | `0` | `number \| Partial
detection should occur. Accepts a number (same for all sides),
or a partial padding object, for example: { top: 20, left: 20 }. |
| `forceMount` | | `boolean` | Used to force mounting when more control is needed. Useful when
controlling animation with Vue animation libraries. |
| `hideWhenDetached` | `false` | `boolean` | Whether to hide the content when the trigger becomes fully occluded. |
| `positionStrategy` | | `"fixed" \| "absolute"` | The type of CSS position property to use. |
| `side` | `"bottom"` | `"top" \| "right" \| "bottom" \| "left"` | The preferred side of the trigger to render against when open.
Will be reversed when collisions occur and avoidCollisions
is enabled. |
| `sideOffset` | `0` | `number` | The distance in pixels from the trigger. |
| `sticky` | `"partial"` | `"partial" \| "always"` | The sticky behavior on the align axis. `partial` will keep the
content in the boundary as long as the trigger is at least partially
in the boundary whilst "always" will keep the content in the boundary
regardless. |
| `updatePositionStrategy` | `'optimized'` | `"always" \| "optimized"` | Strategy to update the position of the floating element on every animation frame. |
**Events**
| Event | Payload | Description |
| --- | --- | --- |
| `escapeKeyDown` | `event: KeyboardEvent` | Event handler called when focus moves to the destructive action after opening. It can be prevented by calling `event.preventDefault` |
| `pointerDownOutside` | `event: Event` | Event handler called when a pointer event occurs outside the bounds of the component. It can be prevented by calling `event.preventDefault`. |
[TooltipContent.vue source](https://github.com/vinicunca/akar/blob/v2.0.20/packages/core/src/Tooltip/TooltipContent.vue)
| Data attribute | Value |
| --- | --- |
| `[data-state]` | "closed" \\| "delayed-open" \\| "instant-open" |
| `[data-side]` | "left" \\| "right" \\| "bottom" \\| "top" |
| `[data-align]` | "start" \\| "end" \\| "center" |
| CSS variable | Description |
| --- | --- |
| `--akar-tooltip-content-transform-origin` | The `transform-origin` computed from the content and arrow positions/offsets |
| `--akar-tooltip-content-available-width` | The remaining width between the trigger and the boundary edge |
| `--akar-tooltip-content-available-height` | The remaining height between the trigger and the boundary edge |
| `--akar-tooltip-trigger-width` | The width of the trigger |
| `--akar-tooltip-trigger-height` | The height of the trigger |
### Arrow
An optional arrow element to render alongside the tooltip. This can be used to help visually link the trigger with the `TooltipContent`. Must be rendered inside `TooltipContent`.
**Props**
| Prop | Default | Type | Description |
| --- | --- | --- | --- |
| `as` | `"svg"` | `AsTag \| Component` | The element or component this component should render as. Can be overwritten by `asChild`. |
| `asChild` | | `boolean` | Change the default rendered element for the one passed as a child, merging their props and behavior.
Read our [Composition](https://vinicunca.dev/akar/guides/composition) guide for more details. |
| `height` | `5` | `number` | The height of the arrow in pixels. |
| `width` | `10` | `number` | The width of the arrow in pixels. |
[TooltipArrow.vue source](https://github.com/vinicunca/akar/blob/v2.0.20/packages/core/src/Tooltip/TooltipArrow.vue)
## Examples
### Configure globally
Use the `Provider` to control `delayDuration` and `skipDelayDuration` globally.
```vue
Directory Structure
Read our [Composition](/akar/guides/composition) guide for more details. |
| `bubbleSelect` | | `boolean` | When `true`, selecting children will update the parent state. Requires `multiple` to be `true`. |
| `defaultExpanded` | | `string[]` | The value of the expanded tree when initially rendered. Use when you do not need to control the state of the expanded tree |
| `defaultValue` | | `(M extends true ? U[] : U)` | The value of the tree when initially rendered. Use when you do not need to control the state of the tree |
| `dir` | | `"ltr" \| "rtl"` | The reading direction of the listbox when applicable.
If omitted, inherits globally from `ConfigProvider` or assumes LTR (left-to-right) reading mode. |
| `disabled` | | `boolean` | When `true`, prevents the user from interacting with tree |
| `expanded` | | `string[]` | The controlled value of the expanded item. Can be binded with `v-model`. |
| `getChildren` | `val.children` | `((val: T) => T[])` | This function is passed the index of each item and should return a list of children for that item |
| `getKey*` | | `(val: T): string` | This function is passed the index of each item and should return a unique key for that item |
| `items` | | `T[]` | List of items |
| `modelValue` | | `(M extends true ? U[] : U)` | The controlled value of the tree. Can be binded with `v-model`. |
| `multiple` | | `boolean \| M` | Whether multiple options can be selected or not. |
| `propagateSelect` | | `boolean` | When `true`, selecting parent will select the descendants. Requires `multiple` to be `true`. |
| `selectionBehavior` | `"toggle"` | `"replace" \| "toggle"` | How multiple selection should behave in the collection. |
**Events**
| Event | Payload | Description |
| --- | --- | --- |
| `update:expanded` | `val: string[]` | |
| `update:modelValue` | `val: M extends true ? U[] : U` | |
**Slots**
| Slot | Payload | Description |
| --- | --- | --- |
| `flattenItems` | `FlattenedItem
Read our [Composition](/akar/guides/composition) guide for more details. |
| `disabled` | | `boolean` | When `true`, prevents the user from interacting with the item. |
| `level*` | | `number` | Level of depth |
| `value*` | | `T` | Value given to this item |
**Events**
| Event | Payload | Description |
| --- | --- | --- |
| `select` | `event: SelectEvent
It can be prevented by calling `event.preventDefault`. |
| `toggle` | `event: ToggleEvent
It can be prevented by calling `event.preventDefault`. |
**Slots**
| Slot | Payload | Description |
| --- | --- | --- |
| `isExpanded` | `boolean` | |
| `isSelected` | `boolean` | |
| `isIndeterminate` | `boolean` | |
| `isDisabled` | `boolean` | |
| `handleToggle` | `(): void` | |
| `handleSelect` | `(): void` | |
[TreeItem.vue source](https://github.com/vinicunca/akar/blob/v2.0.20/packages/core/src/Tree/TreeItem.vue)
| Data attribute | Value |
| --- | --- |
| `[data-indent]` | Number |
| `[data-expanded]` | Present when expanded |
| `[data-selected]` | Present when selected |
### Virtualizer
Virtual container to achieve list virtualization.
**Props**
| Prop | Default | Type | Description |
| --- | --- | --- | --- |
| `estimateSize` | | `number \| ((index: number) => number)` | Estimated size (in px) of each item |
| `overscan` | | `number` | Number of items rendered outside the visible area |
| `textContent` | | `((item: Record
Read our [Composition](/akar/guides/composition) guide for more details. |
| `calendarLabel` | | `string` | The accessible label for the year picker |
| `defaultPlaceholder` | | `DateValue` | The default placeholder date |
| `defaultValue` | | `DateValue` | The default value for the year picker |
| `dir` | | `"ltr" \| "rtl"` | The reading direction of the calendar when applicable. If omitted, inherits globally from `ConfigProvider` or assumes LTR. |
| `disabled` | `false` | `boolean` | Whether the year picker is disabled |
| `initialFocus` | `false` | `boolean` | If true, the year picker will focus the selected year, today, or the first year of the range on mount |
| `isYearDisabled` | | `Matcher` | A function that returns whether or not a year is disabled |
| `isYearUnavailable` | | `Matcher` | A function that returns whether or not a year is unavailable |
| `locale` | | `string` | The locale to use for formatting dates |
| `maxValue` | | `DateValue` | The maximum date that can be selected |
| `minValue` | | `DateValue` | The minimum date that can be selected |
| `modelValue` | | `DateValue \| DateValue[] \| null` | The controlled selected year value of the year picker. Can be bound as `v-model`. |
| `multiple` | `false` | `boolean` | Whether multiple years can be selected |
| `nextPage` | | `((placeholder: DateValue) => DateValue)` | A function that returns the next page of the year picker. Receives the current placeholder as an argument. |
| `placeholder` | | `DateValue` | The placeholder date, which is used to determine what year range to display when no date is selected |
| `preventDeselect` | `false` | `boolean` | Whether or not to prevent the user from deselecting a date without selecting another date first |
| `prevPage` | | `((placeholder: DateValue) => DateValue)` | A function that returns the previous page of the year picker. Receives the current placeholder as an argument. |
| `readonly` | `false` | `boolean` | Whether the year picker is readonly |
| `yearsPerPage` | `12` | `number` | Number of years to display per page |
**Events**
| Event | Payload | Description |
| --- | --- | --- |
| `update:modelValue` | `date: DateValue \| DateValue[]` | Event handler called whenever the model value changes |
| `update:placeholder` | `date: DateValue` | Event handler called whenever the placeholder value changes |
**Slots**
| Slot | Payload | Description |
| --- | --- | --- |
| `date` | `DateValue` | The current date of the placeholder |
| `grid` | `Grid
Read our [Composition](/akar/guides/composition) guide for more details. |
[YearPickerHeader.vue source](https://github.com/vinicunca/akar/blob/v2.0.20/packages/core/src/YearPicker/YearPickerHeader.vue)
### Prev Button
Calendar navigation button. It navigates the calendar one page (default: 12 years) in the past.
**Props**
| Prop | Default | Type | Description |
| --- | --- | --- | --- |
| `as` | `"button"` | `AsTag \| Component` | The element or component this component should render as. Can be overwritten by `asChild`. |
| `asChild` | | `boolean` | Change the default rendered element for the one passed as a child, merging their props and behavior.
Read our [Composition](/akar/guides/composition) guide for more details. |
| `prevPage` | | `((placeholder: DateValue) => DateValue)` | The function to be used for the prev page. Overwrites the `prevPage` function set on the `YearPickerRoot`. |
**Slots**
| Slot | Payload | Description |
| --- | --- | --- |
| `disabled` | `boolean` | Current disable state |
[YearPickerPrev.vue source](https://github.com/vinicunca/akar/blob/v2.0.20/packages/core/src/YearPicker/YearPickerPrev.vue)
| Data attribute | Value |
| --- | --- |
| `[data-disabled]` | Present when disabled |
### Next Button
Calendar navigation button. It navigates the calendar one page (default: 12 years) in the future.
**Props**
| Prop | Default | Type | Description |
| --- | --- | --- | --- |
| `as` | `"button"` | `AsTag \| Component` | The element or component this component should render as. Can be overwritten by `asChild`. |
| `asChild` | | `boolean` | Change the default rendered element for the one passed as a child, merging their props and behavior.
Read our [Composition](/akar/guides/composition) guide for more details. |
| `nextPage` | | `((placeholder: DateValue) => DateValue)` | The function to be used for the next page. Overwrites the `nextPage` function set on the `YearPickerRoot`. |
**Slots**
| Slot | Payload | Description |
| --- | --- | --- |
| `disabled` | `boolean` | Current disable state |
[YearPickerNext.vue source](https://github.com/vinicunca/akar/blob/v2.0.20/packages/core/src/YearPicker/YearPickerNext.vue)
| Data attribute | Value |
| --- | --- |
| `[data-disabled]` | Present when disabled |
### Heading
Heading for displaying the current year range (e.g., "2020 - 2031").
**Props**
| Prop | Default | Type | Description |
| --- | --- | --- | --- |
| `as` | `"div"` | `AsTag \| Component` | The element or component this component should render as. Can be overwritten by `asChild`. |
| `asChild` | | `boolean` | Change the default rendered element for the one passed as a child, merging their props and behavior.
Read our [Composition](/akar/guides/composition) guide for more details. |
**Slots**
| Slot | Payload | Description |
| --- | --- | --- |
| `headingValue` | `string` | Current year range heading |
[YearPickerHeading.vue source](https://github.com/vinicunca/akar/blob/v2.0.20/packages/core/src/YearPicker/YearPickerHeading.vue)
| Data attribute | Value |
| --- | --- |
| `[data-disabled]` | Present when disabled |
### Grid
Container for wrapping the year picker grid.
**Props**
| Prop | Default | Type | Description |
| --- | --- | --- | --- |
| `as` | `"table"` | `AsTag \| Component` | The element or component this component should render as. Can be overwritten by `asChild`. |
| `asChild` | | `boolean` | Change the default rendered element for the one passed as a child, merging their props and behavior.
Read our [Composition](/akar/guides/composition) guide for more details. |
[YearPickerGrid.vue source](https://github.com/vinicunca/akar/blob/v2.0.20/packages/core/src/YearPicker/YearPickerGrid.vue)
| Data attribute | Value |
| --- | --- |
| `[data-readonly]` | Present when readonly |
| `[data-disabled]` | Present when disabled |
### Grid Body
Container for wrapping the grid body.
**Props**
| Prop | Default | Type | Description |
| --- | --- | --- | --- |
| `as` | `"tbody"` | `AsTag \| Component` | The element or component this component should render as. Can be overwritten by `asChild`. |
| `asChild` | | `boolean` | Change the default rendered element for the one passed as a child, merging their props and behavior.
Read our [Composition](/akar/guides/composition) guide for more details. |
[YearPickerGridBody.vue source](https://github.com/vinicunca/akar/blob/v2.0.20/packages/core/src/YearPicker/YearPickerGridBody.vue)
### Grid Row
Container for wrapping the grid row.
**Props**
| Prop | Default | Type | Description |
| --- | --- | --- | --- |
| `as` | `"tr"` | `AsTag \| Component` | The element or component this component should render as. Can be overwritten by `asChild`. |
| `asChild` | | `boolean` | Change the default rendered element for the one passed as a child, merging their props and behavior.
Read our [Composition](/akar/guides/composition) guide for more details. |
[YearPickerGridRow.vue source](https://github.com/vinicunca/akar/blob/v2.0.20/packages/core/src/YearPicker/YearPickerGridRow.vue)
### Cell
Container for wrapping the year picker cells.
**Props**
| Prop | Default | Type | Description |
| --- | --- | --- | --- |
| `as` | `"td"` | `AsTag \| Component` | The element or component this component should render as. Can be overwritten by `asChild`. |
| `asChild` | | `boolean` | Change the default rendered element for the one passed as a child, merging their props and behavior.
Read our [Composition](/akar/guides/composition) guide for more details. |
| `date*` | | `DateValue` | The date value for the cell |
[YearPickerCell.vue source](https://github.com/vinicunca/akar/blob/v2.0.20/packages/core/src/YearPicker/YearPickerCell.vue)
| Data attribute | Value |
| --- | --- |
| `[data-disabled]` | Present when disabled |
### Cell Trigger
Interactable container for displaying the cell years. Clicking it selects the year.
**Props**
| Prop | Default | Type | Description |
| --- | --- | --- | --- |
| `as` | `"div"` | `AsTag \| Component` | The element or component this component should render as. Can be overwritten by `asChild`. |
| `asChild` | | `boolean` | Change the default rendered element for the one passed as a child, merging their props and behavior.
Read our [Composition](/akar/guides/composition) guide for more details. |
| `year*` | | `DateValue` | The date value provided to the cell trigger |
**Slots**
| Slot | Payload | Description |
| --- | --- | --- |
| `yearValue` | `string` | Current year value |
| `disabled` | `boolean` | Current disable state |
| `selected` | `boolean` | Current selected state |
| `today` | `boolean` | Current year is today state |
| `unavailable` | `boolean` | Current unavailable state |
[YearPickerCellTrigger.vue source](https://github.com/vinicunca/akar/blob/v2.0.20/packages/core/src/YearPicker/YearPickerCellTrigger.vue)
| Data attribute | Value |
| --- | --- |
| `[data-selected]` | Present when selected |
| `[data-value]` | The ISO string value of the date. |
| `[data-disabled]` | Present when disabled |
| `[data-unavailable]` | Present when unavailable |
| `[data-today]` | Present when the year is the current year |
| `[data-focused]` | Present when focused |
## Accessibility
### Keyboard Interactions
| Key | Description |
| --- | --- |
| Tab | When focus moves onto the year picker, focuses the first navigation button. |
| Space | When the focus is on either `YearPickerNext` or `YearPickerPrev`, it navigates the calendar. Otherwise, it selects the year. |
| Enter | When the focus is on either `YearPickerNext` or `YearPickerPrev`, it navigates the calendar. Otherwise, it selects the year. |
| ArrowLeft / ArrowRight / ArrowUp / ArrowDown | When the focus is on `YearPickerCellTrigger`, it navigates the years, changing the page if necessary. |
| PageUp | When the focus is on `YearPickerCellTrigger`, it navigates to the previous page of years. |
| PageDown | When the focus is on `YearPickerCellTrigger`, it navigates to the next page of years. |
---
- [GitHub](https://github.com/vinicunca/akar/blob/v2.0.20/packages/core/src/YearPicker)
- [npm](https://www.npmjs.com/package/akar)
# YearRangePicker
> Presents a calendar view tailored for selecting year ranges.
## Year Range Picker
`````vue [index.vue]
Read our [Composition](/akar/guides/composition) guide for more details. |
| `calendarLabel` | | `string` | The accessible label for the calendar |
| `defaultPlaceholder` | | `DateValue` | The default placeholder date |
| `defaultValue` | `{ start: undefined, end: undefined }` | `DateRange` | The default value for the calendar |
| `dir` | | `"ltr" \| "rtl"` | The reading direction of the calendar when applicable. |
| `disabled` | `false` | `boolean` | Whether or not the calendar is disabled |
| `fixedDate` | | `"start" \| "end"` | Which part of the range should be fixed |
| `initialFocus` | `false` | `boolean` | If true, the calendar will focus the selected year on mount |
| `isYearDisabled` | | `Matcher` | A function that returns whether or not a year is disabled |
| `isYearUnavailable` | | `Matcher` | A function that returns whether or not a year is unavailable |
| `locale` | | `string` | The locale to use for formatting dates |
| `maximumYears` | | `number` | The maximum number of years that can be selected in a range |
| `maxValue` | | `DateValue` | The maximum date that can be selected |
| `minValue` | | `DateValue` | The minimum date that can be selected |
| `modelValue` | | `DateRange \| null` | The controlled selected year range of the year range picker. Can be bound as `v-model`. |
| `nextPage` | | `((placeholder: DateValue) => DateValue)` | A function that returns the next page of the calendar. |
| `placeholder` | | `DateValue` | The placeholder date, which is used to determine what year range to display when no date is selected. |
| `preventDeselect` | `false` | `boolean` | Whether or not to prevent the user from deselecting a date without selecting another date first |
| `prevPage` | | `((placeholder: DateValue) => DateValue)` | A function that returns the previous page of the calendar. |
| `readonly` | `false` | `boolean` | Whether or not the calendar is readonly |
| `yearsPerPage` | `12` | `number` | Number of years to display per page |
**Events**
| Event | Payload | Description |
| --- | --- | --- |
| `update:modelValue` | `date: DateRange` | Event handler called whenever the model value changes |
| `update:placeholder` | `date: DateValue` | Event handler called whenever the placeholder value changes |
| `update:startValue` | `date: DateValue` | Event handler called whenever the start value changes |
**Slots**
| Slot | Payload | Description |
| --- | --- | --- |
| `date` | `DateValue` | The current date of the placeholder |
| `grid` | `Grid
Read our [Composition](/akar/guides/composition) guide for more details. |
[YearRangePickerHeader.vue source](https://github.com/vinicunca/akar/blob/v2.0.20/packages/core/src/YearRangePicker/YearRangePickerHeader.vue)
### Prev Button
Calendar navigation button. It navigates the calendar one page (12 years by default) in the past.
**Props**
| Prop | Default | Type | Description |
| --- | --- | --- | --- |
| `as` | `"button"` | `AsTag \| Component` | The element or component this component should render as. Can be overwritten by `asChild`. |
| `asChild` | | `boolean` | Change the default rendered element for the one passed as a child, merging their props and behavior.
Read our [Composition](/akar/guides/composition) guide for more details. |
| `prevPage` | | `((placeholder: DateValue) => DateValue)` | The function to be used for the prev page. Overwrites the `prevPage` function set on the Root. |
**Slots**
| Slot | Payload | Description |
| --- | --- | --- |
| `disabled` | `boolean` | Current disable state |
[YearRangePickerPrev.vue source](https://github.com/vinicunca/akar/blob/v2.0.20/packages/core/src/YearRangePicker/YearRangePickerPrev.vue)
| Data attribute | Value |
| --- | --- |
| `[data-disabled]` | Present when disabled |
### Next Button
Calendar navigation button. It navigates the calendar one page (12 years by default) in the future.
**Props**
| Prop | Default | Type | Description |
| --- | --- | --- | --- |
| `as` | `"button"` | `AsTag \| Component` | The element or component this component should render as. Can be overwritten by `asChild`. |
| `asChild` | | `boolean` | Change the default rendered element for the one passed as a child, merging their props and behavior.
Read our [Composition](/akar/guides/composition) guide for more details. |
| `nextPage` | | `((placeholder: DateValue) => DateValue)` | The function to be used for the next page. Overwrites the `nextPage` function set on the Root. |
**Slots**
| Slot | Payload | Description |
| --- | --- | --- |
| `disabled` | `boolean` | Current disable state |
[YearRangePickerNext.vue source](https://github.com/vinicunca/akar/blob/v2.0.20/packages/core/src/YearRangePicker/YearRangePickerNext.vue)
| Data attribute | Value |
| --- | --- |
| `[data-disabled]` | Present when disabled |
### Heading
Heading for displaying the current year range.
**Props**
| Prop | Default | Type | Description |
| --- | --- | --- | --- |
| `as` | `"div"` | `AsTag \| Component` | The element or component this component should render as. Can be overwritten by `asChild`. |
| `asChild` | | `boolean` | Change the default rendered element for the one passed as a child, merging their props and behavior.
Read our [Composition](/akar/guides/composition) guide for more details. |
**Slots**
| Slot | Payload | Description |
| --- | --- | --- |
| `headingValue` | `string` | Current year range heading |
[YearRangePickerHeading.vue source](https://github.com/vinicunca/akar/blob/v2.0.20/packages/core/src/YearRangePicker/YearRangePickerHeading.vue)
| Data attribute | Value |
| --- | --- |
| `[data-disabled]` | Present when disabled |
### Grid
Container for wrapping the year range picker grid.
**Props**
| Prop | Default | Type | Description |
| --- | --- | --- | --- |
| `as` | `"table"` | `AsTag \| Component` | The element or component this component should render as. Can be overwritten by `asChild`. |
| `asChild` | | `boolean` | Change the default rendered element for the one passed as a child, merging their props and behavior.
Read our [Composition](/akar/guides/composition) guide for more details. |
[YearRangePickerGrid.vue source](https://github.com/vinicunca/akar/blob/v2.0.20/packages/core/src/YearRangePicker/YearRangePickerGrid.vue)
| Data attribute | Value |
| --- | --- |
| `[data-readonly]` | Present when readonly |
| `[data-disabled]` | Present when disabled |
### Grid Body
Container for wrapping the grid body.
**Props**
| Prop | Default | Type | Description |
| --- | --- | --- | --- |
| `as` | `"tbody"` | `AsTag \| Component` | The element or component this component should render as. Can be overwritten by `asChild`. |
| `asChild` | | `boolean` | Change the default rendered element for the one passed as a child, merging their props and behavior.
Read our [Composition](/akar/guides/composition) guide for more details. |
[YearRangePickerGridBody.vue source](https://github.com/vinicunca/akar/blob/v2.0.20/packages/core/src/YearRangePicker/YearRangePickerGridBody.vue)
### Grid Row
Container for wrapping the grid row.
**Props**
| Prop | Default | Type | Description |
| --- | --- | --- | --- |
| `as` | `"tr"` | `AsTag \| Component` | The element or component this component should render as. Can be overwritten by `asChild`. |
| `asChild` | | `boolean` | Change the default rendered element for the one passed as a child, merging their props and behavior.
Read our [Composition](/akar/guides/composition) guide for more details. |
[YearRangePickerGridRow.vue source](https://github.com/vinicunca/akar/blob/v2.0.20/packages/core/src/YearRangePicker/YearRangePickerGridRow.vue)
### Cell
Container for wrapping the year range picker cells.
**Props**
| Prop | Default | Type | Description |
| --- | --- | --- | --- |
| `as` | `"td"` | `AsTag \| Component` | The element or component this component should render as. Can be overwritten by `asChild`. |
| `asChild` | | `boolean` | Change the default rendered element for the one passed as a child, merging their props and behavior.
Read our [Composition](/akar/guides/composition) guide for more details. |
| `date*` | | `DateValue` | The date value for the cell |
[YearRangePickerCell.vue source](https://github.com/vinicunca/akar/blob/v2.0.20/packages/core/src/YearRangePicker/YearRangePickerCell.vue)
| Data attribute | Value |
| --- | --- |
| `[data-disabled]` | Present when disabled |
### Cell Trigger
Interactable container for displaying the cell years. Clicking it selects the year.
**Props**
| Prop | Default | Type | Description |
| --- | --- | --- | --- |
| `as` | `"div"` | `AsTag \| Component` | The element or component this component should render as. Can be overwritten by `asChild`. |
| `asChild` | | `boolean` | Change the default rendered element for the one passed as a child, merging their props and behavior.
Read our [Composition](/akar/guides/composition) guide for more details. |
| `year*` | | `DateValue` | The date value provided to the cell trigger |
**Slots**
| Slot | Payload | Description |
| --- | --- | --- |
| `yearValue` | `string` | Current year value |
| `disabled` | `boolean` | Current disable state |
| `selected` | `boolean` | Current selected state |
| `today` | `boolean` | Current year is today's year state |
| `unavailable` | `boolean` | Current unavailable state |
| `highlighted` | `boolean` | Current highlighted state |
| `highlightedStart` | `boolean` | Current highlighted start state |
| `highlightedEnd` | `boolean` | Current highlighted end state |
| `selectionStart` | `boolean` | Current selection start state |
| `selectionEnd` | `boolean` | Current selection end state |
[YearRangePickerCellTrigger.vue source](https://github.com/vinicunca/akar/blob/v2.0.20/packages/core/src/YearRangePicker/YearRangePickerCellTrigger.vue)
| Data attribute | Value |
| --- | --- |
| `[data-selected]` | Present when selected |
| `[data-value]` | The ISO string value of the date. |
| `[data-disabled]` | Present when disabled |
| `[data-unavailable]` | Present when unavailable |
| `[data-today]` | Present when the year is the current year |
| `[data-selection-start]` | Present when the year is the start of the selection. |
| `[data-selection-end]` | Present when the year is the end of the selection. |
| `[data-highlighted]` | Present when the year is highlighted by the user as they select a range. |
| `[data-highlighted-start]` | Present when the year is the start of the range that is highlighted by the user. |
| `[data-highlighted-end]` | Present when the year is the end of the range that is highlighted by the user. |
| `[data-focused]` | Present when focused |
## Accessibility
### Keyboard Interactions
| Key | Description |
| --- | --- |
| Tab | When focus moves onto the year range picker, focuses the first navigation button. |
| Space | When the focus is on either `YearRangePickerNext` or `YearRangePickerPrev`, it navigates the calendar. Otherwise, it selects the year. |
| Enter | When the focus is on either `YearRangePickerNext` or `YearRangePickerPrev`, it navigates the calendar. Otherwise, it selects the year. |
| ArrowLeft / ArrowRight / ArrowUp / ArrowDown | When the focus is on `YearRangePickerCellTrigger`, it navigates the years, changing the page if necessary. |
| PageUp | When the focus is on `YearRangePickerCellTrigger`, it navigates to the previous page of years. |
| PageDown | When the focus is on `YearRangePickerCellTrigger`, it navigates to the next page of years. |
| Escape | Cancels the current range selection and restores the previous valid range. |
---
- [GitHub](https://github.com/vinicunca/akar/blob/v2.0.20/packages/core/src/YearRangePicker)
- [npm](https://www.npmjs.com/package/akar)
# Guides
> How to compose, style, animate, and internationalize Akar primitives.
Pick a guide. Composition and styling are the two you will use on every component.
[**Composition**](https://vinicunca.dev/akar/guides/composition)
Use the `asChild` prop to compose Akar's functionality onto alternative element types or your own Vue components.
[**Styling**](https://vinicunca.dev/akar/guides/styling)
Akar are unstyled—and compatible with any styling solution—giving you complete control over styling.
[**Animation/Transition**](https://vinicunca.dev/akar/guides/animation)
Animate Akar with CSS keyframes, native Vue Transition or JavaScript animation library of your choice.
[**Controlled State**](https://vinicunca.dev/akar/guides/controlled-state)
How to work with controlled vs. uncontrolled state in Akar.
[**Dates & Times**](https://vinicunca.dev/akar/guides/dates)
How to work with dates and times in Akar.
[**Internationalization (RTL)**](https://vinicunca.dev/akar/guides/i18n)
Akar support both LTR/RTL directions. Learn more about how to integrate internationalization.
[**Inject Context**](https://vinicunca.dev/akar/guides/inject-context)
Utilize `injectContext` to enhance component composition in Akar, enabling powerful and flexible UI development.
[**Server side rendering**](https://vinicunca.dev/akar/guides/server-side-rendering)
Akar can be rendered on the server.
[**Virtualization**](https://vinicunca.dev/akar/guides/virtualization)
Learn how to efficiently render large datasets with Akar, powered by `@tanstack/virtual`.
[**Migration - Radix Vue to Akar**](https://vinicunca.dev/akar/guides/migration)
This guide provides step-by-step instructions for developers transitioning their projects from Radix Vue to Akar.
# Animation/Transition
> Animate Akar with CSS keyframes, native Vue Transition or JavaScript animation library of your choice.
## Animation
Adding animation to Akar should feel similar to any other component, but there are some caveats noted here in regards to exiting animations with JS animation libraries.
## Animating with CSS animation
The simplest way to animate Primitives is with CSS.
You can use CSS animation to animate both mount and unmount phases. The latter is possible because the Akar will suspend unmount while your animation plays out.
```css
@keyframes fadeIn {
from {
opacity: 0;
}
to {
opacity: 1;
}
}
@keyframes fadeOut {
from {
opacity: 1;
}
to {
opacity: 0;
}
}
.DialogOverlay[data-state='open'],
.DialogContent[data-state='open'] {
animation: fadeIn 300ms ease-out;
}
.DialogOverlay[data-state='closed'],
.DialogContent[data-state='closed'] {
animation: fadeOut 300ms ease-in;
}
```
## Animating with Vue Transition
Other than using CSS animation, you might prefer to use the native Vue `Hello from inside the Dialog!
Hello from inside the Dialog!
Hello from inside the Dialog!
Individual `*Portal` components can still override this via their own `to` prop.
Useful when rendering inside a custom element / shadow DOM. |
| `useId` | | `(() => string)` | The global `useId` injection as a workaround for preventing hydration issue. |
[ConfigProvider.vue source](https://github.com/vinicunca/akar/blob/v2.0.20/packages/core/src/ConfigProvider/ConfigProvider.vue)
## Example
Use the config provider.
Set global direction to `rtl`, and scroll body behavior to `false` (will not set any padding/margin).
```vue
Read our [Composition](https://vinicunca.dev/akar/guides/composition) guide for more details. |
| `loop` | `false` | `boolean` | When `true`, tabbing from last item will focus first tabbable
and shift+tab from first item will focus last tababble. |
| `present` | `true` | `boolean` | Whether the scope is currently visible. Lets a consumer keep the scope
mounted but hidden (e.g. `display: none`) and still get correct auto-focus:
the mount auto-focus is skipped while not present, and re-runs when it
becomes present again. Defaults to `true` so consumers that mount the scope
only while visible are unaffected. |
| `trapped` | `false` | `boolean` | When `true`, focus cannot escape the focus scope via keyboard,
pointer, or a programmatic focus. |
**Events**
| Event | Payload | Description |
| --- | --- | --- |
| `mountAutoFocus` | `event: Event` | Event handler called when auto-focusing on mount.
Can be prevented. |
| `unmountAutoFocus` | `event: Event` | Event handler called when auto-focusing on unmount.
Can be prevented. |
[FocusScope.vue source](https://github.com/vinicunca/akar/blob/v2.0.20/packages/core/src/FocusScope/FocusScope.vue)
## Example
Basic usage with focus trapping
```vue
Read our [Composition](https://vinicunca.dev/akar/guides/composition) guide for more details. |
| `currentTabStopId` | | `string \| null` | The controlled value of the current stop item. Can be binded as `v-model`. |
| `defaultCurrentTabStopId` | | `string` | The value of the current stop item.
Use when you do not need to control the state of the stop item. |
| `dir` | | `"ltr" \| "rtl"` | The direction of navigation between items. |
| `loop` | `false` | `boolean` | Whether keyboard navigation should loop around |
| `orientation` | | `"vertical" \| "horizontal"` | The orientation of the group.
Mainly so arrow navigation is done accordingly (left & right vs. up & down) |
| `preventScrollOnEntryFocus` | `false` | `boolean` | When `true`, will prevent scrolling to the focus item when focused. |
**Events**
| Event | Payload | Description |
| --- | --- | --- |
| `entryFocus` | `event: Event` | |
| `update:currentTabStopId` | `value: string \| null` | |
**Methods**
| Method | Type | Description |
| --- | --- | --- |
| `getItems` | `(includeDisabledItem?: boolean) => { ref: HTMLElement; value?: any; }[]` | |
[RovingFocusGroup.vue source](https://github.com/vinicunca/akar/blob/v2.0.20/packages/core/src/RovingFocus/RovingFocusGroup.vue)
| Data attribute | Value |
| --- | --- |
| `[data-orientation]` | "vertical" \\| "horizontal" \\| "null" |
### Item
The item that would inherit the roving tabindex
**Props**
| Prop | Default | Type | Description |
| --- | --- | --- | --- |
| `active` | | `boolean` | When `true`, item will be initially focused. |
| `allowShiftKey` | | `boolean` | When `true`, shift + arrow key will allow focusing on next/previous item. |
| `as` | `"span"` | `AsTag \| Component` | The element or component this component should render as. Can be overwritten by `asChild`. |
| `asChild` | | `boolean` | Change the default rendered element for the one passed as a child, merging their props and behavior.
Read our [Composition](https://vinicunca.dev/akar/guides/composition) guide for more details. |
| `focusable` | `true` | `boolean` | When `false`, item will not be focusable. |
| `tabStopId` | | `string` | |
[RovingFocusItem.vue source](https://github.com/vinicunca/akar/blob/v2.0.20/packages/core/src/RovingFocus/RovingFocusItem.vue)
| Data attribute | Value |
| --- | --- |
| `[data-active]` | Present when not active |
| `[data-disabled]` | Present when not focusable |
| `[data-orientation]` | "vertical" \\| "horizontal" \\| "null" |
## Examples
### Vertical orientation
```vue
This is the {{ item.label }} panel.
{{ item.content }}