Help component for displaying key bindings.
Usage: (def bindings [{:key "j/k" :desc "up/down"} {:key "q" :desc "quit"}]) (def my-help (help bindings))
;; In view function: (help-view my-help)
Help component for displaying key bindings.
Usage:
(def bindings [{:key "j/k" :desc "up/down"}
{:key "q" :desc "quit"}])
(def my-help (help bindings))
;; In view function:
(help-view my-help)(from-pairs & args)Create bindings from pairs of [key desc] or interleaved key desc args.
Examples: (from-pairs ["j/k" "up/down"] ["q" "quit"]) (from-pairs "j/k" "up/down" "q" "quit")
Create bindings from pairs of [key desc] or interleaved key desc args. Examples: (from-pairs ["j/k" "up/down"] ["q" "quit"]) (from-pairs "j/k" "up/down" "q" "quit")
(help bindings
&
{:keys [width separator show-all key-style desc-style separator-style
ellipsis id]
:or {width 0
separator " • "
show-all false
ellipsis "…"
id (rand-int 1000000)}})Create a help component.
Bindings is a sequence of maps with :key and :desc keys, or a sequence of [key desc] pairs.
Options: :width - Maximum width (0 = unlimited) :separator - Separator between bindings (default " • ") :show-all - Show full help instead of short (default false) :key-style - Style for key text :desc-style - Style for description text :separator-style - Style for separator :ellipsis - Ellipsis when truncated (default "…") :id - Unique ID
Create a help component. Bindings is a sequence of maps with :key and :desc keys, or a sequence of [key desc] pairs. Options: :width - Maximum width (0 = unlimited) :separator - Separator between bindings (default " • ") :show-all - Show full help instead of short (default false) :key-style - Style for key text :desc-style - Style for description text :separator-style - Style for separator :ellipsis - Ellipsis when truncated (default "…") :id - Unique ID
(help-init hlp)Initialize help, returns [help cmd].
Initialize help, returns [help cmd].
(help-update hlp _msg)Update help state. Help components don't typically handle messages directly - use toggle-show-all for ? key handling in your update fn. Returns [help nil].
Update help state. Help components don't typically handle messages directly - use toggle-show-all for ? key handling in your update fn. Returns [help nil].
(help-view hlp)Render the help to a string.
Render the help to a string.
(set-show-all hlp show?)Set whether to show full help.
Set whether to show full help.
(set-width hlp w)Set the width constraint.
Set the width constraint.
(show-all? hlp)Check if showing full help.
Check if showing full help.
(toggle-show-all hlp)Toggle between short and full help.
Toggle between short and full help.
cljdoc builds & hosts documentation for Clojure/Script libraries
| Ctrl+k | Jump to recent docs |
| ← | Move to previous article |
| → | Move to next article |
| Ctrl+/ | Jump to the search field |