explaingit

basecamp/trix

📈 Trending19,941JavaScriptAudience · developerComplexity · 2/5ActiveLicenseSetup · easy

TLDR

A WYSIWYG rich text editor for web apps that lets users format text with a toolbar instead of writing HTML, powering Basecamp's editor.

Mindmap

mindmap
  root((Trix))
    What it does
      WYSIWYG editor
      Toolbar formatting
      Clean HTML output
    How it works
      Custom document model
      Bypasses browser APIs
      Consistent across browsers
    Integration
      Drop-in HTML element
      CDN or npm package
      Auto-generates toolbar
    Use cases
      Messages and comments
      Article editing
      Form text fields
    Tech stack
      JavaScript
      Custom Elements
      Web standards

Things people build with this

USE CASE 1

Add a rich text editor to a web form or comment section without building one from scratch.

USE CASE 2

Let users format messages, articles, or notes with bold, italic, lists, and links through a visual toolbar.

USE CASE 3

Replace plain textarea inputs with a professional WYSIWYG editor that generates clean HTML automatically.

Tech stack

JavaScriptCustom ElementsHTML5CSS

Getting it running

Difficulty · easy Time to first run · 5min
Use freely for any purpose, including commercial use, as long as you keep the copyright notice and license text.

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
How do I add Trix to my web page and connect it to a form field?
Prompt 2
Show me how to customize the Trix toolbar to add or remove formatting buttons.
Prompt 3
How does Trix handle pasting content from Word or other rich text sources?
Prompt 4
Can I add custom toolbar buttons to Trix that trigger my own JavaScript functions?
Open on GitHub → Explain another repo

Generated 2026-05-18 · Model: sonnet-4-6 · Verify against the repo before relying on details.