Skip to content

Repository files navigation

GPUI Component logo
GPUI Component

English | 简体中文

Build StatusDocsCrates.io

Build fantastic, high-performance desktop apps with Rust and GPUI.

GPUI Component is a comprehensive Rust desktop application framework. It combines a production-ready UI system with application-grade data, layout, and editing capabilities, all built on a reusable foundation of behavior, state, and infrastructure.

Features

  • 60+ UI Components: Forms, navigation, overlays, feedback, layout, and more, with polished interactions and productive defaults.
  • Production Ready: Used to build Longbridge Pro from day one and continuously refined in a publicly shipped commercial desktop application.
  • Native Feel: Modern controls inspired by macOS and Windows, backed by semantic themes and multiple sizes.
  • 120 FPS: GPU-accelerated interfaces that remain smooth under load.
  • Data Tables: Virtual scrolling, fixed and resizable columns, sorting, and cell selection across hundreds of thousands of rows.
  • Virtual Lists: Render only the visible range, including lists whose items have different sizes.
  • Code Editor: Stable performance at 200K lines with Tree-sitter highlighting and LSP diagnostics, completion, and hover.
  • Dock Layout: Resizable panels, draggable tabs, nested splits, edge docks, and serializable freeform Tiles.
  • Rich Content: Native Markdown and HTML rendering, syntax highlighting, and built-in charts.
  • Design Freedom: Use the complete visual system or build your own on the behavior and infrastructure in gpui-base.
  • Cross Platform: Ship one Rust codebase to macOS, Windows, and Linux.

Framework Architecture

Two layers. One ecosystem.

Use gpui-component to keep the application coherent with one complete visual and interaction system. Use gpui-base when your product needs to create and own that system itself.

gpui-componentgpui-base
Complete, styled componentsUnstyled behavior and infrastructure
Productive defaults with themingFull control over structure and visual design
Best for building applicationsBest for building design systems
 APPLICATION
│
┌─────────────────┴─────────────────┐
│ │
▼ ▼
┌──────────────────┐ ┌──────────────────┐
│ gpui-component │ │ Your Design │
│ Styled UI │ │ System │
└────────┬─────────┘ └────────┬─────────┘
│ │
└────────────────┬─────────────────┘
▼
┌──────────────────┐
│ gpui-base │
│ Behavior · State │
│ Infrastructure │
└────────┬─────────┘
▼
GPUI

Behavior belongs to the foundation. Presentation belongs to the application.

Use gpui-component when you want polished controls ready to ship. Build on gpui-base when your application should own its component source, layout, styling, and motion while reusing difficult interaction behavior.

The layering follows the same separation that makes the shadcn ecosystem flexible:

GPUI Component ecosystemWeb ecosystem
GPUIHTML + Tailwind CSS
gpui-baseBase UI
gpui-componentshadcn's styled component layer

Explore the architecture →

Showcase

GPUI Component has powered Longbridge Pro from day one. The framework is extracted from the demands of a publicly shipped commercial desktop application rather than designed in isolation.

GPUI provides the rendering foundation. Longbridge provides the production foundation.

Image

Usage

gpui = { git = "https://github.com/zed-industries/zed" }
gpui_platform = { git = "https://github.com/zed-industries/zed", features = ["font-kit"] }
gpui-component = { git = "https://github.com/longbridge/gpui-component" }

Basic Example

use gpui::*;use gpui_component::{button::*,*};pubstructHelloWorld;implRenderforHelloWorld{fnrender(&mutself, _:&mutWindow, _:&mutContext<Self>) -> implIntoElement{div().v_flex().gap_2().size_full().items_center().justify_center().child("Hello, World!").child(Button::new("ok").primary().label("Let's Go!").on_click(|_, _, _| println!("Clicked!")),)}}fnmain(){
gpui_platform::application().run(move |cx| {// This must be called before using any GPUI Component features.
gpui_component::init(cx);
cx.spawn(asyncmove |cx| {
cx.open_window(WindowOptions::default(), |window, cx| {let view = cx.new(|_| HelloWorld);// This first level on the window, should be a Root.
cx.new(|cx| Root::new(view, window, cx))}).expect("Failed to open window");}).detach();});}

Icons

GPUI Component has an Icon element, but it does not include SVG files by default.

The example uses Lucide icons, but you can use any icons you like. Just name the SVG files as defined in IconName. You can add any icons you need to your project.

Skills for AI Coding Agents

Install the GPUI Component skills for your AI coding agent (Cursor, Claude Code, Gemini CLI, Codex, etc.):

npx skills add longbridge/gpui-component
SkillDescription
gpui-componentComponent catalog, usage patterns, and contributor code style guide.
gpuiLow-level GPUI framework mechanics (elements, entities, async, focus, actions, tests).

Development

Desktop Gallery (Story)

The story crate is a gallery application that showcases all available components. Run it with:

cargo run

Examples

Some important examples are built into the story crate and can be run directly:

# Code editor with LSP support and syntax highlighting
cargo run --example editor
# Dock layout system (panels, split views, tabs)
cargo run --example dock
# Markdown rendering
cargo run --example markdown
# HTML rendering
cargo run --example html

The examples directory also contains standalone examples, each focused on a single feature. Each example is a separate crate, run them with cargo run -p <name>:

# Basic hello world
cargo run -p hello_world
# System monitor (real-time charts with CPU/memory data)
cargo run -p system_monitor
# Window title customization
cargo run -p window_title

Check out CONTRIBUTING.md for more details.

Compare to others

FeaturesGPUI ComponentIcedeguiQt 6
LanguageRustRustRustC++/QML
Core RenderGPUIwgpuwgpuQT
LicenseApache 2.0MITMIT/Apache 2.0Commercial/LGPL
Min Binary Size 112MB11MB5M20MB 2
Cross-PlatformYesYesYesYes
DocumentationSimpleSimpleSimpleGood
WebYes (WASM)YesYesYes
UI StyleModernBasicBasicBasic
CJK SupportYesYesBadYes
ChartYesNoNoYes
Table (Large dataset)Yes
(Virtual Rows, Columns)
NoYes
(Virtual Rows)
Yes
(Virtual Rows, Columns)
Table Column ResizeYesNoYesYes
Text baseRopeCOSMIC Text3trait TextBuffer 4QTextDocument
CodeEditorSimpleSimpleSimpleBasic API
Dock LayoutYesYesYesYes
Syntax HighlightTree SitterSyntectSyntectQSyntaxHighlighter
Markdown RenderingYesYesBasicNo
Markdown mix HTMLYesNoNoNo
HTML RenderingBasicNoNoBasic
Text SelectionTextViewNoAny LabelYes
Custom ThemeYesYesYesYes
Built ThemesYesNoNoNo
I18nYesYesYesYes

Please submit an issue or PR if any mistakes or outdated are found.

License

Apache-2.0

Footnotes

  1. Release builds by use simple hello world example.

  2. Reducing Binary Size of Qt Applications

  3. Iced Editor: https://github.com/iced-rs/iced/blob/db5a1f6353b9f8520c4f9633d1cdc90242c2afe1/graphics/src/text/editor.rs#L65-L68

  4. egui TextBuffer: https://github.com/emilk/egui/blob/0a81372cfd3a4deda640acdecbbaf24bf78bb6a2/crates/egui/src/widgets/text_edit/text_buffer.rs#L20

About

One Net Client is a cross-platform unified desktop client that consolidates database operations, SSH/SFTP file transfer, RDP/VNC remote desktop, local terminal and an embedded AI Assistant in a single application.

Topics

Resources

Contributing

Stars

519 stars

Watchers

5 watching

Forks

Releases

Packages

Contributors

Languages