New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Rework adornments [Multiple, Start+End, Reusable, etc] #8945
Comments
Thanks for wanting to do a PR, @danielchalmers ! We try to merge all non-breaking bugfixes and will deliberate the value of new features for the community. Please note there is no guarantee your pull request will be merged, so if you want to be sure before investing the work, feel free to contact the team first. |
@henon @ScarletKuro Thoughts? |
That sounds like a dream. The clear button I am a bit split about, you gain the ability to completely customize it but might be a bit to much for simple use cases. Using a nullable value and just having to set one property is really simple. Also some browser add clear buttons on there own, so the user is already trained to find the cear button at the end of the field. |
Yes, but let's make it simply
Both a good idea. People can move these properties straight to the
Awesome. I still think for the name singular (
I'd rather keep the
Yes of course! |
@henon If we want to support all types then does it make sense to skip <div class="d-flex">
<MudTextField @bind-Value="Amount" Label="Amount" Variant="Variant.Text">
<AdornmentStart>
<MudIcon Icon="@Icons.Material.Filled.AttachMoney" />
</AdornmentStart>
</MudTextField>
<MudTextField @bind-Value="Weight" HelperText="Weight" Variant="Variant.Text" Class="mx-8">
<AdornmentEnd>
<MudText> Kg </MudText>
</AdornmentEnd>
</MudTextField>
<MudTextField @bind-Value="Password" Label="Password" Variant="Variant.Text" InputType="@PasswordInput">
<AdornmentEnd>
<MudIconButton Icon="@PasswordInputIcon" Edge="Edge.End" OnClick="ButtonTestclick" AriaLabel="Show Password" />
</AdornmentEnd>
</MudTextField>
</div>
<div class="d-flex">
<MudTextField @bind-Value="Amount" Label="Amount" Variant="Variant.Filled">
<AdornmentStart>
<MudIconButton Icon="@Icons.Material.Filled.AttachMoney" Edge="Edge.Start" />
</AdornmentStart>
</MudTextField>
<MudTextField @bind-Value="Weight" HelperText="Weight" Variant="Variant.Filled" Class="mx-8">
<AdornmentEnd>
<MudText> Kg </MudText>
</AdornmentEnd>
</MudTextField>
<MudTextField @bind-Value="Password" Label="Password" Variant="Variant.Filled" InputType="@PasswordInput">
<AdornmentEnd>
<MudIconButton Icon="@PasswordInputIcon" Edge="Edge.End" OnClick="ButtonTestclick" AriaLabel="Show Password" />
</AdornmentEnd>
</MudTextField>
</div>
<div class="d-flex">
<MudTextField @bind-Value="Amount" Label="Amount" Variant="Variant.Outlined">
<AdornmentEnd>
<MudIconButton Icon="@Icons.Material.Filled.AttachMoney" Edge="Edge.End" />
</AdornmentEnd>
</MudTextField>
<MudTextField @bind-Value="Weight" HelperText="Weight" Variant="Variant.Outlined" Class="mx-8">
<AdornmentEnd>
<MudText> Kg </MudText>
</AdornmentEnd>
</MudTextField>
<MudTextField @bind-Value="Password" Label="Password" Variant="Variant.Outlined" InputType="@PasswordInput">
<AdornmentEnd>
<MudIconButton Icon="@PasswordInputIcon" Edge="Edge.End" OnClick="ButtonTestclick" AriaLabel="Show Password" />
</AdornmentEnd>
</MudTextField>
</div> Takes a bit of extra setup but is a lot more flexible and easier to maintain |
@dennisrahmen I think you're both right that it should be a bool for ease of use 💯 Do you have any thoughts on the sample code I posted in my last comment? Basically skipping the rigid adornment type altogether so you can use chips etc |
@danielchalmers I think your idea with directly adding the other components is good but I would at least have one For example the So when I just want a icon at the end of my form and nothing else I would use |
Oh, and does this work well with all the margins/padding of for example the For example having a Icon at the start and a chip or icon button at the end. |
@dennisrahmen Great points. I was thinking we can use cascading values like the MudForm to pass down disabled, readonly, etc. Maybe we should pick a few elements that make sense and build them directly into MudAdornment. But how do pass the information to it as a renderfragment except for cascading? Which elements would we want as adornments? |
We better merge it into a single class that holds it, otherwise multiple mutable cascading values will hit the performance really hard. |
Yep. For instance, we already have RightToLeft cascading parameter that permeates all GUI. We could go from this to an extensible cascading context with properties for |
@henon @ScarletKuro Interesting, didn't know that. Do you have thoughts on how to actually write the implementation for that and the new adornment system? Should I spin it off into a separate issue? I'm a bit lost atm but would like to give it a shot |
It is just an optimization and can be done separately. Let's not loose ourselves in the details, focus on the adornment render fragments first and the optimization can be done later. |
@henon I guess it won't work though because IconButton doesn't have any CascadingParameters |
We can always add them if needed. |
@henon Wouldn't that mean we would have to set CascadingParameters on all basic components in the library in case they want to be used as adornment (obviously not ones like Dialog, Picker, Table)? |
We should not forget all the edge cases. I would keep this simple for now with the adornment that supports a few basic components like icon and icon button and a context that can be used if someone want to add a chip or other components as adornment. |
Hmm, we can support Disabled in those that are most likely used but we can also pass the same info down into the render fragement via a context variable so the users can use them in their custom RF. |
Or maybe that is overkill. They would know themselves if their input is disabled. |
Yes they would know, but I for example mostly set that for the hole form not for individual components. So with the context that would cascade down from the form to the field to the custom adornment they used the context in. When there is no context they/I would need to remember when setting disabled in the form to also set it when using a custom adornment. |
Feature request type
Enhance component
Component name
No response
Is your feature request related to a problem?
Adornments are
Describe the solution you'd like
A total rework of the adornment system.
Icons
Dense
property in IconButton)IconSize
and make it medium to reduce complexity of implementation and to maintain stylePositioning & Usage
MudBaseInput.Adornment
&Adornment.cs
MudInputAdornment.razor
to publicMudAdornment.razor
Infrastructure
Considerations
ClearAdornment.razor
that users can add themselvesMock code
MudInput.razor.cs
ClearAdornment.razor
AdornmentUsageExample.razor
Have you seen this feature anywhere else?
https://mui.com/material-ui/api/input-adornment/
https://mui.com/material-ui/react-text-field/#input-adornments
Describe alternatives you've considered
No response
Pull Request
Code of Conduct
The text was updated successfully, but these errors were encountered: