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

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
DevOps
Kubernetes
 minutes
Top 10 Rafay alternatives for enterprise Kubernetes operations

Is Rafay's complexity slowing you down? Compare the top 10 Rafay alternatives for 2026. From fleet managers like Rancher to developer platforms like Qovery, find the balance between control and velocity.

Mélanie Dallé
Senior Marketing Manager
DevOps
Kubernetes
 minutes
Top 10 Spectro Cloud alternatives for multi-cluster fleet management

Don't just manage clusters. Modernize your stack. Compare Spectro Cloud vs. Qovery vs. Rancher to decide between "Fleet Operations" and "Developer Self-Service.

Mélanie Dallé
Senior Marketing Manager
DevOps
Kubernetes
 minutes
Top 10 VMware alternatives after the Broadcom acquisition

Hit by Broadcom's VMware price hikes? Compare the top 10 alternatives for 2026, from direct replacements like Proxmox and Nutanix to modernization platforms like Qovery.

Mélanie Dallé
Senior Marketing Manager
DevOps
Kubernetes
Platform Engineering
6
 minutes
10 Red Hat OpenShift alternatives to reduce licensing costs

Is OpenShift too expensive? Discover the best alternatives for 2026. Whether you need Developer Self-Service (Qovery) or Hybrid Cluster Ops (Rancher), find the right fit for your team.

Morgan Perry
Co-founder
Kubernetes
 minutes
Kubernetes management: Best practices for enterprise scaling and cost optimization

Master enterprise Kubernetes management in 2026. Learn best practices for security, FinOps, and reliability, and see how AI-agentic platforms simplify operations.

Mélanie Dallé
Senior Marketing Manager
Kubernetes
Platform Engineering
Infrastructure Management
 minutes
The top 3 OpenShift pains in 2026 (and how platform teams respond)

Is OpenShift becoming too expensive or complex for your team? Discover the top 3 OpenShift pain points; from the "pricing inversion" to vendor lock-in and see why agile platform teams are migrating to modular, developer-first alternatives like 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.