4

Jetpack compose provides lots of material components like TextField etc. However, to build something like a file editor, what kind of component can be used that supports multiple lines of text any long with text operations like selecting text, cut-copy-paste, etc.

Would be interested to know equivalent component for Jetpack compose desktop as well.

Phil Dukhov
  • 67,741
  • 15
  • 184
  • 220
SaiNageswar S
  • 1,203
  • 13
  • 22

3 Answers3

2

For Compose Desktop, you can use a Swing component like RSTextArea

I wrote a blog post about how to embed it.

tonisives
  • 1,962
  • 1
  • 18
  • 17
0

Android EditText can be a good option for code editor, you can make a custom edittext and use it inside compose's AndroidView

Compose's AndroidView can also infalte ui from xml file

-1

There is an official sample on GitHub by jetbrains for an editor https://github.com/JetBrains/compose-jb/tree/master/examples/codeviewer

  • 2
    This is a read-only CodeViewer. They are rendering file line-by-line in "Text" component with formatting which is not editable. Further, even if we make Text component editable, we would need an editor that will allow editing entire file and not line by line. – SaiNageswar S May 24 '21 at 04:45