tui.el icon indicating copy to clipboard operation
tui.el copied to clipboard

Random button dashboard

Open nickdrozd opened this issue 4 years ago • 1 comments

(tui-define-component tui-random
  :get-initial-state
  (lambda ()
    `(:current-number ,(random 100)))
  :render
  (lambda ()
    (tui-let (&state current-number)
      (tui-div
       (tui-line
        "Random number: "
        current-number)
       (tui-link
        :target
        (lambda ()
          (tui--set-state
           component
           `(:current-number ,(number-to-string (random 100)))))
        "Regenerate")))))

nickdrozd avatar Sep 08 '19 19:09 nickdrozd

See the current dev branch.

Useful for testing:

(tui-render-with-buffer "*random-button-test*"
  (tui-random))

Use tui-button for the button styling you were aiming for. Want to create a PR into dev to add that demo?

ebpa avatar Sep 08 '19 19:09 ebpa