BotFramework-WebChat icon indicating copy to clipboard operation
BotFramework-WebChat copied to clipboard

Add Custom Background Image to Webchat Using StyleSet

Open akamwand opened this issue 6 years ago • 1 comments

I have been trying to add a custom background image to the webchat window using StyleSet, however, I've had no luck using styleSet as so:

styleSet.activities = { ...styleSet.activities, backgroundImage: "url('myURL')" }

While I realize styleSet may break with WebChat updates, I am just curious whether adding a background image to webchat is possible, and how so if it is?

akamwand avatar Jun 04 '20 06:06 akamwand

@akamwand, presently backgroundImage isn't a supported property in either styleSet or styleOptions (reference here). If you feel this should be added as a feature, you can suggest it as a feature request.

In the meantime, the only way to change the background image is directly thru CSS (see below). The element in question doesn't include an id and the classes are subject to change, so they cannot be relied upon. The "best" option is to target via the element's assigned role. At this moment, it appears that only one element has the "complementary" role assigned to it. Should that change, you will need to parse the elements to get the correct one.

Please bare in mind, your code will be subject to the same conditions as using styleSet (i.e. breaking changes due to Web Chat updates).

div[role=complementary] {
  background-image: url('<<YOUR_URL');
}

Closing this as resolved.

stevkan avatar Jun 04 '20 19:06 stevkan