Gives your own fields the AstrolUI look and adds an action button to them.
AstrolUI does not change your app's fields: a bare <input> looks the way the browser draws it. AstrolContentInput is the wrapper that gives them the AstrolUI look: same height as the buttons (38 px), theme border and radius, a stronger border on hover and a focus ring in the theme color while typing. It works with input, textarea, select and Blazor's components (InputText, InputNumber, InputSelect, InputTextArea...).
Click the fields in each column to see the difference:
@using Astrol.Component.Basic.Form @* Without the wrapper: the browser's own field *@<input type="text" placeholder="Name" /> @* With the wrapper: AstrolUI look (border, height, radius, hover and focus ring in the theme color) *@<AstrolContentInput> <input type="text" placeholder="Name" /></AstrolContentInput><AstrolContentInput> <textarea placeholder="Comment"></textarea></AstrolContentInput>With Icon a button appears on the right of the field (the text leaves room for it) and OnClickIcon runs when it is pressed: clear, search, call, copy... Set IconAriaLabel for screen readers. AstrolInputPassword uses this same button to show or hide the password.
<AstrolContentInput Icon="astrol-cancel" IconAriaLabel="Clear" OnClickIcon="() => name = string.Empty"> <input type="text" placeholder="Name" @bind="name" @bind:event="oninput" /></AstrolContentInput><AstrolContentInput Icon="astrol-phone" IconAriaLabel="Call" OnClickIcon="Call"> <input type="tel" placeholder="Phone" @bind="phone" /></AstrolContentInput>Wrap Blazor's form components just like an input. When validation marks the field as invalid, the border turns red. FocusRing="false" removes the focus ring and HasShadow="false" the shadow, for quieter fields. Submit the empty form to see validation.
<EditForm Model="contact" OnValidSubmit="Save"> <DataAnnotationsValidator /> <AstrolContentInput> <InputText @bind-Value="contact.Email" placeholder="Email" /> </AstrolContentInput> <ValidationMessage For="() => contact.Email" /> <AstrolContentInput> <InputSelect @bind-Value="contact.Topic"> ... </InputSelect> </AstrolContentInput> <AstrolContentInput FocusRing="false" HasShadow="false"> <InputTextArea @bind-Value="contact.Message" /> </AstrolContentInput> <AstrolButton Type="ButtonType.Submit" Text="Save" Icon="astrol-floppy" /></EditForm>If you don't need the icon button, put the aui-input (or aui-textarea) class directly on the field and it gets the same look.
@* Same look without the wrapper (no icon button and no extra margin) *@<input class="aui-input" placeholder="Search" /><textarea class="aui-textarea"></textarea><InputText class="aui-input" @bind-Value="model.Name" />