explaingit

basecamp/trix

Analysis updated 2026-06-21

19,934JavaScriptAudience · developerComplexity · 2/5Setup · easy

TLDR

A rich text editor you can add to any web page with a single HTML tag, giving users a formatting toolbar and producing clean, consistent HTML output across all browsers without the bugs of older editing APIs.

Mindmap

mindmap
  root((repo))
    What it does
      Rich text editing
      Clean HTML output
      Custom toolbar
    How it works
      Own document model
      Bypasses execCommand
      Custom Elements
    Setup
      CDN one-liner
      npm package
      Single HTML tag
    Features
      Bold italic headings
      Links and lists
      File attachments
Click or tap to explore — scroll the page freely

Code map

Detail Auto

An interactive map of this repo's files and how they connect — its source is parsed live in your browser. Click Visualize to build it.

filefunction / class

What do people build with it?

USE CASE 1

Add a formatted text area to a web form so users can write bold, italic, and bulleted content without knowing HTML.

USE CASE 2

Replace a plain textarea in a blog or CMS with a WYSIWYG editor that outputs clean HTML ready to store in a database.

USE CASE 3

Embed a rich comment box in a web app that supports links, headings, lists, and file attachments.

What is it built with?

JavaScript

How does it compare?

basecamp/trixenzymejs/enzymesegment-boneyard/nightmare
Stars19,93419,83819,769
LanguageJavaScriptJavaScriptJavaScript
Setup difficultyeasyeasyeasy
Complexity2/52/53/5
Audiencedeveloperdeveloperdeveloper

Figures from each repo's GitHub metadata at analysis time.

How do you get it running?

Difficulty · easy Time to first run · 5min

Add via CDN or npm and drop a single custom HTML element tag where the editor should appear.

License not mentioned in the explanation.

In plain English

Trix is a WYSIWYG (What You See Is What You Get) rich text editor for web applications, built by 37signals, the company behind Basecamp and Ruby on Rails. WYSIWYG means users can format their writing through a toolbar (bold, italic, headings, lists, links, attachments) and see the formatted result as they type, rather than writing raw HTML or markdown. Trix is designed for everyday writing tasks like messages, comments, and articles, and it powers the text editor inside Basecamp itself. What makes Trix architecturally different from older editors is how it handles user input. Most rich text editors at the time Trix was created were thin wrappers around the browser's built-in editing APIs (called contenteditable and execCommand), which were inconsistent across browsers and full of edge-case bugs. Trix bypasses those APIs by maintaining its own internal document model, every keystroke or formatting action goes through Trix's own logic, which then re-renders the document. This gives it full control over the editing experience and produces clean, consistent HTML output regardless of the browser. Adding Trix to a web page is done by loading a stylesheet and script from a CDN, then placing a single custom HTML element tag where the editor should appear. Trix automatically generates a toolbar and links itself to an HTML form field, making integration straightforward. The toolbar is configurable, and custom toolbar buttons can trigger custom actions. Trix is built with modern web standards including Custom Elements and works in all current desktop and mobile browsers. It is written in JavaScript and available as an npm package.

Copy-paste prompts

Prompt 1
I want to add the Trix editor to my HTML form. Show me the CDN script and stylesheet tags and the single HTML element tag I need, and how to read the formatted output on form submit.
Prompt 2
Using Trix, how do I add a custom toolbar button that wraps selected text in a highlight tag?
Prompt 3
I am using Trix in a Rails app. Show me how to accept and display image attachments inside the editor using ActiveStorage.
Prompt 4
I want to configure Trix to hide the attachment button from the toolbar. How do I customize which toolbar buttons appear?

Frequently asked questions

What is trix?

A rich text editor you can add to any web page with a single HTML tag, giving users a formatting toolbar and producing clean, consistent HTML output across all browsers without the bugs of older editing APIs.

What language is trix written in?

Mainly JavaScript. The stack also includes JavaScript.

What license does trix use?

License not mentioned in the explanation.

How hard is trix to set up?

Setup difficulty is rated easy, with roughly 5min to a first successful run.

Who is trix for?

Mainly developer.

Open on GitHub → Explain another repo

This repo across BitVibe Labs

Scan in gitsafehub Deploy in gitdeployhub basecamp on gitmyhub

Verify against the repo before relying on details.