Hide button offline

Hide button offline

How I can hide chat button when agent is offline.  Can I do it with API or configuration?