Theme for non-editable text

57 views
Skip to first unread message

Alan Smith

unread,
Oct 10, 2025, 6:29:22 PMOct 10
to blo...@googlegroups.com
When I set the EDITABLE flag to false on a Blockly.FieldTextInput it gets rendered (with the classic renderer) as a black box with white text.

I am having trouble finding out where to change this (say to dark grey text on a light grey box for example)

I can tell that it is being set to the CSS .blocklyNonEditableField 

Do I just need to change the CSS or is there theme support for this?

Thanks in advance,

Alan

Aaron Dodson

unread,
Oct 15, 2025, 1:38:39 PMOct 15
to Blockly
Hi Alan,

The EDITABLE field isn't really intended to be toggled to change the read/readwrite state of a field; it should probably be `protected`, but is such an old part of the API that it remains available for backwards compatibility. For non-editable text, you generally want `FieldLabel`.

That said, you should be able to just use CSS to target and adjust the appearance of the element. Generally using CSS directly is the direction we're moving in in preference to the theme system.

I hope that helps, and please let me know if you have any further questions!

- Aaron

Alan Smith

unread,
Oct 16, 2025, 9:55:10 AMOct 16
to blo...@googlegroups.com
Hmmm.   What we want is something that doesn't look like a label but instead looks like a FieldTextInput that is disabled.   We have our own field "component" for that now, but all it does is derive from a FieldTextInput and set the EDITABLE flag as false.
Should I just use: .blocklyNonEditableField  or is there a better way to do this?

Thanks,

Alan


--
You received this message because you are subscribed to the Google Groups "Blockly" group.
To unsubscribe from this group and stop receiving emails from it, send an email to blockly+u...@googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/blockly/7bbce30b-1e72-40f1-8354-75bfe3a320dfn%40googlegroups.com.
Reply all
Reply to author
Forward
0 new messages