Declarative sandbox solutions are indeed supported in the SharePoint Online. Code-behind are not. Best option for this would be based on the detailed use case and scenario, but I'd approach this as follows.
- Upload file to centralized location - could be CDN or for example root site collection of particular tenant
For deployment perspective would use PnP PowerShell, unless this should be automated. This way you can simply write scripts, which are pushing this to all site collections without requirement to go to UIs for activating sandbox solutions.
Note. This model ONLY works on classic mode, not in the modern sites. For modern sites, there's currently no supported way to do similar UI widgets. Work to enable that for them is on it's way, but can provide detailed schedules on that.
Like mentioned, obviously detailed scenario does have impact on the right design as well. How often this should be done, how it's integrated to new site collection creation, is it one time change etc.