GitHubContribution
v1.6.3

Alert
#

Displays a short, important message to attract user attention. If you need to send a notification to users, you can use our Toast component.

When To Use
#

  • When you need to show an important message to users.
  • When you need a static container with some important information which is closable by user actions.

Examples
#

Default
#

The basic usage of the va-alert component.

Open in GitHub

Different styles
#

3 styles are available: color, outlined and border styled alerts.

Open in GitHub

Color
#

Use color property to change the color of the component and text-color to change the textual content color.

Open in GitHub

Border
#

Use the border property to add a strip and the border-color property to change the color of the strip.

Open in GitHub

Dense
#

The dense property reduces paddings on alert.

Open in GitHub

Title
#

The title property allows you to write text over the description area. Use the title slot to costomize the title area.

Open in GitHub

Icon
#

The icon property allows you to add an icon in front of the description area. Use the icon slot to costomize the icon area.

Open in GitHub

Closeable
#

The closeable property add a close alert area. Also you can pass close-text prop to make close icon as plain text.

Dismissible Alert! Click the close button over there โ‡’
You read this important alert message with a custom close icon
You read this important alert message with a text instead of an icon
close
You read this important alert message with a slotted text instead of an icon
close
Open in GitHub

Center
#

The center property allows you to center title and description areas.

Hello World!
You read this important centered alert message
Open in GitHub

API
#

Props #

NameDescriptionTypesDefault
stateful

Add possibility to work with component without setting v-model.

Boolean

false

model-value

The value of the v-model bindings.

Boolean

true

preset

Named preset combination of component props.

String

-

color

Color of the component (theme string or HEX string).

String

"primary"

text-color

Text color (theme string or HEX string).

String

""

title

The text content placed in the title

String

""

description

The text content of the alert

String

""

icon

Show icon in front of alert content

String

""

close-text

Use text instead of the close icon

String

""

closeable

Add a close alert area

Boolean

false

dense

Reduces alert paddings

Boolean

false

outline

Removes background.

Boolean

false

center

Center the title and description of the alert

Boolean

false

border-color

Border color of the alert

String

""

border

Stripe border for alert. top, right, bottom, left sizes are available

String

""

Slots #

NameDescription

default

Content of alert body

title

Alert title area content

icon

Alert icon area content

close

Alert close area content

Methods #

NameDescription

hide

Hides alert (on stateless alert only emits input)

Css Variables #

NameDefault Value
--va-alert-position relative
--va-alert-display flex
--va-alert-align-items center
--va-alert-margin-y 0.25rem
--va-alert-padding-x 0.75rem
--va-alert-padding-y 0.75rem
--va-alert-padding-y-dense 0.25rem
--va-alert-border-width 0
--va-alert-border-radius 4px
--va-alert-box-shadow var(--va-box-shadow)
--va-alert-color transparent
--va-alert-title-font-weight 600
--va-alert-top-border-radius 4px 4px 0 0
--va-alert-right-border-radius 0 4px 4px 0
--va-alert-bottom-border-radius 0 0 4px 4px
--va-alert-left-border-radius 4px 0 0 4px
--va-badge-margin-right 0.5rem
--va-badge-padding-x 0.5rem
--va-badge-padding-y 0.125rem
--va-badge-border-radius 0.5rem
--va-badge-font-size 0.625rem
--va-badge-letter-spacing 0.0625rem
--va-alert-close-padding-x 0.5rem
--va-alert-close-padding-y 0.0625rem
--va-alert-close-font-size 1rem
--va-alert-stripe-border-size var(--va-stripe-border-size)