npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@frankhoodbs/combobox-cmp

v1.2.3

Published

Dropdown component

Downloads

502

Readme

Combobox Component

A flexible and accessible combobox component tailored for Vue 3. This combobox is designed for both visual appeal and usability, adhering to ARIA guidelines. The component is extensible, allowing for easy integration and customization of its design to match your project.

Version License

Generic types

  • T: The currently selected value from the combobox options. T can be of any type, based on the types of values you've provided within your options. Often, T will match the value type within the Option interface.

  • Option object must extend the following interface:

interface OptionItem {
  label: string;
  value: T;
  [key: string]: any;
}

This means that while every option object must have at least the value and label properties, it can also have additional properties.

Props

| Prop | Type | Default | Description | |----------------------------|--------------------------------------------------------------------------------------|----------------|-----------------------------------------------------------------------------------------------------| | model-value | T | - | The current value of the combobox | | data-options | OptionItem[] | - | Array of options for the combobox | | data-id-prefix | string | - | required Prefix for all the id attributes | | data-aria-labelledby | string | - | The ID of the element that labels the combobox | | data-disabled | boolean | false | Whether the combobox is disabled or not | | data-invalid | boolean | false | If true, indicates the combobox's value is invalid | | data-placement | @floating-ui Placement | bottom-start | Placement of the combobox list relative to the combobox | | data-fallback-placements | @floating-ui Placement[] | - | Array of alternative placements for the floating menu in case the desired placement is not possible | | data-offset | number | 0 | Offset (in pixels) between the button and the floating menu |

Events

| Event | Payload Type | Description | |---------------------|--------------|----------------------------------------------------| | 'update:modelValue' | T | Emits the selected value from the combobox options |

Slots

| Slot | Props | Description | |----------|------------------------------------------------------------|--------------------------------------------------| | combobox | { label: string, expanded: boolean, option: OptionItem } | Slot for customizing the combobox content | | option | { option: OptionItem, index: number } | Slot for customizing individual combobox options |

CSS Custom Properties

| Custom Property | Default Value | Description | |---------------------------------------------|---------------|-------------------------------------------| | --combobox-cmp-combobox-background | transparent | Background of the combobox | | --combobox-cmp-combobox-color | black | Text color of the combobox | | --combobox-cmp-combobox-border-width | 0px | Width of the combobox border | | --combobox-cmp-combobox-border-color | transparent | Color of the combobox border | | --combobox-cmp-combobox-border-radius | 0px | Border radius of the combobox | | --combobox-cmp-disabled-opacity | 0.5 | Opacity of the combobox when disabled | | --combobox-cmp-listbox-background | white | Background of the combobox list | | --combobox-cmp-listbox-color | black | Text color of the combobox list | | --combobox-cmp-listbox-border-width | 1px | Width of the combobox list border | | --combobox-cmp-listbox-border-color | black | Color of the combobox list border | | --combobox-cmp-listbox-border-radius | 4px | Border radius of the combobox list | | --combobox-cmp-listbox-max-height | 200px | Maximum height of the combobox list | | --combobox-cmp-option-active-background | grey | Background of an active or hovered option | | --combobox-cmp-option-selected-background | yellow | Background of a selected option | | --combobox-cmp-transition-duration | 0.3s | Transition duration | | --combobox-cmp-transition-timing-function | ease-in-out | Transition timing function | | --combobox-cmp-listbox-width | 100% | Width of the combobox list | | --combobox-cmp-listbox-min-width | 0 | Minimum width of the combobox list | | --combobox-cmp-listbox-max-width | none | Maximum width of the combobox list | | --fh-color-outline | red | Outline color for the active option | | --fh-size-outline | 3px | Outline size for the active option | | --fh-size-outline-offset | 1px | Outline offset size for the active option |