Hi Luca,
if this question is still alive:
You can implement the function getPreview(...) in the ts-file <widgetname>.editorConfig.ts. If you have generated the skeleton of your widget with the cli, the file should already be there.
In this method, you can define the structure of your preview.
Find more information in the Mendix documentation here.
Hope that helps!
Best,
Holger