Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@headlessui/vue

Package Overview
Dependencies
Maintainers
4
Versions
681
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@headlessui/vue

A set of completely unstyled, fully accessible UI components for Vue 3, designed to integrate beautifully with Tailwind CSS.

  • 0.0.0-insiders.f5ac361
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
117K
decreased by-61.92%
Maintainers
4
Weekly downloads
 
Created

What is @headlessui/vue?

@headlessui/vue is a set of completely unstyled, fully accessible UI components for Vue.js, designed to integrate seamlessly with Tailwind CSS. It provides the building blocks for creating custom, accessible UI components without imposing any design decisions.

What are @headlessui/vue's main functionalities?

Dialog (Modal)

The Dialog component is used to create accessible modals. The example demonstrates how to open and close a dialog with a button click.


<template>
  <div>
    <button @click="isOpen = true">Open Dialog</button>
    <Dialog v-if="isOpen" @close="isOpen = false">
      <DialogOverlay />
      <DialogTitle>Payment successful</DialogTitle>
      <DialogDescription>
        Your payment has been successfully submitted. We’ve sent you an email with all of the details of your order.
      </DialogDescription>
      <button @click="isOpen = false">Got it, thanks!</button>
    </Dialog>
  </div>
</template>

<script>
import { ref } from 'vue';
import { Dialog, DialogOverlay, DialogTitle, DialogDescription } from '@headlessui/vue';

export default {
  components: { Dialog, DialogOverlay, DialogTitle, DialogDescription },
  setup() {
    const isOpen = ref(false);
    return { isOpen };
  }
};
</script>

Listbox (Select)

The Listbox component is used to create accessible select dropdowns. The example shows how to bind a list of options to a Listbox and handle selection.


<template>
  <div>
    <Listbox v-model="selectedPerson">
      <ListboxButton>{{ selectedPerson.name }}</ListboxButton>
      <ListboxOptions>
        <ListboxOption v-for="person in people" :key="person.id" :value="person">
          {{ person.name }}
        </ListboxOption>
      </ListboxOptions>
    </Listbox>
  </div>
</template>

<script>
import { ref } from 'vue';
import { Listbox, ListboxButton, ListboxOptions, ListboxOption } from '@headlessui/vue';

export default {
  components: { Listbox, ListboxButton, ListboxOptions, ListboxOption },
  setup() {
    const people = ref([
      { id: 1, name: 'Wade Cooper' },
      { id: 2, name: 'Arlene Mccoy' },
      { id: 3, name: 'Devon Webb' }
    ]);
    const selectedPerson = ref(people.value[0]);
    return { people, selectedPerson };
  }
};
</script>

Popover

The Popover component is used to create accessible popover elements. The example demonstrates a simple popover with a button that reveals a panel of links.


<template>
  <div>
    <Popover>
      <PopoverButton>Solutions</PopoverButton>
      <PopoverPanel>
        <a href="#">Insights</a>
        <a href="#">Automations</a>
        <a href="#">Reports</a>
      </PopoverPanel>
    </Popover>
  </div>
</template>

<script>
import { Popover, PopoverButton, PopoverPanel } from '@headlessui/vue';

export default {
  components: { Popover, PopoverButton, PopoverPanel }
};
</script>

Other packages similar to @headlessui/vue

FAQs

Package last updated on 29 May 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc