To switch to a on hover sidebar, add data-sidenav-size="on-hover" to the <html> tag in your layout. You can apply this dynamically using the LayoutStoreService with setSidenavSize('on-hover').