MCPcopy Create free account
hub / github.com/cogentcore/core / AddClearButton

Method AddClearButton

core/textfield.go:491–495  ·  view source on GitHub ↗

AddClearButton adds a trailing icon button at the end of the text field that clears the text in the text field when it is clicked.

()

Source from the content-addressed store, hash-verified

489// of the text field that clears the text in the text field
490// when it is clicked.
491func (tf *TextField) AddClearButton() *TextField {
492 return tf.SetTrailingIcon(icons.Close, func(e events.Event) {
493 tf.clear()
494 })
495}
496
497// SetTypePassword enables [TextField.NoEcho] and adds a trailing
498// icon button at the end of the textfield that toggles [TextField.NoEcho].

Callers 5

TestTextFieldClearFunction · 0.80
TestTextFieldClearClickFunction · 0.80
TestWidgetPrevFunction · 0.80
TestWidgetNextFunction · 0.80
inputsFunction · 0.80

Calls 2

SetTrailingIconMethod · 0.95
clearMethod · 0.95

Tested by 4

TestTextFieldClearFunction · 0.64
TestTextFieldClearClickFunction · 0.64
TestWidgetPrevFunction · 0.64
TestWidgetNextFunction · 0.64