Variants in Message control
27 Feb 20232 minutes to read
The Message has predefined appearance variants for different visual representations. The variants of the message can be changed based on the Variant property.
The available variants are Text, Outlined and Filled. The default variant type for messages is Text.
- Text - The severity is differentiated using a text color and a light background color.
- Outlined - The severity is differentiated using a text color and a border without a background.
- Filled - The severity is differentiated using a text color and a dark background color.
The following example demonstrates the default message with different variant types.
<div class="msg-variant-section">
<div class="msg-content-section">
<h4>Filled</h4>
@Html.EJS().Message("msg-default_filled").Severity(Severity.Normal).Variant(Variant.Filled).Content("Editing is restricted").Render()
@Html.EJS().Message("msg-info_filled").Severity(Severity.Info).Variant(Variant.Filled).Content("Please read the comments carefully").Render()
@Html.EJS().Message("msg-success_filled").Severity(Severity.Success).Variant(Variant.Filled).Content("Your message has been sent successfully").Render()
@Html.EJS().Message("msg-warning_filled").Severity(Severity.Warning).Variant(Variant.Filled).Content("There was a problem with your network connection").Render()
@Html.EJS().Message("msg-error_filled").Severity(Severity.Error).Variant(Variant.Filled).Content("A problem occurred while submitting your data").Render()
</div>
<div class="msg-content-section">
<h4>Outlined</h4>
@Html.EJS().Message("msg-default_outlined").Severity(Severity.Normal).Variant(Variant.Outlined).Content("Editing is restricted").Render()
@Html.EJS().Message("msg-info_outlined").Severity(Severity.Info).Variant(Variant.Outlined).Content("Please read the comments carefully").Render()
@Html.EJS().Message("msg-success_outlined").Severity(Severity.Success).Variant(Variant.Outlined).Content("Your message has been sent successfully").Render()
@Html.EJS().Message("msg-warning_outlined").Severity(Severity.Warning).Variant(Variant.Outlined).Content("There was a problem with your network connection").Render()
@Html.EJS().Message("msg-error_outlined").Severity(Severity.Error).Variant(Variant.Outlined).Content("A problem occurred while submitting your data").Render()
</div>
<div class="msg-content-section">
<h4>Text</h4>
@Html.EJS().Message("msg-default").Severity(Severity.Normal).Content("Editing is restricted").Render()
@Html.EJS().Message("msg-info").Severity(Severity.Info).Content("Please read the comments carefully").Render()
@Html.EJS().Message("msg-success").Severity(Severity.Success).Content("Your message has been sent successfully").Render()
@Html.EJS().Message("msg-warning").Severity(Severity.Warning).Content("There was a problem with your network connection").Render()
@Html.EJS().Message("msg-error").Severity(Severity.Error).Content("A problem occurred while submitting your data").Render()
</div>
</div>
<style>
.msg-variant-section .content-section {
margin: 0 auto;
max-width: 520px;
padding: 10px;
}
.msg-variant-section .e-message {
margin: 10px 0;
}
.msg-variant-section {
display: flex;
}
</style>