Phlex | View components in Ruby

1 min read Original article ↗

PhlexStunning server-side rendered views

A little Ruby gem for building HTML and SVG view components.

🧑‍🍳

Pure, beautiful Ruby

Phlex gives you HTML semantics in Ruby so you can use your existing skills designing object-oriented views.

🚀

Fast enough

Phlex renders HTML at ~1.4gbps per core on a MacBook Pro (M3 Max) and it doesn’t slow exponentially the more components you extract.

🚂

Rails integration

Phlex works great with Rails. It supports all Rails helpers and plays nicely with ERB, ViewComponent, Stimulus, Turbo and Tailwind.

🧰

Ruby tooling

Use tools like RubyLSP, RuboCop and SimpleCov.

🧪

Sensible isolation

Phlex components only depend on the data you pass in, making them easier to test and reuse.

🧵

HTML / SVG string-builder

You can also use the Phlex DSL to build HTML and SVG strings directly, without creating a component class.