Theming stuff in Drupal 8? How do you theme stuff in Drupal 8? In 7, for example, if you had some data items you could call item_list, via the theme function, pass in a render array and get your markup back.

This is a great resource for those interested: Render API, but no examples that I can see.

How do I do this in Drupal 8? For example, how do I theme an image? Sure,
I can probably construct my render array, but does it then have to go off to a twig template or something. Are there any examples yet?

Thanks.
It seems to be similar to D7. Just use a render array:

$list = array('apples', 'peaches', 'pears');
$render_array = array(
  '#theme' =&gt; 'item_list',
  '#items' =&gt; $list,
  '#title' =&gt; t('Argument Information'),
);
return $render_array;


I searched '#theme' in core\modules to find examples. Not sure if this is the 'correct' way though?