Radix Vue Primitives

1.9.17 · active · verified Sun Apr 19

Radix Vue is an unofficial, community-driven Vue 3 port of the popular Radix UI primitives, providing a comprehensive set of unstyled, accessible UI components for building high-quality design systems. The library focuses on robust, headless component logic, enabling developers to fully control styling via CSS, Tailwind CSS, or other solutions. While the npm registry lists version 1.9.17, the recent release notes indicate active development, with versions up to 2.9.6, suggesting a rapid release cadence primarily focused on bug fixes and new feature additions. Key differentiators include its strong emphasis on web accessibility standards, unopinionated styling, and deep integration with the Vue 3 ecosystem, making it a powerful foundation for custom component libraries.

Common errors

Warnings

Install

Imports

Quickstart

This quickstart demonstrates a basic single-item collapsible Accordion component, including its root, item, header, trigger, and content, with inline styling for visual reference.

<script setup lang="ts">
import { AccordionRoot, AccordionItem, AccordionHeader, AccordionTrigger, AccordionContent } from 'radix-vue';
import { ref } from 'vue';

const accordionValue = ref('item-1');
</script>

<template>
  <AccordionRoot
    v-model="accordionValue"
    class="bg-white rounded-md shadow-[0_2px_10px] shadow-black/5 w-[300px]"
    type="single"
    :collapsible="true"
  >
    <AccordionItem
      class="mt-px overflow-hidden first:mt-0 first:rounded-t last:rounded-b focus-within:relative focus-within:z-10 focus-within:shadow-[0_0_0_2px] focus-within:shadow-black"
      value="item-1"
    >
      <AccordionHeader class="flex">
        <AccordionTrigger
          class="text-grass11 shadow-[0_1px_0] shadow-black/0.5 hover:bg-mauve2 flex h-[45px] flex-1 cursor-default items-center justify-between bg-white px-5 text-[15px] leading-none outline-none group"
        >
          Is it accessible?
          <svg
            class="ease-[cubic-bezier(0.87,_0,_0.13,_1)] transition-transform duration-300 group-data-[state=open]:rotate-180"
            width="10" height="10" viewBox="0 0 10 10" aria-hidden="true"
          >
            <polygon points="3,1.5 8.5,5 3,8.5" />
          </svg>
        </AccordionTrigger>
      </AccordionHeader>
      <AccordionContent
        class="text-mauve11 bg-mauve2 data-[state=open]:animate-slideDown data-[state=closed]:animate-slideUp overflow-hidden text-[15px]"
      >
        <div class="py-[15px] px-5">
          Yes. Radix Vue is built on Radix UI's accessible primitives.
        </div>
      </AccordionContent>
    </AccordionItem>

    <AccordionItem
      class="mt-px overflow-hidden first:mt-0 first:rounded-t last:rounded-b focus-within:relative focus-within:z-10 focus-within:shadow-[0_0_0_2px] focus-within:shadow-black"
      value="item-2"
    >
      <AccordionHeader class="flex">
        <AccordionTrigger
          class="text-grass11 shadow-[0_1px_0] shadow-black/0.5 hover:bg-mauve2 flex h-[45px] flex-1 cursor-default items-center justify-between bg-white px-5 text-[15px] leading-none outline-none group"
        >
          Is it unstyled?
          <svg
            class="ease-[cubic-bezier(0.87,_0,_0.13,_1)] transition-transform duration-300 group-data-[state=open]:rotate-180"
            width="10" height="10" viewBox="0 0 10 10" aria-hidden="true"
          >
            <polygon points="3,1.5 8.5,5 3,8.5" />
          </svg>
        </AccordionTrigger>
      </AccordionHeader>
      <AccordionContent
        class="text-mauve11 bg-mauve2 data-[state=open]:animate-slideDown data-[state=closed]:animate-slideUp overflow-hidden text-[15px]"
      >
        <div class="py-[15px] px-5">
          Yes. Radix Vue components provide only the logic and accessibility, you provide the styles.
        </div>
      </AccordionContent>
    </AccordionItem>
  </AccordionRoot>
</template>

view raw JSON →