quartz
Quartz
A Windows Forms-inspired, cross-platform GUI toolkit for Crystal
β¨ Overview
Quartz is a native, cross-platform GUI toolkit for the Crystal programming language. Its API is inspired by Windows Forms, making it instantly familiar to developers who have worked with desktop GUI frameworks before.
Quartz does not bundle a rendering engine or ship a UI library. Instead, it wraps each platform's native toolkit through a thin C bridge, giving you truly native look-and-feel on every OS β for free.
| Platform | Backend |
|---|---|
| AppKit (Cocoa) | |
| GTK 3 or Qt 5/6 | |
| Win32 API |
π§ͺ Tested On
Quartz has been verified to work on the following environments:
| OS | Backend | Status |
|---|---|---|
| AppKit | β Working | |
| GTK 3 | β Working | |
| Qt 6 | β Working |
π Quick Start
require "quartz"
Quartz::Application.run do |app|
window = Quartz::Window.new("Hello, Quartz!", 400, 250)
label = Quartz::Label.new("Welcome! π", x: 20, y: 20, width: 360, height: 30)
window.add_control(label)
button = Quartz::Button.new("Click Me", x: 20, y: 60, width: 120, height: 32)
button.on_click { label.text = "Button clicked! π" }
window.add_control(button)
window.show
end
π¦ Installation
-
Add the dependency to your
shard.yml:dependencies: quartz: github: umutuluer/quartz -
Install with Shards:
shards install
π¨ Building from Source
Quartz links against a compiled ext/quartz_helper.o object file. Use the provided Makefile to build it:
make # auto-detects your platform (macOS / Linux / Windows)
make mac # force macOS AppKit backend
make gtk # force Linux GTK 3 backend
make qt # force Linux Qt 5/6 backend (QT_VERSION=6 for Qt6)
make win # force Windows Win32 backend
make clean # remove build artifacts
Then compile your Crystal application as usual:
shards build
π API Reference
Application Lifecycle
| Method | Description |
|---|---|
Quartz::Application.run { } |
Starts the application loop |
Quartz::Application.exit |
Terminates the application |
Window
| Method | Description |
|---|---|
Window.new(title, width, height) |
Creates a new window |
window.title = "New Title" |
Changes the window title |
window.show |
Shows the window |
window.add_control(control) |
Adds a child control |
Button
| Method | Description |
|---|---|
Button.new(text, x, y, width, height) |
Creates a push button |
button.text = "Save" |
Updates the button label |
button.on_click { } |
Registers a click callback |
Label
| Method | Description |
|---|---|
Label.new(text, x, y, width, height) |
Creates a read-only label |
label.text |
Gets the current text |
label.text = "Updated" |
Updates the label text |
All controls inherit from
Control, which provides the low-levelhandleandparentproperties.
π§ͺ Examples
Run the included hello-world example:
make examples
./bin/hello_world
Example source: examples/hello_world.cr
ποΈ Architecture
ββββββββββββββββββββββββββββββββββββββββββββ
β Crystal (src/) β
β Application Β· Window Β· Button Β· Label β
β β β
β lib_quartz.cr β
β (C bindings via @[Link]) β
ββββββββββββββββββββ¬ββββββββββββββββββββββββ
β quartz_helper.h
ββββββββββββββββββββ΄ββββββββββββββββββββββββ
β C bridge (ext/) β
β quartz_helper_mac.m ββ AppKit β
β quartz_helper_gtk.c ββ GTK 3 β
β quartz_helper_qt.cpp ββ Qt 5/6 β
β quartz_helper_win.c ββ Win32 API β
ββββββββββββββββββββββββββββββββββββββββββββ
πΊοΈ Roadmap
- macOS AppKit backend
- Linux GTK 3 backend
- Linux Qt 5/6 backend
- Windows Win32 backend
- TextBox / input controls
- CheckBox, RadioButton
- Layout managers (Flow, Grid, Stack)
- ComboBox / DropDown
- File dialogs
- Menu bar & context menus
- Comprehensive test suite
π€ Contributing
Contributions are welcome! Here's how you can help:
- Fork the repository
- Create your feature branch (
git checkout -b my-new-feature) - Commit your changes (
git commit -am 'Add some feature') - Push to the branch (
git push origin my-new-feature) - Open a Pull Request
Please make sure your code follows the existing style and includes appropriate specs.
π License
This project is licensed under the MIT License β see the LICENSE file for details.
π€ Author
Umut ULUER β @umutuluer
Built with β€οΈ and Crystal
quartz
- 0
- 0
- 0
- 0
- 0
- about 4 hours ago
- August 1, 2026
MIT License
Sun, 02 Aug 2026 12:25:42 GMT