mirror of
https://github.com/carbon-design-system/carbon-components-svelte.git
synced 2025-09-16 02:41:05 +00:00
49 lines
942 B
Svelte
49 lines
942 B
Svelte
<script>
|
|
/**
|
|
* Set to `true` to use as a header
|
|
* @type {boolean} [head=false]
|
|
*/
|
|
export let head = false;
|
|
|
|
/**
|
|
* Set to `true` to render a label slot
|
|
* @type {boolean} [label=false]
|
|
*/
|
|
export let label = false;
|
|
|
|
/**
|
|
* Specify the tabindex
|
|
* @type {string} [tabindex="0"]
|
|
*/
|
|
export let tabindex = "0";
|
|
</script>
|
|
|
|
{#if label}
|
|
<!-- svelte-ignore a11y-label-has-associated-control -->
|
|
<label
|
|
role="presentation"
|
|
tabindex="{tabindex}"
|
|
class:bx--structured-list-row="{true}"
|
|
class:bx--structured-list-row--header-row="{head}"
|
|
{...$$restProps}
|
|
on:click
|
|
on:mouseover
|
|
on:mouseenter
|
|
on:mouseleave
|
|
on:keydown
|
|
>
|
|
<slot />
|
|
</label>
|
|
{:else}
|
|
<div
|
|
class:bx--structured-list-row="{true}"
|
|
class:bx--structured-list-row--header-row="{head}"
|
|
{...$$restProps}
|
|
on:click
|
|
on:mouseover
|
|
on:mouseenter
|
|
on:mouseleave
|
|
>
|
|
<slot />
|
|
</div>
|
|
{/if}
|