component Badge { outputs { dismiss(payload: { sourceEvent?: Event; [key: string]: string | number | boolean | null | object }) } props { label: string = "Badge" size: string = "md" color: string = "primary" variant: string = "solid" shape: string = "pill" class: string = "" icon: string = "" iconPosition: string = "start" dot: boolean = false dotOnly: boolean = false dotLabel: string = "Status" animated: boolean = false avatarSrc: string = "" avatarAlt: string = "" dismissible: boolean = false dismissLabel: string = "Remove badge" truncate: boolean = false maxWidth: string = "12rem" anchorLabel: string = "" anchorIcon: string = "" placement: string = "inline" anchorLabelText: string = "Badge anchor" } state visible: boolean = true functions { client function dismissBadge(sourceEvent, root, customEvent) { visible = false root = sourceEvent.currentTarget.closest("[data-wrn-badge]") customEvent = document.createEvent("CustomEvent") customEvent.initCustomEvent("dismiss", true, false, { component: "Badge", label: label }) root.dispatchEvent(customEvent) } } view { {#if anchorLabel || anchorIcon} {/if} {#if animated} {/if} {#if avatarSrc} {avatarAlt} {/if} {#if dot || dotOnly} {/if} {#if icon && iconPosition === "start"} {/if} {#if !dotOnly} {label} {/if} {#if icon && iconPosition === "end"} {/if} {#if dismissible} {/if} } }