The easiest way to create buttons is using XML files. If you need it to be 'on demand' in a sense, then you can create a virtual control in an XML file, and create a button from that virtual template whenever you need it.
However, if you really want to create it from scratch in Lua, you can use WindowManager:CreateControl(string arg1, object parent, number type), with CT_BUTTON as the type. Or you can use WindowManager:CreateControlFromVirtual with some ZOS defined virtual template.
You mean a button in the top row menu if you open the inventory e.g.?
There's a librray to add a button, I think votan has provided it within some addons like PotionMaker.
Check the libs folder there for "LibMainMenu-2.0" (be sure to use libMainMenu 2, not LibMainMenu as this is another library provided by Ayantir within Superstar e.g. if I remember correctly, adding a scene for some menus!).
Search for code in the addon files (search for "LibMainMenu-2.0").