Skip to main content

Alert

The ty-alert component is designed to capture the user's attention and convey important information. The component is highly customizable with several visual variants like 'info', 'success', 'error', and 'warning'.

Usage​

To include ty-alert in your project, you can use the following HTML structure:

Live Editor
<ty-alert title="Important Information"> This is your alert content. </ty-alert>
Result
Loading...

Neutral Alert​

The neutral variant is the default style that provides a balanced, understated look.

General Information

<ty-alert variant="neutral" title="Neutral Alert">
General Information
</ty-alert>

Info Alert​

Use this variant to display informational messages.

Informational Message

<ty-alert variant="info" title="Info Alert"> Informational Message </ty-alert>

Success Alert​

Use this variant to indicate a successful operation or task.

Operation Successful

<ty-alert variant="success" title="Success Alert">
Operation Successful
</ty-alert>

Error Alert​

Use this variant to indicate an error or unsuccessful operation.

Something went wrong

<ty-alert variant="error" title="Error Alert"> Something went wrong </ty-alert>

Warning Alert​

Use this variant to indicate a warning or potential issue.

Caution: Proceed with Care

<ty-alert variant="warning" title="Warning Alert">
Caution: Proceed with Care
</ty-alert>

API​

Properties​

NameDescription TypeTypeDefault
variantSets the alert type'neutral', 'info', 'success', 'error', 'warning''neutral'
titleSets the alert titleString''
hiddenOnCloseDetermines if the alert should be hidden when closedBooleanfalse

Methods​

NameDescription
show()Makes the alert visible
hide()Makes the alert hidden

Events​

NameDescription
'ty-close'Emit event when the alert is closed