SleelaUI GUI examples
A practical, SLeeLa-source example collection for the native GUI API in
/lib/user-interface (the high-level SL* object model) and the related
/lib/ui SDK facade family.
These examples use the documented #sleela 2.5 user-interface classes and
real SleelaUI bridge calls. They are intentionally organized around reusable
patterns: application/window lifecycle, theme selection, component groups,
layout, input, status/feedback, tabs, and interaction polling.
Start here
- CLASSIC Hello Window
- USED Full Widget Gallery
- USED Theme Presets Gallery
- NEW Custom Theme Roles
- Settings Panel
Theme examples
| Example | Theme |
|---|---|
| Default / graphite | SLTheme.DEFAULT |
| White | SLTheme.WHITE |
| Blue | SLTheme.BLUE |
| Black | SLTheme.BLACK |
| Gray | SLTheme.GRAY |
| Legacy Slick Black | SLTheme.SLICK_BLACK |
| Legacy Graphite | SLTheme.GRAPHITE |
| Config-loaded theme | Explicit .conf load |
The five current named presets are Default, White, Blue, Black, and Gray. Legacy IDs Slick Black, Graphite, and Custom remain supported for ABI compatibility. No theme configuration is silently loaded.
Component examples
| Example | Components / APIs |
|---|---|
| Containers and layout | Box, HeaderBar, Grid, Frame, Card, StatusBar, Separator, Spacer |
| Buttons and actions | Button, suggested/destructive, link button, icon |
| Text and input | Label, Heading, Entry, SearchEntry, PasswordEntry |
| Selection controls | Toggle, CheckBox, RadioButton, ComboBox, SpinButton |
| Progress and indicators | Slider, ProgressBar, LevelBar, Spinner, ScrollBar, Throbber |
| Display and feedback | Avatar, Image, Badge, Chip, InfoBar, Tooltip |
| Canvas view | Animated drawing surface and frame-rate target; draw handler binding is host-side |
| Tabs and pages | Notebook, TabBar, VerticalTabs |
| Widget common properties | Margins, alignment, expansion, size, visibility, sensitivity |
| Button event polling | Click, hover, press/release latches |
| Settings panel | Composed real-world preference form |
| SDK family scope | Distinguishes lib/ui model classes from native lib/user-interface bindings |
| SDK object model | Exercises the current lib/ui model methods without claiming native rendering |
| Window lifecycle | Show/hide, title, redraw, single/double/triple buffering |
| Backend and display info | Backend, toolkit version, screen dimensions |
Running
From the repository root after building/installing SLeeLa and SleelaUI:
make -C impl
./impl/build/sleela check examples/gui/CLASSIC-hello-window.sleela
./impl/build/sleela run examples/gui/CLASSIC-hello-window.sleela
Validate every source example without opening windows:
sh examples/gui/check-all.sh
For an individual example, substitute the desired file name. A real desktop session is required for native windows; a headless build can validate/compile source but cannot present an interactive native window.
Theme and component design rules
- Use
SLTheme.DEFAULTunless the application has a reason to choose another. - Keep one suggested/accent action per visual group; reserve destructive styling for genuinely destructive actions.
- Use consistent 10px spacing as the toolkit's practical safe baseline; use smaller gaps only for compact structures such as tab strips.
- Keep interactive hit targets at least 32px; prefer 36px or more.
- Let widgets consume theme roles; do not hard-code individual widget colours to imitate a preset.
- Use
SLWidgetmargin, alignment, expansion, and minimum-size APIs instead of positioning children beyond their parent. - Poll one-shot
clicked()/changed()/take...events from the UI event loop; each latch is consumed when read. - Use VM-local handles only through the SLeeLa wrapper API. They are not native OS pointers.
- A successful source check is not proof that a display backend is available.
API references
The lib/ui directory is the separate unified SDK front-end family; its
classes and feature contracts should not be conflated with the 53-class native
lib/user-interface wrapper family. These runnable GUI examples target the
latter unless explicitly noted.