quartz

A Windows Forms-inspired, cross-platform GUI toolkit for Crystal

Quartz logo

Quartz

A Windows Forms-inspired, cross-platform GUI toolkit for Crystal

CI License Crystal Platforms


✨ 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
macOS AppKit (Cocoa)
Linux GTK 3 or Qt 5/6
Windows Win32 API

πŸ§ͺ Tested On

Quartz has been verified to work on the following environments:

OS Backend Status
macOS 26 AppKit βœ… Working
CachyOS GTK 3 βœ… Working
CachyOS 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

  1. Add the dependency to your shard.yml:

    dependencies:
      quartz:
        github: umutuluer/quartz
    
  2. 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-level handle and parent properties.


πŸ§ͺ 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:

  1. Fork the repository
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. 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

Repository

quartz

Owner
Statistic
  • 0
  • 0
  • 0
  • 0
  • 0
  • about 4 hours ago
  • August 1, 2026
License

MIT License

Links
Synced at

Sun, 02 Aug 2026 12:25:42 GMT

Languages