---
schema_version: "1"
id: 8eb386d61deab93280bc89edc01a7b8139c875e222e8d02791725f683fb45ab1
title: Show and Hide the Chat Button in Enhanced Web Chat
collection: developer
version: current
locale: en-us
portal_url: https://docs.salesforce.com/developer/current/en-us/service-cloud/messaging-web/guides/show-hide-chat.md
canonical_url: https://developer.salesforce.com/docs/service/messaging-web/guide/show-hide-chat.html
source_site: developer.salesforce.com
content_type: documentation
content_hash: 9a4ed166bdd73131ad99ee3e399e5015f81931d4d7ca17e15561cb324dffc23a
products:
  - Enhanced Web Chat
  - Service Cloud Developer Content
---
# Show and Hide the Chat Button in Enhanced Web Chat

When setting up your website, you can determine whether the chat button is initially hidden or shown. Also, you can programmatically show or hide the button after initialization.

## Initial Chat Button State

By default, the chat button is always shown if no business hours are specified. If business hours are specified, the chat button is shown during business hours and hidden outside of business hours. To learn how to configure business hours, see [Set Business Hours in Enhanced Chat](https://help.salesforce.com/s/articleView?id=service.miaw_business_hours.htm).


If you want to override this default behavior, set the `embeddedservice_bootstrap.settings.hideChatButtonOnLoad` flag (to either `true` or `false`) before the `embeddedservice_bootstrap.init` line in your code snippet. For example:

```javascript
// Override default behavior and hide the chat button at initialization
embeddedservice_bootstrap.settings.hideChatButtonOnLoad = true;

// Enhanced Web Chat init call
embeddedservice_bootstrap.init(...initalization info...);
```

**note:** The chat button returns to this same initial state after the chat window closes.

## Chat Button After Initialization

To change the chat button state after initialization, add an event listener for the `onEmbeddedMessagingButtonCreated` event and use the following methods: `embeddedservice_bootstrap.utilAPI.showChatButton` and `embeddedservice_bootstrap.utilAPI.hideChatButton`.

```javascript
// Show chat button
embeddedservice_bootstrap.utilAPI.showChatButton();

// Hide chat button
embeddedservice_bootstrap.utilAPI.hideChatButton();
```

**note:** You can't hide the chat button if the chat window is already showing. Also, these methods don't have session continuity; for example, after a refresh, the button returns to its initial state. If business hours are specified, these calls only override the current visibility until the next business hours interval.

See the Enhanced Web Chat [reference documentation](/docs/service/messaging-web/references) for details.
