Next: (hygguile components color), Previous: (hygguile components carousel), Up: API
Show a component and the form that produced it, in one card.
The specimen is the form rendered, and the source beside it is the same form pretty-printed, so the two can never disagree: pass the expression, not a copy of its output. The source is folded away until a reader asks for it, and it carries a copy button, which is what a documentation page is for.
The form is evaluated for display, in an environment holding both the
caller’s bindings and (hygguile hygguile), so a page only writes
its specimen once. Pass value to hand over an already-rendered
fragment instead – useful when the specimen is not something that can
be evaluated, or when you would rather it not be.
The S-expression to show and to render, e.g. '(button "Save").
An already-rendered fragment to show as the specimen, or #f to
render form.
A stable HTML identifier, or #f for a generated one. Give one
when the page has to name the specimen, e.g. to link to it.
The accessible name of the control that unfolds the source.
The text of the button that copies the source.
The title of the notification a copy raises.
List of CSS classes for the card.
List of CSS classes for the row holding the specimen and the fold control.
List of CSS classes for the panel the source lives in.
List of CSS classes for the <pre> itself, replacing the ones
pre chooses; empty leaves the source in the mono face it is set
in.
List of CSS classes for the fold control.
(code-sample '(button "Save"
#:on-click "save()"))
Render datum as the source a reader would write: quoted forms in shorthand, the arguments of a form aligned under its head, and a form that does not fit wrapped at a fixed column width.
The S-expression to render, exactly as the page passes it to the component it shows.
(pretty-code '(button "Save" #:size '(text-sm))) ;; => (button "Save" ;; #:size ;; '(text-sm))
Next: (hygguile components color), Previous: (hygguile components carousel), Up: API