component Card { props { @event click = function @event action = function @event navigate = function @event dismiss = function @event load = function @event error = function title = "Card title" subtitle = "" description = "" header = "" footer = "" imageSrc = "" imageAlt = "" imagePosition = "top" actionLabel = "" actionHref = "" headerActions = [] navigation = [] activeNav = "" mobileNavigation = false alertTitle = "" alertDescription = "" empty = false emptyTitle = "No data to show" emptyIcon = "icon-[lucide--inbox]" items = [] size = "md" color = "primary" variant = "default" layout = "vertical" align = "left" hover = "none" scrollable = false maxHeight = "18rem" dismissible = false ariaLabel = "" class = "" } state dismissed = false functions { function dispatchCardNavigation(sourceEvent, item, index, root, customEvent) { root = sourceEvent.currentTarget.closest("[data-wrn-card]") if (!root) { return } customEvent = document.createEvent("CustomEvent") customEvent.initCustomEvent("navigate", true, false, { component: "Card", item: item, index: index }) root.dispatchEvent(customEvent) } function dispatchCardNavigationValue(sourceEvent, root, customEvent) { root = sourceEvent.currentTarget.closest("[data-wrn-card]") if (!root) { return } customEvent = document.createEvent("CustomEvent") customEvent.initCustomEvent("navigate", true, false, { component: "Card", value: sourceEvent.currentTarget.value }) root.dispatchEvent(customEvent) } function dispatchCardHeaderAction(sourceEvent, action, index, root, customEvent) { root = sourceEvent.currentTarget.closest("[data-wrn-card]") if (!root) { return } customEvent = document.createEvent("CustomEvent") customEvent.initCustomEvent("action", true, false, { component: "Card", action: action, index: index }) root.dispatchEvent(customEvent) } function dismissCard(sourceEvent, root, customEvent) { dismissed = true root = sourceEvent.currentTarget.closest("[data-wrn-card]") if (!root) { return } customEvent = document.createEvent("CustomEvent") customEvent.initCustomEvent("dismiss", true, false, { component: "Card", title: title }) root.dispatchEvent(customEvent) } } view {
{#if items.length > 0}
{#each items as item, itemIndex}
{#if item.imageSrc || item.image}
{item.imageAlt || item.alt || ""}
{/if}
{#if item.title || item.label}

{item.title || item.label}

{/if} {#if item.subtitle}

{item.subtitle}

{/if} {#if item.description}

{item.description}

{/if} {#if item.actionLabel || item.href} {item.actionLabel || "Learn more"} {/if}
{/each}
{:else} {/if}
} }