botframeworkbot-framework-composer

Why does choice not display as buttons?


I have a simple bot in Python with a prompt which contains multiple options. However, I've noticed when the options go above three, or one of the text increases in the length, The options are no longer displayed as buttons in Teams, but rather as a list?

Is there anyway to force the options to be displayed as buttons?

PromptOptions(
            prompt=MessageFactory.text("Hi \uD83D\uDC4B. How are you feeling today? "),
            choices=[Choice("Good"), Choice("Bad"), Choice("Sad"),Choice("Mad"),Choice("Glad"),Choice("Upside")],
        ),

enter image description here


Solution

  • You can set the list style:

    https://github.com/microsoft/botbuilder-python/blob/31d0ffe2c079afe4c437e0de12dfbc2ef8c08964/libraries/botbuilder-dialogs/botbuilder/dialogs/choices/list_style.py

    https://github.com/microsoft/botbuilder-python/blob/main/libraries/botbuilder-dialogs/botbuilder/dialogs/prompts/prompt_options.py

    I know that there are some areas that will do the behavior you mentioned (show buttons if under a certain amount, a list if over). But I'm assuming that is related to the 'auto' setting. Please try setting to use Suggested Actions or whatever format you wish and see if that works.