ClearValue in a Numeric Textbox

1 Answer 30 Views
NumericTextBox TextBox
Han
Top achievements
Rank 1
Han asked on 02 May 2025, 09:35 PM

Hello,

 

I'm creating a Numeric Textbox that should be able to accept Empty.  How do I add a ClearValue button in a Numeric Textbox?

1 Answer, 1 is accepted

Sort by
0
Hetali
Telerik team
answered on 05 May 2025, 07:20 PM

Hi Han,

In order to add a clear button in the Kendo UI NumericTextBox, add an Icon Button as a Suffix Adornment. For example:

<kendo-numerictextbox [(value)]="value">
  <ng-template kendoSuffixTemplate>
    <button kendoButton 
      fillMode="clear" 
      [svgIcon]="svgClear" 
      title="Clear" 
      (click)="clear()"> 
    </button>
  </ng-template>
</kendo-numerictextbox>
public svgClear: SVGIcon = xIcon;
public value: number;

public clear() {
  this.value = null;
}

Output:

In this StackBlitz example, I have added an icon button in the NumericTextBox as a suffix adornment that clears the value.

I hope this helps. Please let me know if I can further assist you.

Regards,
Hetali
Progress Telerik

Love the Telerik and Kendo UI products and believe more people should try them? Invite a fellow developer to become a Progress customer and each of you can get a $50 Amazon gift voucher.

Tags
NumericTextBox TextBox
Asked by
Han
Top achievements
Rank 1
Answers by
Hetali
Telerik team
Share this question
or