Show HN: A Modern GUI Library for Ada: CSS Styling, XML UI, SDL3
Adi2 A modern GUI library for Ada. Adi2 gives you a real widget toolkit with the niceties developers expect from a modern UI stack — CSS-like styling with live reload, declarative XML layouts, animations, SVG and Lottie graphics, internationalization, and asset bundling — implemented natively in Ada on top of SDL3. Status: in production use, but not yet a stable release — APIs may still change between versions. Status: in production use, but not yet a stable release — APIs may still change between versions. Why Adi2? Style your UI like the web. Selectors, pseudo-classes, parts, transitions, gradients, box shadows — all in a familiar .css syntax. Edit the file, save, see the change. No recompile during development. Prefer pure Ada? CSS rules are just plain Ada aggregates of Style_Rules — write them by hand with no extra ceremony (see the snippet below). Describe UIs declaratively — or don't. Write The toolchain emits a typed Ada package you instantiate from your main — see examples/hello_example.adb for the full ~25-line program. Same thing, written by hand in Ada The CSS rule above is just an aggregate. The XML widget tree is just a few constructor calls. Both paths land on the same API — see examples/hello_raw_example.adb for the full equivalent program. The shape of the styling code is: function Style return Style_Builder renames Adi.Widget_Styles.Create; -- Equivalent of .primary base + :hover from hello_example.css Primary_Base : constant Style_Rules := (Background_Color => Set_Bg (RGB (37, 99, 235)), Border_Radius => Set (Radius (Px (8.0))), Padding => Set (CSS_Box (Px (10.0), Px (16.0))), Transition => Set ((Duration => 0.15, Easing => Ease_Out, Properties => Props (Prop_Background_Color))), others => <>); Primary_Hover : constant Style_Rules := (Background_Color => Set_Bg (RGB (29, 78, 216)), others => <>); -- Wire base + hover to the button's Main_Part Set_Part_Style (Widget_Handle'(+Btn), Main_Part, Style.Base (Primary_Base).On_Hover (Primary_Hover).Build); Build and run either flavour: tools/build_examples.sh hello_example hello_raw_example ./examples/bin/hello_example # XML + CSS pipeline ./examples/bin/hello_raw_example # pure hand-written Ada Quick start # Build the library alr build -- -j0 # Build and run the test suite tools/run_tests.sh # Build all example programs tools/build_examples.sh # ...or just one tools/build_examples.sh stack_example # Try a demo ./examples/bin/material_demo ./examples/bin/html_view_example To use Adi2 from your own project, with "adi.gpr" — SDL linker options come with it. The library's public specs use Ada 2022 constructs, so units that with Adi.* packages need pragma Ada_2022; or -gnat2022. Starting your own project? docs/getting_started.md walks from an empty directory to a working window, in XML/CSS and again in plain Ada. Full build instructions, including building without Alire, in docs/build.md and docs/gprbuild_without_alire.md. Roadmap CSS. Broader CSS surface — more standard properties, selectors and values. HTML view. Tables — table, tr, td/th, column widths, spanning. Flex and grid — display: flex and display: grid inside the document. Widgets and themes. More widgets — tree view, data grid, menu bar, progress and busy indicators, tooltips, split panes, date and colour pickers. Ready-made themes — Material, Fluent, Adwaita and macOS, each in light and dark. Text and reach. Right-to-left and bidirectional text — direction and bidi reordering. Accessibility — semantic roles, names and states to screen readers over AT-SPI, UI Automation and NSAccessibility. Portability. Pluggable backends — an abstraction layer that lets Win32/Direct2D, Cocoa, GLFW, raylib or Skia take the place of SDL3 (design notes). Embedded devices Authoring and tooling. Visual designer — RAD IDE like experience, edit both the UI XML and CSS. Scripting with HAC — embed the HAC Ada compiler for reloadable application logic. Live reload for XML UIs — XML widget trees hot-reload as CSS already does. Better generated docs — browsable API documentation with gnatdoc. Correctness and API. Better callbacks — a callback that fails leaves the app running, callbacks that fire once, and background work that talks to the UI safely (design notes). Contracts — Pre/Post/Type_Invariant and SPARK-mode subsets. C API — a stable C-callable interface for non-Ada callers. Have an idea? Open an issue (see CONTRIBUTING.md for the policy). Supported platforms Tested on GNU/Linux, Windows (XP, 7, 8, 10, 11, via MinGW), macOS, and WebAssembly (Emscripten). Anywhere else GNAT and SDL3 build should follow — the BSDs among them. Rendering goes through the SDL renderer abstraction, so it takes hardware acceleration where the machine offers it and falls back to software where it does not. That is what puts the same binary on Windows XP and on a current desktop. Questions Why "Adi2"? And why is the Ada package still Adi.*? "adi" is too common a word for search engines — Adi2 is findable. The in-code namespace stays Adi.* because with Adi.Widget.Button; reads better than Adi2.Widget.Button and renaming it would churn every source file for zero functional gain. Project = Adi2, package = Adi. Talk A Native, Portable GUI Framework for Ada — 3rd Ada Developers Workshop, AEiC 2026, 13 June 2026. Building an Adi2 application, and driving the running UI from an LLM through the MCP bridge. Part 1 · Part 2 Go deeper Contributing Issues and pull requests welcome. For anything beyond a small fix, please open an issue first so the approach can be discussed before you invest time in it. Match the existing code style (docs/coding_conventions.md), keep the tests green, and add tests for new behaviour. Unless you explicitly state otherwise, contributions you submit are understood to be under the Apache-2.0 license, as per its Section 5 — no CLA to sign. Full details in CONTRIBUTING.md. Sponsoring Adi2 is independently developed and maintained. Sponsorship funds ongoing maintenance, cross-platform testing, documentation, and work on the public roadmap. Organisations interested in supporting the project, or in funding a specific feature, port, or integration: adi@aldustechnology.com. Sponsorship supports the project as a whole. Guaranteed response times or delivery commitments require a separate commercial agreement. License Apache-2.0. See LICENSE. Vendored third-party code under vendor/ retains its original licenses, listed in each tree's own license files. Most are permissive — MIT, Apache-2.0, BSD-style, OFL. vendor/rlottie/src/vector/vinterpolator.cpp is MPL-2.0, a file-level copyleft rather than a permissive licence; its text ships as vendor/rlottie/licenses/COPYING.MPL. Example assets under examples/assets/ are demonstration content rather than part of the library; those with known third-party terms are attributed in examples/assets/NOTICE.md. Contact Adi2 is written by Aldo Nicolas Bruno. Report bugs and propose features through the issue tracker. For private enquiries, sponsored development, or commercial support: adi@aldustechnology.com.