Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/dasdaniel/svelte-listbox

listbox svelte component
https://github.com/dasdaniel/svelte-listbox

Last synced: 3 months ago
JSON representation

listbox svelte component

Awesome Lists containing this project

README

        

## svelte-listbox

A svelte implementation of https://github.com/tailwindui/vue

# WIP

## example use:

```html

// import components
import { Listbox, ListboxButton, ListboxList, ListboxOption } from "svelte-listbox";

// define selection
let selection = null;

// define options
let values = [
{ name: "abc", img: "https://randomuser.me/api/portraits/lego/1.jpg" },
{ name: "def", img: "https://randomuser.me/api/portraits/lego/2.jpg" },
{ name: "ghi", img: "https://randomuser.me/api/portraits/lego/3.jpg" },
{ name: "jkl", img: "https://randomuser.me/api/portraits/lego/4.jpg" },
{ name: "mno", img: "https://randomuser.me/api/portraits/lego/5.jpg" },
{ name: "pqr", img: "https://randomuser.me/api/portraits/lego/6.jpg" },
{ name: "stu", img: "https://randomuser.me/api/portraits/lego/7.jpg" },
{ name: "vwx", img: "https://randomuser.me/api/portraits/lego/8.jpg" }
];

:global(.max-h-14) {
max-height: 14em;
}



{selection !== null ? selection.name : ''}



{#if isOpen}

{#each values as item}


{item.name}
{item.name}

{#if selected}





{/if}

{/each}

{/if}


```