Interactive elements in the playground

If you use square brackets instead of parentheses, the Wipple Playground will render your code as an interactive element. The supported elements include:

ElementExampleScreenshot
Colorcolor [Color "#3b82f6"]color element
Dropdownshow [Dropdown ("A" , "B" , "C") "A"]dropdown element

You can also change how a declaration is highlighted using the Highlight trait and its related types Highlight-Category and Highlight-Icon. For example:

my-if :: Value => Boolean {Value} {Value} -> Value
my-if : if

instance (Highlight my-if (Highlight-Category "control-flow"))

Would be rendered as:

Screenshot of custom-highlighted declaration

You can add an icon, too — the Wipple Playground uses Google’s Material Symbols, so you have access to over 3000 different icons!

instance (Highlight my-if (Highlight-Category "control-flow" ; Highlight-Icon "question-mark"))

Screenshot of declaration with custom icon

Wipple has several highlight categories, including control-flow, io, and library-specific categories like turtle-motion. The full list of categories is at the bottom of theme.ts.