JR
← All work

Shadcn Portable Text Editor

Composable rich-text editor primitives and examples published through the shadcn registry.

  • React
  • TypeScript
  • Tailwind CSS
  • Portable Text
  • shadcn/ui
Shadcn Portable Text Editor

Headless rich-text editors provide excellent authoring flexibility, but they also leave the interface, interaction design, and product decisions to the implementer. Shadcn already had community approaches for TipTap and Lexical, but not for Portable Text, so I built a registry-compatible set of components that could serve as a practical starting point without compromising the underlying editor’s composability.

Finding the right level of abstraction

I went through several iterations to balance a complete out-of-the-box editor with components developers could still understand and change. The final approach uses thin wrappers around Portable Text primitives and existing shadcn components, then combines those pieces into registry blocks that can be added to a project with one command.

Some controls benefit from a higher-level abstraction. A style selector, for example, has predictable responsibilities and is unlikely to need wholesale changes in most projects. Other pieces remain deliberately small so teams can recompose them. Because the shadcn model copies code into the consumer’s project, every default remains editable when a use case calls for something different.

Creating hierarchy in a dense toolbar

Rich-text controls become noisy quickly. An early version of the expanded editor placed more than a dozen standalone buttons in one row, making the interface difficult to scan. Grouping related actions into a reusable button-group component created clearer visual hierarchy and made the behavior of the toolbar easier to understand.

Defaults received the same attention. Tooltips are visible so unfamiliar actions remain discoverable, while keyboard shortcuts inside those tooltips are hidden by default to keep the interface from feeling overly technical. The result is a working editor, a collection of reusable primitives, and a foundation that developers can extend without having to begin with an unstyled headless implementation.