I am not sure what you mean by "add entities". If you want to create object of an existing entity than you can use mx.data.create - https://apidocs.mendix.com/6/client/mx.data.html#.create
If you want to create new entities in the modeler, custom widget is not the right solution. In this case you need the mendix model SDK - https://apidocs.mendix.com/modelsdk/latest/index.html
Hope this helps