ThatPapaya
ThatPapaya

Reputation: 11

Azure Bot Framework - Wrap card action and button text

I’m having an issue where buttons and actions in hero and adaptive cards won’t wrap text. I have searched the internet and everyone is mentioning a webchat.js and botchat.js files that can be adjusted to fix this. I can’t seem to find those in my code. Has the name changed? I know botchat was changed to webchat. Would anyone happen to know where to fix this in the Basic Bot NodeJS implementation SDK V4?

Upvotes: 1

Views: 504

Answers (2)

ThatPapaya
ThatPapaya

Reputation: 11

I was able to find an answer in node_modules > wordwrap. There is a function that you can call in there to wrap any text you'd like. Thank you @Hessel for the help.

var wrap = require('wordwrap')(70); return CardFactory.heroCard( '', answer, CardFactory.images([]), CardFactory.actions([ { type: 'postBack', title: wrap(YOUR_TEXT), value: YOUR_VALUE } ]) );

Upvotes: 0

Hessel
Hessel

Reputation: 762

Assuming you are using webchat, you could use plain css. This worked for me:

  .ac-pushButton > div {
    white-space: normal !important;
  }

Upvotes: 0

Related Questions