Skip to content

Simple clear contents icon at the end of a text field #11847

@nhwilly

Description

@nhwilly

I would like to see a small x clear button on the right of a BitTextField that would allow the value to be reset to empty.

Here's a sample from another package:

Image

Possible feature set:

  1. Parameter to switch on this behavior is Clear or something like that.
  2. Only show the clear icon when the field has a value in it.
  3. Optional ClearIonName parameter to replace the x if passed.
  4. Optional OnClear parameter allowing a function to be passed in and executed before the value is cleared (allowing a capture of the current value before clearing it with a bool return so the clear can be blocked.
  5. Retain SuffixTemplate, Suffix parameters and have them behave as they do now.

When I tried to use the ChromeClose icon, I noticed that I couldn't make it as small as I wanted, but I haven't considered mobile size implications and you guys probably have. I think it's the correct size for modals and such, but it seems a little big for a text field.

The sample above demonstrates the look. If you visit the MudBlazor site, you can see this field type in action.

If this list is too long, just features 1 and 2 would be fabulous.

Thank you for considering.

Originally posted by @nhwilly in #11840

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    Status

    Investigating

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions