The Ubuntu Settings app is very light on when looking at the power button and lid actions, excluding most of the options a Windows user has to change the customise button/lid actions between AC Power and battery power operation.
Fortunately there is an easy command line tool that allows these settings to be changes easily within the Gnome environment,
To list all the available power options, open a terminal and type in
gsettings list-recursively org.gnome.settings-daemon.plugins.power
This command will show that available options and their current values.
To set it the lid close action to do ‘nothing’ when on AC power, execute
gsettings set org.gnome.settings-daemon.plugins.power lid-close-ac-action 'nothing'
This command will be helpful for people using USB-C docks and the like, with an external monitor, keyboard and mouse that would like to leave the notebook closed and to one side while working, but still be able to close the lid to suspend the PC when travelling.