Vapor mode

Use Akar components in a Vue Vapor app with the experimental `akar/vapor` entry.
akar/vapor is experimental. It needs a Vue 3.6 prerelease and can change in a minor release.

Overview

Vapor mode is a Vue 3.6 compilation mode that renders without a virtual DOM. akar/vapor is Akar's components compiled a second time in Vapor mode. The parts, props, emits, slots and data attributes are the same as in akar.

Requirements

  • vue 3.6.0-rc.16 or later. With an older Vue, the import throws an error that says which version it needs.
  • An ES module import. require('akar/vapor') throws.
  • The client only. Vapor components need a DOM, so the server build of akar/vapor throws. For server-side rendering, import from akar.

Usage

Import from akar/vapor in a Vapor component (<script setup vapor>), and mount the app with createVaporApp.

<script setup vapor lang="ts">
import { CollapsibleContent, CollapsibleRoot, CollapsibleTrigger } from 'akar/vapor';
import { ref } from 'vue';

const open = ref(false);
</script>

<template>
  <CollapsibleRoot v-model:open="open">
    <CollapsibleTrigger>Toggle</CollapsibleTrigger>
    <CollapsibleContent>Content</CollapsibleContent>
  </CollapsibleRoot>
</template>
main.ts
import { createVaporApp } from 'vue';
import App from './App.vue';

createVaporApp(App).mount('#app');

asChild, as, v-model and the composables useForwardProps, useForwardPropsEmits, useEmitAsProps and useForwardExpose work as in akar. Import them from akar/vapor too.

Available components

A family is added to akar/vapor only when its tests pass in Vapor mode. These families are available:

Accordion, AlertDialog, AspectRatio, Avatar, Checkbox, Collapsible, Combobox, ConfigProvider, ContextMenu, Dialog, DropdownMenu, Editable, HoverCard, Label, Listbox, Menubar, NavigationMenu, NumberField, Pagination, PinInput, Popover, Primitive, Progress, RadioGroup, ScrollArea, Select, Separator, Slider, Splitter, Stepper, Switch, Tabs, TagsInput, Toast, Toggle, ToggleGroup, Tooltip and Tree.

The other families (the calendars, date and time fields, pickers, Carousel, the color components, Drawer, Field, Form, Rating, TagGroup and others) are not available in Vapor mode yet. Import them from akar in a VDOM component.