budibase/packages/bbui/src/TreeView/Item.svelte

42 lines
999 B
Svelte
Raw Normal View History

2021-04-16 16:17:26 +02:00
<script>
export let selected = false
export let open = false
2021-05-14 17:03:37 +02:00
export let href = false
export let title
export let icon
2021-04-16 16:17:26 +02:00
</script>
2021-04-20 16:44:08 +02:00
<li
class:is-selected={selected}
class:is-open={open}
class="spectrum-TreeView-item"
>
2021-05-14 17:03:37 +02:00
<a on:click class="spectrum-TreeView-itemLink" {href}>
{#if $$slots.default}
<svg
class="spectrum-Icon spectrum-UIIcon-ChevronRight100 spectrum-TreeView-itemIndicator"
focusable="false"
aria-hidden="true"
>
<use xlink:href="#spectrum-css-icon-Chevron100" />
</svg>
{/if}
{#if icon}
<svg
class="spectrum-TreeView-itemIcon spectrum-Icon spectrum-Icon--sizeM"
focusable="false"
aria-hidden="true"
aria-label="Layers"
>
<use xlink:href="#spectrum-icon-18-{icon}" />
</svg>
{/if}
<span class="spectrum-TreeView-itemLabel">{title}</span>
</a>
{#if $$slots.default}
<ul class="spectrum-TreeView">
<slot />
</ul>
{/if}
</li>