Blog
Engineering
2
minutes

react-xtermjs - a React Library to Build Terminals

Recently, at Qovery, we added a terminal to our UI Console but didn’t find a React library that fit our needs. So, we built react-xtermjs based on the popular XTerm.js library. In this article, I'll explain what XTerm.js is and how to use our library.
Rémi Bonnet
Software Engineer
Summary
Twitter icon
linkedin icon

What is XTerm.js?

XTermJS is an open-source terminal emulator for web applications. It allows users to interact with a shell directly from the browser and supports features like Unicode, ANSI escape codes, and custom keybindings.

Existing Libraries and Their Limitations

There are already a couple of libraries, the most notable being xterm-for-react and react-xterm. However, these libraries have not been updated for many years and do not support hooks and components, limiting their flexibility and usability.

By building react-xtermjs, we wanted to provide an easy-to-use solution that leverages the full capabilities of XTerm.js integrating with React.

How to Use the Library

Here is an example where I load an XTerm addon using react-xtermjs useXTerm hook. XTerm.js provides many add-ons, which you can find here.

import { FitAddon } from '@xterm/addon-fit'
import { useEffect } from 'react'
import { useXTerm } from 'react-xtermjs'

const TerminalComponent = () => {
const { instance, ref } = useXTerm()
const fitAddon = new FitAddon()

useEffect(() => {
// Load the fit addon
instance?.loadAddon(fitAddon)

const handleResize = () => fitAddon.fit()

// Write custom message on your terminal
instance?.writeln('Welcome react-xtermjs!')
instance?.writeln('This is a simple example using an addon.')

// Handle resize event
window.addEventListener('resize', handleResize)
return () => {
window.removeEventListener('resize', handleResize)
}
}, [ref, instance])

return

}

If you prefer, you can also use the component approach. Check the example here.

Note that the useXTerm hook allows more flexibility with the underlying XTerm.js instance. However, it is more verbose than the XTerm component. You can choose whichever option fits your needs.

Real Use-Case with Qovery Shell Implementation

At Qovery, we built a Kubernetes management platform. We needed a terminal in our Web Console (UI) to allow users to connect directly to their running applications via a shell.

To achieve this, we used two add-ons:

All the code is available in our open-source repository. You can view the implementation here.

Voilà

The goal of react-xtermjs is to simplify adding a terminal to your React apps with an easy-to-use component and hook.

If you encounter any issues, please let us know by opening an issue on our GitHub repo.

Share on :
Twitter icon
linkedin icon
Tired of fighting your Kubernetes platform?
Qovery provides a unified Kubernetes control plane for cluster provisioning, security, and deployments - giving you an enterprise-grade platform without the DIY overhead.
See it in action

Suggested articles

Kubernetes
DevOps
6
 minutes
Top Nutanix Alternatives for Kubernetes Management

Looking for alternatives to Nutanix Kubernetes Platform (NKP)? Compare the top 10 solutions. Review pros and cons to find tools that offer greater flexibility and lower costs.

Mélanie Dallé
Senior Marketing Manager
Kubernetes
DevOps
6
 minutes
Top Mirantis Alternatives That Developers Actually Love

Explore the top 10 alternatives to Mirantis. Compare pros and cons of modern Kubernetes platforms like Qovery, Rancher, and OpenShift to find your best fit.

Mélanie Dallé
Senior Marketing Manager
Kubernetes
DevOps
6
 minutes
Top 10 enterprise Kubernetes cluster management tools in 2026

Compare the best enterprise Kubernetes management tools for 2026. From Qovery and OpenShift to Rafay and Mirantis, discover which platform best suits your multi-cluster strategy.

Mélanie Dallé
Senior Marketing Manager
Kubernetes
DevOps
 minutes
Atmosly Alternatives: The Best Tools for Scaling Teams

Hit the ceiling with Atmosly? Discover the top 10 Kubernetes management alternatives for 2026. From Qovery’s developer-centric platform to Rancher’s operations control, find the right tool to scale your infrastructure.

Mélanie Dallé
Senior Marketing Manager
DevOps
 minutes
10 Best Octopus Deploy Alternatives: Trade Manual Deployment for Full Pipeline Automation

Modernize your pipeline. Explore the top Octopus Deploy alternatives for cloud-native Kubernetes delivery and full GitOps integration.

Mélanie Dallé
Senior Marketing Manager
DevOps
Platform Engineering
Kubernetes
5
 minutes
10 Best Container Management Tools for the Kubernetes Era

Move beyond basic Docker commands. We review the top container management platforms, including Qovery, Rancher, and OpenShift, that tame Kubernetes complexity and streamline your deployment workflows.

Morgan Perry
Co-founder
DevOps
16
 minutes
Enterprise DevOps Automation: Moving from Scripts to Platform Engineering

Stop writing fragile scripts. Discover how top enterprises use Kubernetes Management Platforms to automate governance (Policy-as-Code), scale ephemeral environments, and enforce FinOps with Spot Instances.

Mélanie Dallé
Senior Marketing Manager
DevOps
Kubernetes
 minutes
Top 10 Platform9 Alternatives: Best managed Kubernetes solutions for scale

Need a better way to manage on-prem Kubernetes? Review 10 alternatives to Platform9, categorized by "Infrastructure Ops" (Rancher) vs. "Developer Experience" (Qovery).

Mélanie Dallé
Senior Marketing Manager

It’s time to change
the way you manage K8s

Turn Kubernetes into your strategic advantage with Qovery, automating the heavy lifting while you stay in control.