Menu

Change language

GitHub repo

List

listui

List and Item row primitives with List, ListItem, ListItemMedia, ListItemContent, ListItemTitle, ListItemDescription, ListItemActions, and ListSubheader for structured rows, settings lists, and feeds.

Installation

$npx shadcn-svelte@latest add https://uipkge.dev/r/svelte/list.json
Manifest:https://uipkge.dev/r/svelte/list.jsonInstalls to:src/lib/components/ui/list/

Examples

Loading interactive previews…

Props

NameType / ValuesDefaultRequired
as'ul' | 'ol' | 'div'uloptional
childrenSnippet—optional
refHTMLElement | null—optional

Files installed (9)

  • src/lib/components/ui/list/List.svelte0.9 kB
    <script lang="ts" module>
      import type { Snippet } from 'svelte'
      import type { HTMLAttributes } from 'svelte/elements'
    
      export interface ListProps extends HTMLAttributes<HTMLElement> {
        as?: 'ul' | 'ol' | 'div'
        children?: Snippet
        ref?: HTMLElement | null
      }
    </script>
    
    <script lang="ts">
      import { cn } from '$lib/utils'
    
      let { class: className, as = 'ul', children, ref = $bindable(null), ...restProps }: ListProps = $props()
    
      const listClass = $derived(cn('list-none space-y-1', className))
    </script>
    
    {#if as === 'ol'}
      <ol bind:this={ref} data-uipkge="" data-slot="list" class={listClass} {...restProps}>
        {@render children?.()}
      </ol>
    {:else if as === 'div'}
      <div bind:this={ref} data-uipkge="" data-slot="list" class={listClass} {...restProps}>
        {@render children?.()}
      </div>
    {:else}
      <ul bind:this={ref} data-uipkge="" data-slot="list" class={listClass} {...restProps}>
        {@render children?.()}
      </ul>
    {/if}
    
  • src/lib/components/ui/list/ListItem.svelte2.1 kB
  • src/lib/components/ui/list/ListItemMedia.svelte0.6 kB
  • src/lib/components/ui/list/ListItemContent.svelte0.6 kB
  • src/lib/components/ui/list/ListItemTitle.svelte0.6 kB
  • src/lib/components/ui/list/ListItemDescription.svelte0.6 kB
  • src/lib/components/ui/list/ListItemActions.svelte0.6 kB
  • src/lib/components/ui/list/ListSubheader.svelte0.6 kB
  • src/lib/components/ui/list/index.ts0.7 kB

Raw manifest:https://uipkge.dev/r/svelte/list.json