Table of contents
Decorating the component with optional attributes
When you were adding your custom component to a page, you might have noticed that it showed up under "Uncategorized" and that it's name was just the same as the name of the Razor component file. It also had a very generic cog icon. We can easily change all that by decorating the component using optional attributes, both using standard .NET attributes and some Veva specific ones.
We'll start by giving the component a more friendly name, a description and a category. We use standard .NET attributes to do that, the [DisplayName], [Description] and [Category] attributes. You can just place them below the LisaComponent attribute we already had:
@attribute [LisaComponent("{70D9FB01-5EAB-425D-9E7D-423BF8C078FE}")]
@attribute [DisplayName("My Custom Component")]
@attribute [Description("My first custom component for learning purposes")]
@attribute [Category("My Components")]
@using Lisa.Core.Domain.Components;
@using Lisa.Core.Domain.Attributes;
@using System.ComponentModel;
@attribute [LisaComponent("{70D9FB01-5EAB-425D-9E7D-423BF8C078FE}"), DisplayName("My Custom Component"), Description("My first custom component for learning purposes"), Category("My Components"), Icon("fas fa-car")]
@code {
}