Trix is a rich text editor for web applications that provides WYSIWYG editing through a custom HTML element.
Trix solves the problem of inconsistent browser behavior in rich text editing by abandoning reliance on the contenteditable and execCommand APIs, which were designed decades ago and lack full specification. Instead, it treats contenteditable as an input device: when a user types or pastes, Trix converts that input into an operation on its own internal document model, then re-renders the result back to the editor. This approach gives the tool complete control over editing behavior after every keystroke and avoids browser quirks entirely. The editor outputs terse and consistent HTML and includes a sophisticated document model with support for embedded attachments.
Trix suits web applications that need straightforward rich text editing for messages, comments, articles, and lists—the kinds of everyday documents most web apps handle. It comes as a custom element that works with any asset packaging system, available in both ESM and UMD formats. The editor automatically expands vertically to fit content and can accept standard attributes like autofocus and placeholder. A toolbar is generated automatically but can be positioned elsewhere on the page if needed. The tool is built on established web standards including Custom Elements, Element Internals, Mutation Observer, and Promises, and supports all evergreen desktop and mobile browsers.
The project maintains active engagement with its codebase, regularly addressing issues and pull requests. Development shows consistent attention to browser compatibility and standards compliance. The maintainers continue to refine the editor's behavior and expand its capabilities based on user feedback and evolving web platform features.