page Alertcomponent { seo { title = "Alert component" description = "Reusable alert component." } view {
W WRNexusJS
feedback component

Alert

Reusable alert component.

@wrnexus/ui 0.2.725 props1 slots1 events

Usage

Components are auto-discovered. Use the component directly in any .wrn view:

<Alert
  title="Notice"
  description="description"
  variant="info"
  dismissible="false"
/>

Legacy mount name: data-component="Alert".

Props and attributes

PropTypeRequirementDefault
classstringOptional""
titlestringOptional"Notice"
descriptionstringOptional""
variantstringOptional"info"
dismissiblebooleanOptionalfalse

Slots

  • default

Events

  • click

Source contract

Installed source: components/Alert.wrn

component Alert {
  props {
    class = ""
    title = "Notice"
    description = ""
    variant = "info"
    dismissible = false
  }

  state visible = true

  view {
        <aside data-show="visible" role="alert" class="wire-alert wire-alert--{variant} wire-alert--rich {class}">
        <span class="wire-alert__icon" aria-hidden="true">
        </span>
        <div class="wire-alert__content">
          {#if title}<h3 class="wire-alert__title">{title}</h3>{/if}
          {#if description}<p class="wire-alert__body">{description}</p>{/if}
          <slot />
        </div>
        {#if dismissible}<button type="button" aria-label="Dismiss" @click="visible = false" class="wire-alert__dismiss">×</button>{/if}
      </aside>
    }
}
} }