As an example, let's develop a custom Chloe component which renders an image stored in a form value. Since the component does not require any configuration, we can define a singleton class:
SINGLETON: image
Now we define a method on the
render* generic word which renders the image using
XML literals:
M: image render* 2drop [XML <img src=<-> /> XML] ;
Finally, we can define a Chloe component:
COMPONENT: image
We can use it as follows, assuming the current form has a value named
image:
<t:image t:name='image' />