File tree Expand file tree Collapse file tree 1 file changed +47
-0
lines changed
Expand file tree Collapse file tree 1 file changed +47
-0
lines changed Original file line number Diff line number Diff line change @@ -217,3 +217,50 @@ line, and have no borders: they are not a pop-up window.
217217 :gravity :cursor
218218 :use-border nil))))
219219```
220+
221+ ## Buttons
222+
223+ Lem makes it easy to display buttons, with text and/or icons: place
224+ them at a given point, define an action to run on click, and voilà:
225+
226+ ``` lisp
227+ (in-package :lem)
228+
229+ (defun btn-clicked ()
230+ (message "clicked!"))
231+
232+ (lem/button:insert-button (current-point) "hello btn" #'btn-clicked)
233+ ```
234+
235+ This "hello btn" text isn't styled in any way, it is just text. But
236+ you can click on it and trigger an action.
237+
238+ Clicking might not work in your terminal, though.
239+
240+ The full ` insert-button ` signature is:
241+
242+ (defun insert-button (point text &optional callback &rest plist)
243+
244+ It accepts any other argument as a plist. This can be used to give:
245+
246+ ```
247+ :button-tag
248+ :attribute
249+ ```
250+
251+ or any other key-value pair to the ` make-button ` constructor.
252+
253+ Buttons are used in the lisp inspector, in the dashboard, in the
254+ Claude Code window, and other places.
255+
256+ See:
257+
258+ - [ ` src/ext/button.lisp ` ] ( https://github.com/lem-project/lem/blob/main/src/ext/button.lisp )
259+
260+ ### Icons
261+
262+ You can add an icon to your button:
263+
264+ ~~~ lisp
265+ (lem/button:insert-button point (lem:icon-string "down-pointing-triangle") #'btn-clicked)
266+ ~~~
You can’t perform that action at this time.
0 commit comments