Aaltuj / VxFormGenerator

The library contains a component, that nests itself into the Blazor EditForm instead of a wrapper around the EditForm. The component is able to generate a form based on a POCO or a ExpandoObject. Because of this architecture the library provides the developer flexibility and direct usage of the EditForm.
MIT License
119 stars 36 forks source link

Added tooltip component for Description property in Display Attribute #33

Closed jakubwalawender closed 2 years ago

jakubwalawender commented 2 years ago

Added a tooltip component which appears by the label when Description property in Display attribute is set. After hovering an icon it displays a text from Description.

A Description for a property: image image

A Description for a whole row (works with either TOP or LEFT alignment): image image image

Aaltuj commented 2 years ago

Hi Jakub Thanks for your pull-request. i like the addition. I have some remarks before I can merge it. Could you make the Tooltip a RenderFragment. And that can be set in the RenderFormElements component.

<EditForm Model="Model" 
          OnValidSubmit="HandleValidSubmit"
          OnInvalidSubmit="HandleInValidSubmit">
    <DataAnnotationsValidator></DataAnnotationsValidator>
    <RenderFormElements>
             <LabelDescriptionTemplate >
                      <Tooltip Text="@FormColumnDefinition.RenderOptions.Description">
                           <div>(<i class="oi oi-info small"></i>)</div>
                      </Tooltip>
             </LabelDescriptionTemplate >
    </RenderFormElements>       
    <button class="btn btn-primary" type="submit">Submit</button>
</EditForm>

You can set the implementation for the Components.Plain version below. This is framework agnostic.

if(LabelDescriptionTemplate ==null){
<Tooltip Text="@FormColumnDefinition.RenderOptions.Description">
                    <div>ℹ</div>
 </Tooltip>
} else{
@RenderLabelDescriptionTemplate()
}

Than you should set your implementation as a default in the Components.Bootstrap:

if(LabelDescriptionTemplate ==null){
<Tooltip Text="@FormColumnDefinition.RenderOptions.Description">
                    <div>(<i class="oi oi-info small"></i>)</div>
                </Tooltip>>
} else{
@RenderLabelDescriptionTemplate()
}

And could you please update the Readme.md with an example of the description below the Layout paragraph.

Sorry for the delay, but hadn't the time to review your code.

Kind regards, Alex

stale[bot] commented 2 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.