Socket
Socket
Sign inDemoInstall

@headlessui/vue

Package Overview
Dependencies
Maintainers
2
Versions
670
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@headlessui/vue

@headlessui/vue


Version published
Weekly downloads
316K
decreased by-1.61%
Maintainers
2
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 18 Sep 2020

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