Unfortunately, this can't be accomplished via styleOptions
as it's not an included feature (feature requests can be filed here, btw).
However, this can be accomplished with a little work around. Simply add the following code into your html script where Web Chat is located, starting with the 'webChat' declaration.
To explain, first you must set the parent container to position: relative
. This allows the child div we will create, childHeader
, to take position: absolute
placing the div at the top of the chat window.
We then create the div
element, apply styling, and even add a button (just to show it's possible)! The button, chatHeaderBtn
, is appended to chatHeader
which is, itself, appended to the parent container (webChat
).
At this point, the "header" renders with the page, is fixed in the chat window, and is accessible for further functionality.
<script>
[...]
window.ReactDom.render(
<ReactWebChat
directLine={ directLine }
/>,
document.getElementById( 'webchat' )
);
document.querySelector( '#webChat > *' ).focus()
const webChat = document.getElementById( 'webchat' );
webChat.setAttribute( 'style', 'position: relative' );
const chatHeader = document.createElement('div')
chatHeader.setAttribute( 'style', 'position: absolute; color: black; background-color: darkslategray; height: 5%')
chatHeader.innerText = "I'm a header!";
const chatHeaderBtn = document.createElement('button')
chatHeaderBtn.setAttribute( 'style', 'float: right; background-color: red')
chatHeaderBtn.setAttribute( 'onclick', `alert("Couldn't resist pressing, eh?")`)
chatHeaderBtn.innerText = "Look!...a button!"
chatHeader.appendChild(chatHeaderBtn);
webChat.appendChild(chatHeader);
</script>

Hope of help!