Alert
Levels
Danger Alert
More info about this danger alert goes here. This example text is going to
run a bit longer, so that you can see how spacing within an alert works
with this kind of content.
Info Alert
More info about this info alert goes here. This example text is going to
run a bit longer, so that you can see how spacing within an alert works
with this kind of content.
Success Alert
More info about this success alert goes here. This example text is going
to run a bit longer, so that you can see how spacing within an alert works
with this kind of content.
Warning Alert
More info about this warning alert goes here. This example text is going
to run a bit longer, so that you can see how spacing within an alert works
with this kind of content.
<DemoSpaceY>
<VelvetAlert @level="danger">
<:title>
Danger Alert
</:title>
<:content>
More info about this danger alert goes here. This example text is going to
run a bit longer, so that you can see how spacing within an alert works
with this kind of content.
</:content>
</VelvetAlert>
<VelvetAlert @level="info">
<:title>
Info Alert
</:title>
<:content>
More info about this info alert goes here. This example text is going to
run a bit longer, so that you can see how spacing within an alert works
with this kind of content.
</:content>
</VelvetAlert>
<VelvetAlert @level="success">
<:title>
Success Alert
</:title>
<:content>
More info about this success alert goes here. This example text is going
to run a bit longer, so that you can see how spacing within an alert works
with this kind of content.
</:content>
</VelvetAlert>
<VelvetAlert @level="warning">
<:title>
Warning Alert
</:title>
<:content>
More info about this warning alert goes here. This example text is going
to run a bit longer, so that you can see how spacing within an alert works
with this kind of content.
</:content>
</VelvetAlert>
</DemoSpaceY>
Custom Icons
Danger Alert
More info about this danger alert goes here. This example text is going to
run a bit longer, so that you can see how spacing within an alert works with
this kind of content.
<VelvetAlert @level="danger">
<:icon as |icon|>
<VelvetIcon::XMark class={{icon.class}} />
</:icon>
<:title>
Danger Alert
</:title>
<:content>
More info about this danger alert goes here. This example text is going to
run a bit longer, so that you can see how spacing within an alert works with
this kind of content.
</:content>
</VelvetAlert>
Examples
Handle Hide Events
Edit this demoUse the @onHide
argument to handle hide
events.
Info Alert
More info about this info alert goes here. This example text is going to
run a bit longer, so that you can see how spacing within an alert works
with this kind of content.
<DemoSpaceY {{velvet-auto-animate}}>
{{#if this.isShown}}
<VelvetSwitch
@isChecked={{this.isHideable}}
@onChange={{this.setIsHideable}}
>
Hideable
</VelvetSwitch>
<VelvetAlert
@isHideable={{this.isHideable}}
@level="info"
@onHide={{this.onHide}}
>
<:title>
Info Alert
</:title>
<:content>
More info about this info alert goes here. This example text is going to
run a bit longer, so that you can see how spacing within an alert works
with this kind of content.
</:content>
</VelvetAlert>
{{else}}
<VelvetButton @onClick={{this.showAlert}} @variant="primary" class="w-fit">
Show Alert
</VelvetButton>
{{/if}}
</DemoSpaceY>
Signature
Element
HTMLDivElement
Blocks
Name | Description | Type |
---|---|---|
:content * | The content of the alert. | [] |
:icon | The icon of the alert. | [{
class: 'velvet-alert-icon';
}] |
:title * | The title of the alert. | [] |
Arguments
Name | Description | Type | Default Value |
---|---|---|---|
@isHideable | Indicate if the alert is hideable. | boolean | false |
@level * | The level of the alert. | 'danger' | 'info' | 'success' | 'warning' | undefined |
@onHide | Handle the alert's `hide` event. | () => void | undefined |