[Discuss] When to use EuiCodeBlock, EuiCodeEditor and CodeEditor (from react_utils, Monaco) #71425
Labels
discuss
Team:Platform-Design
Team Label for Kibana Design Team. Support the Analyze group of plugins.
I am opening this issue in the Kibana repository (not EUI), since it also contains one component that lives (currently) purely in the Kibana repository. I have the feeling we currently don't have a good guideline when to use
EuiCodeBlock
,EuiCodeEditor
(under the hood ACE) andCodeEditor
(from thereact_utils
plugin, under the hood Monaco).We've been using
EuiCodeBlock
very often when purely showing some Code (e.g. JSON from requests/responses). We've seen significant performance issues with this component, that it freezes the browser completely when trying to render some larger JSON (see also elastic/eui#1208). We ran into the same issue in the currently WIP Vega inspector when trying to render the Vega spec. Despite performance (which can be addressed), theEuiCodeBlock
also is very static and offers not much features, e.g. no collapsing of JSON (#59949) or no line numbers (#69614), which are missed by users.EuiCodeEditor
is using ACE under the hood, and I think we might be a bit better of nowadays with Monaco (given the larger community with VSCode around it, and thus hopefully better accessibility and extensibility in the long run).We now switched the Vega inspector to use
CodeEditor
, but I still think it would be beneficial if we could setup some general guidelines around the usage of those 3 components.I would suggest the following and would be interested for feedback (especially from the design team):
EuiCodeBlock
.CodeEditor
.EuiCodeEditor
for new places more, and instead favorCodeEditor
.cc @alexwizp @elastic/kibana-design @kertal
The text was updated successfully, but these errors were encountered: