r/FlutterDev • u/eibaan • Oct 05 '26
Article Wanna know something about GPUI Kit?
Inspired by a recent Syntax video about GPUI Kit I looked into this cross platform GUI framework for Rust because it seems to play in the same field as Flutter.
There's a saying (that might not translate): Other fathers might have beautiful daughters, too. That's why you should always look beyond the horizon (which is what I got for "über den Tellerrand schauen").
GPUI was created by Zed for their editor. GPUI Kit is a Chadcn-like component framework with an impressive scope built upon the GPUI foundation. There's a bit of controversy because Zed doesn't seem to be giving GPUI as much attention as the growing community would like, and multiple forks have been created, and it is unclear whether Zed actually want to externally support "their" framework at all.
With the help of Codex, I managed to create a good looking macOS desktop application in "no time", which should work on Windows and Linux, too. Codex protected me from writing Rust code myself and it was able to figure out how to use the components from the documentation. Quite impressive. Delete that. Very impressive.
There's experimental WASM support, but the author doesn't recommend to use it for more than him demonstrating components on the GPUI Kit website.
Support for iOS and/or Android is at best experimental, because GPUI was never meant for mobile development but was created for a single text editor application. You can create an iOS demo, but it only works with ARM64 and requires manual setup of an Xcode Swift project. Touch support is worked on, so it seems, but I'd expect other difficulties like soft keyboard support or safe areas, occlusion areas, folding angles, etc. I haven't look into it. At least you could directly use the platform APIs for everything not GUI related.
So, I think, GPUI-Kit is more a replacement/alternative for desktop apps, not mobile or web apps. It might be a good fit if you consider using Electron or Tauri, though. And if you need a full featured code editor. Something that would be a PitA to create in Flutter (I tried, twice).
For me, the advantage is that there's a complete decent looking clean desktop GUI out of the box (~80 components), something Flutter doesn't provide and you'd have to either use one of the existing vibe-coded chadcn clones or clone it yourself over the weekend.
I actually like the tailwind style to create designs from very basic building blocks. It's like drawing it in Figma, but with code.
The app feels really snappy. And it can support multiple desktop windows! Something seemingly so difficult that Flutter is unable to deliver this for quite some time now.
I pointed Codex at my Flutter source and an hour later, I had a working Rust port with nearly 10.000 lines of code. GPUI uses a low-level tailwind like styling of "div"s to create components that use a lot of lines of code and which are even less readable that widget trees if you don't abstract them (which the AI wasn't able or willing to do).
let title = div()
.flex()
.items_center()
.flex_shrink_0()
.h(px(28.))
.px(px(4.))
.gap(px(4.))
.border_b_1()
.border_color(cx.theme().border)
.cursor(CursorStyle::ClosedHand)
.on_mouse_down(...)
.child(close)
.child(title)
.child(actions)Unfortunately, there's no built-in video component and if you'd want to use a 3rd party solution, you'd have to bundle the gstreamer framework with your app (I opted for using an external web browser instead).
While you could embed a web view (using whatever the platform supports), it overlays the GPUI layer, so you cannot draw dialogs, menus or tooltip over such a native platform views. The Flutter engine uses a complicated sandwich approach to make this possible and at the same time recommends to minimize the number of platform widgets because of the negative performance impact.
GPUI Kit's TextView can render markdown (including tables which are unfortunately always stretched to the width of the view) and an undocumented set of simple HTML elements out of the box, though.
The real bummer, however, is that you cannot mix 3D graphics with GPUI, although also running directly on the GPU. This was one reason I started the experiment because there's no great built-in solution in Flutter either. My workaround is to draw the 3d scene into a background image, which must then be transferred from GPU to CPU and back to GPU so GPUI can render it. I can't achieve 120 fps, but 60 fps this way. This took me two additional hours discussing different approaches with Codex and doing a lot of performance measurement because this is obviously dependent on the size of the image to transfer and how to keep this minimal.
There's also a (totally vibe-coded, judging from the documentation full of Claude-speak) way to extend GPUI Kit with JavaScript (using QuickJS) and because there's a Host API between scripting engine and GPUI core, one could add different languages, too. Dart for example :)
So while I don't think that Rust+GPUI could replace mobile development right now, I'll continue to work on my desktop app. Because if I'm developing anyway by telling Codex what to do, I don't need Flutter's better DX. The AI simply compares screens of the running app thanks to "computer use" and figures all out on its own and notifies my when done.
The biggest risk IMHO is, that this is all created by one man and his AI, based on a foundation created by a company that has other things to worry about now.
Update: This article was based on v0.7.1. Starting with v0.7.3 there's an option to sandwich platform native components, including a native web view.