I'm working on a project that needs a terminal-like interface within a website, but I want to keep it really simple. I don't need any fancy features like HTTPS or web socket connections. Just something that looks and acts like a basic Linux terminal with minimal functionality. I need it to handle text input and enter key events at the very least, with no need for features like command history navigation or arrow key support. I've tried xterm.js, but I've found it quite frustrating to use, especially since some of its add-ons don't function as expected. I've also explored ttyd, but it requires a process to attach to, which isn't what I want. So, are there any other alternatives similar to xterm.js that actually work as promised, or are there any workarounds for xterm.js issues?
5 Answers
If you're using a specific stack, check out PrimeNG. They have a terminal component that might work for you. Just a heads-up though, I haven't used it personally, but their other components have been helpful for me.
Honestly, building a basic terminal from scratch sounds quite doable! Just design a black background with a text input, and you're pretty much there. It's straightforward and gives you control over the features you want.
Xterm.js actually interprets ANSI codes to replicate Linux terminal behavior, which can be quite complex. If you're just looking to display text that resembles a terminal, consider using syntax highlighting libraries like ace-builds or monaco-editor with a shell or bash theme.
Have you considered a VueJS option? I recently came across the PrimeVue terminal component which seems pretty promising for similar needs. Might be worth checking out!
From what you described, it sounds like a styled text input might suffice. You could set up a simple design with a black background and an input box to simulate terminal behavior without much fuss.
Thanks for the suggestions! I might just go with a custom build to keep it simple.