Skip to content

feat(ui5-date-picker, ui5-daterange-picket, ui5-datetime-picker): introduce show-clear-icon property#13055

Merged
GDamyanov merged 19 commits intomainfrom
datepickes-clear-icon
Feb 27, 2026
Merged

feat(ui5-date-picker, ui5-daterange-picket, ui5-datetime-picker): introduce show-clear-icon property#13055
GDamyanov merged 19 commits intomainfrom
datepickes-clear-icon

Conversation

@GDamyanov
Copy link
Contributor

@GDamyanov GDamyanov commented Feb 10, 2026

Introduces a new show-clear-icon property to the DatePicker, DateRangePicker and DateTimePicker components that displays a clear icon inside the input field. When clicked, the icon clears the input value.

Changes:

  • Added boolean property (default: false, since: 2.20.0)
  • Clear icon automatically shows when there's a value and hides when empty, readonly, or disabled
  • Clicking the clear icon clears the value, focuses the input, and fires change events

@GDamyanov GDamyanov self-assigned this Feb 10, 2026
@ui5-webcomponents-bot
Copy link
Collaborator

ui5-webcomponents-bot commented Feb 10, 2026

🧹 Preview deployment cleaned up: https://pr-13055--ui5-webcomponents.netlify.app

@ui5-webcomponents-bot ui5-webcomponents-bot temporarily deployed to preview February 10, 2026 09:55 Inactive
@ilhan007
Copy link
Contributor

2.16 is 3-4 months old, next release is 2.20
Screenshot 2026-02-10 at 12 19 39

@GDamyanov GDamyanov requested a review from nnaydenow February 16, 2026 14:32
@ui5-webcomponents-bot ui5-webcomponents-bot temporarily deployed to preview February 16, 2026 14:37 Inactive
@ui5-webcomponents-bot ui5-webcomponents-bot temporarily deployed to preview February 17, 2026 08:03 Inactive
@ui5-webcomponents-bot ui5-webcomponents-bot temporarily deployed to preview February 18, 2026 08:06 Inactive
@ui5-webcomponents-bot ui5-webcomponents-bot temporarily deployed to preview February 19, 2026 07:57 Inactive
@ui5-webcomponents-bot ui5-webcomponents-bot temporarily deployed to preview February 19, 2026 11:50 Inactive
@ui5-webcomponents-bot ui5-webcomponents-bot temporarily deployed to preview February 20, 2026 07:56 Inactive
@ui5-webcomponents-bot ui5-webcomponents-bot temporarily deployed to preview February 23, 2026 07:54 Inactive

_handleClearIconClick() {
this.value = "";
this._dateTimeInput.value = "";
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's use the approach of giving the value trough the template. if we change the value it will rerender the component, so we can just set the value to the input value

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually this function is redundant because the clear icon clears the value in the input and as we spoke to update value on change everything on the normal flow works properly. The function is removed in this change: 8310f9b

@ui5-webcomponents-bot ui5-webcomponents-bot temporarily deployed to preview February 26, 2026 08:28 Inactive
@ui5-webcomponents-bot ui5-webcomponents-bot temporarily deployed to preview February 26, 2026 08:38 Inactive
@ui5-webcomponents-bot ui5-webcomponents-bot temporarily deployed to preview February 27, 2026 07:43 Inactive
@ui5-webcomponents-bot ui5-webcomponents-bot temporarily deployed to preview February 27, 2026 08:34 Inactive
Copy link
Contributor

@nnaydenow nnaydenow left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  1. When typing width is flickering
    https://github.com/user-attachments/assets/86e3c347-276f-4f86-ab4c-3af9d58d6286
  2. There is background for the picker's icon
Image


:host([show-clear-icon]) .ui5-date-picker-input:not([value]),
:host([show-clear-icon]) .ui5-date-picker-input[value=""] {
width: calc(100% + 36px);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks wrong to me to have something larger than 100%

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in fbdcfb9

}

:host([show-clear-icon]) .ui5-date-picker-input:not([value]),
:host([show-clear-icon]) .ui5-date-picker-input[value=""] {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't understand why do we need all these overrides if custom icons are supported in ui5-input. Could you share the idea of doing that?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in fbdcfb9

<CustomFormatting /> No newline at end of file
<CustomFormatting />

### DatePicker with Clear Icon
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No need to mention Datepicker here.

Also it would be good to add such sample in DateTimePicker and DateRangePicker

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in 62c9ac9

@ui5-webcomponents-bot ui5-webcomponents-bot temporarily deployed to preview February 27, 2026 09:19 Inactive
@ui5-webcomponents-bot ui5-webcomponents-bot temporarily deployed to preview February 27, 2026 10:18 Inactive
@GDamyanov GDamyanov requested a review from nnaydenow February 27, 2026 10:30
@ui5-webcomponents-bot ui5-webcomponents-bot temporarily deployed to preview February 27, 2026 10:36 Inactive
@ui5-webcomponents-bot ui5-webcomponents-bot temporarily deployed to preview February 27, 2026 13:20 Inactive
@GDamyanov GDamyanov merged commit 89ccfb8 into main Feb 27, 2026
21 of 22 checks passed
@GDamyanov GDamyanov deleted the datepickes-clear-icon branch February 27, 2026 13:49
@ui5-webcomponents-bot ui5-webcomponents-bot temporarily deployed to preview February 27, 2026 13:50 Inactive
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants