Skip to content
RTL Support: Full
Accessibility: Full
Translations: Not Needed

Alert

Alert component for displaying important messages to users

Basic Usage

Vue
html
<template>
  <HLAlert
    title="Title"
    :actionOne="{
    text: 'Action 1',
    iconLeft: EyeIcon
  }"
    :actionTwo="{
    text: 'Action 2',
    iconRight: ArrowRightIcon
  }"
  >
    Alert description
  </HLAlert>
</template>
<script setup lang="ts">
  import { ArrowRightIcon, EyeIcon } from '@gohighlevel/ghl-icons/24/outline'
  import { HLAlert } from '@platform-ui/highrise'
</script>

Colors

Vue
html
<template>
  <HLAlert color="white" title="Default Alert" type="alert">Alert Content</HLAlert>
  <HLAlert color="blue" title="Info Alert" type="alert">Alert Content</HLAlert>
  <HLAlert color="green" title="Success Alert" type="alert">Alert Content</HLAlert>
  <HLAlert color="red" title="Error Alert" type="alert">Alert Content</HLAlert>
  <HLAlert color="orange" title="Warning Alert" type="alert">Alert Content</HLAlert>
  <HLAlert color="gray" title="Gray Alert" type="alert">Alert Content</HLAlert>
</template>
<script setup>
  import { HLAlert } from '@platform-ui/highrise'
</script>

With Actions

Vue
html
<template>
  <HLAlert
    title="Alert with Actions"
    :actionOne="{
    text: 'This is a button',
    iconLeft: EyeIcon,
    onActionClick: () => console.log('action one clicked')
  }"
    :actionTwo="{
    text: 'This is a link with icon',
    iconRight: ArrowRightIcon,
    link: 'https://www.example.com'
  }"
    type="alert"
  >
    Alert with action buttons
  </HLAlert>
</template>
<script setup>
  import { HLAlert } from '@platform-ui/highrise'
</script>

Auto Close

Vue
html
<template>
  <HLAlert title="Auto Close Alert" :autoClose="30000"> This alert will close automatically after 30 seconds </HLAlert>
</template>
<script setup>
  import { HLAlert } from '@platform-ui/highrise'
</script>

Notification

See Notification.

Accessibility

  • Set role="alert" (or role="status" for passive notices) so the message announces immediately, and point aria-labelledby at the heading text.
  • Attach body copy or remediation steps through aria-describedby.
  • Give dismiss buttons an aria-label that references the alert content (e.g., "Dismiss billing alert").

Imports

ts
import { HLAlert } from '@platform-ui/highrise'

Props

NameTypeDefaultDescription
id *string | undefinedundefinedUnique identifier for the alert
color'white' | 'blue' | 'green' | 'red' | 'orange' | 'gray''white'Color variant of the alert
closablebooleantrueWhether the alert can be closed
titlestring | undefinedundefinedTitle text of the alert
rolestring'alert'ARIA role for accessibility
autoCloseboolean | numberfalseAuto close duration in milliseconds
actionOneActionProps | undefinedundefinedPrimary action configuration
actionTwoActionProps | undefinedundefinedSecondary action configuration
widthstringundefinedWidth of the alert
heightstringundefinedHeight of the alert
maxHeightstringundefinedMax height of the alert
maxWidthstring540pxMax width of the alert
type'alert' | 'notification''alert'Type of the alert
contentstring | undefinedundefinedContent of the alert

Types

ActionProps

ts
interface ActionProps {
  text: string
  iconLeft?: Component
  iconRight?: Component
  link?: string
  disabled?: boolean
  loading?: boolean
  ariaLabel?: string
  onActionClick?: () => void
}

Slots

NameParametersDescription
defaultundefinedContent text of the alert
iconundefinedIcon of the alert

Emits

NameParametersDescription
@close(id: string)Emitted when alert is closed
@actionOne(event: Event)Emitted when primary action is clicked
@actionTwo(event: Event)Emitted when secondary action is clicked