UNPKG

compote-ui

Version:

An opinionated UI component library for Svelte, built on top of [Ark UI](https://ark-ui.com) with additional components and features not available in the core Ark UI library.

18 lines (17 loc) 717 B
import { createListCollection as arkCreateListCollection, createTreeCollection as arkCreateTreeCollection } from '@ark-ui/svelte/collection'; export function createListCollection(items) { return arkCreateListCollection({ items, itemToValue: (item) => item.value.toString(), itemToString: (item) => item.label, isItemDisabled: (item) => item.disabled === true }); } export function createTreeCollection(items) { return arkCreateTreeCollection({ nodeToValue: (node) => node.value.toString(), nodeToString: (node) => node.label, nodeToChildren: (node) => (node.children ?? []), rootNode: { value: 'ROOT', label: '', children: items } }); }