1

I'm trying to add a copy button to the clipboard for input fields. It is required to add the element specifically to the component suffix, and not through the use of horizontal layout (if possible).

Copy to clipboard btn when field is enabled

Everything works fine before setting TextField.setEnabled(false). Is there any way to display components with disabled fields?

Disabled field

1
  • Try use component read only state. In this state component suffix is clickable Commented Aug 20 at 6:35

1 Answer 1

1

Not to my knowledge. Disabledness works for the entire component, including its prefix/suffix. Even if you manage to make the suffix enabled via clever style editing, its server-side will still be disabled and will not accept browser changes. Unless, of course, you make the button work only on the client side.

The simplest solution is to consider placing the button just outside the text field.

Sign up to request clarification or add additional context in comments.

2 Comments

But a text field with a copy button available at all times is a nice idea. Would you mind if I turned it into a component? :)
Of course not, do it

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.