Skip to content

GPUI-RSX

GPUI-RSX is a Rust procedural macro that turns JSX-like markup into native GPUI builder calls at compile time.

Use it when you want GPUI code that keeps the type safety and performance profile of normal Rust, but reads closer to the shape of the UI you are building.

  • HTML-like tags that expand to GPUI elements.
  • Attribute syntax for GPUI builder methods.
  • class="..." support for a Tailwind-like subset mapped to GPUI APIs.
  • Conditional rendering and Rust expressions inside { ... }.
  • Fragment support with <>...</>.
  • Loop rendering with key={...} support for repeated stateful elements.
  • Strict, permissive, and expansion-preview macros.

GPUI-RSX is not a browser renderer and it is not a Tailwind CSS runtime. Static RSX is compiled into Rust code. Dynamic classes are handled by a generated runtime matcher that supports the common GPUI utility subset documented in this site.

use gpui_rsx::{rsx, rsx_expand, rsx_permissive, rsx_strict};
MacroUse case
rsx!Default permissive RSX macro.
rsx_strict!Rejects unsupported static classes and panics on unsupported dynamic classes when evaluated.
rsx_permissive!Explicit permissive mode for unknown class handling.
rsx_expand!Returns a string preview of generated GPUI builder code for debugging.

The Starlight site is the canonical documentation set. The old docs/*.md files have been folded into these pages: