You’ll need to create the widget itself in native code but you’ll also likely need to use Capacitor to set the data used by the widget as well as to trigger a widget refresh anytime you update it.
I used this plugin for iOS and it worked nicely. For Android I had to use custom code and it was more complicated, but that’s partially because I used an Android ListView in the widget.
There is also this Capacitor plugin that supports iOS and Android but I haven’t tried it.