bjogui/examples/styles.bjo
Linus Björnstam 8941425f05 Tree views, a styles example, and the Readme for all of it
A tree node is a TreeViewItem: a header and items, patched by key as a
list's items are. The chosen node is chosen by its key, once the nodes are
there, and a click sends the key. SelectedItem is a direct property, which
a clear does not reset, so no choice is set as null.

The Readme now covers menus and keys, dialogs, styles and themes, and the
new controls. docs/styles.png is examples/styles.bjo.

🤖 Generated with [ECA](https://eca.dev) (anthropic/claude-opus-4-8)

Co-Authored-By: eca-agent <git@eca.dev>
2026-10-25 18:10:53 +01:00

38 lines
1.8 KiB
Text

;; This Source Code Form is subject to the terms of the Mozilla Public
;; License, v. 2.0. If a copy of the MPL was not distributed with this
;; file, You can obtain one at http://mozilla.org/MPL/2.0/.
;; bjogui/examples/styles.bjo — styles, classes and the dark theme.
;;
;; bjo run examples/styles.bjo
;;
;; The picture in the Readme is this program, taken with
;;
;; BJOGUI_SCREENSHOT=docs/styles.png bjo run examples/styles.bjo
(import (std prelude))
(import (bjogui view))
(import (bjogui app))
(type (: Msg (Union Nothing)))
(defun (main)
(run-app 0 (fun (msg n) (next n))
(fun (n)
(column #:spacing 12.0 #:margin 20.0
(classed (text "Styled with classes") "title")
(row #:spacing 8.0
(classed (button "Save" Nothing) "primary")
(classed (button "Delete" Nothing) "danger")
(button "Plain" Nothing))
(classed (border (text "a card") #:padding 10.0) "card")
(toggle-switch "Dark mode" #t (fun (b) Nothing))
(number-input 3.0 (fun (d) Nothing) #:width 160.0)
(date-picker "2026-10-25" (fun (d) Nothing))))
#:theme (fun (n) "dark")
#:styles (list (style "text" #:class "title" #:font-size 22.0 #:colour "#f1c40f")
(style "button" #:class "primary" #:background "#27ae60" #:colour "white"
#:hover-background "#2ecc71" #:pressed-background "#1e8449")
(style "button" #:class "danger" #:background "#c0392b" #:colour "white"
#:hover-background "#e74c3c" #:radius 12.0)
(style "border" #:class "card" #:background "#34495e" #:radius 8.0))
#:title "styles" #:width 360.0 #:height 330.0))