Vertical list of buttons

User ask for something, the bot emits a list of buttons, user click one, the bot acts on it…and bob is your uncle.

However, the problem starts when each button item has very long texts. Rasa crunches these texts and shove all the buttons horizontally.

Is there a way to display buttons vertically? Like one by one, per line?

I came across this github issue where @erohmensing suggested the use of button_type: vertical.

Maybe that can work if my resonses are already known and hardocoded in domains.yml

But my response is a result of a network call. And I cant find where or how to implement it using either utter_button_message or utter_message

I am not particularly hung on buttons though. If an unordered list will work, fine.

So if buttons cant be implemented vertically for my use-case, can you please show me how to display a list of items and make each clickable like a button to specific payloads?

@amn41 suggested here that you can utter these items one by one…and that might work, but what if the List span many items? Wont that be too cringe-worthy?


Hey @wale, I believe you should be able to pass any keyword args through utter_message. For example:

buttons = [{},{}]  # some list of button dicts, doesn't matter 

dispatcher.utter_message(text="Some message", buttons=buttons, button_type=vertical)

However, this will only work on the telegram frontend because that is the channel that defines that keyword argument.

Otherwise, you would have to check with whichever connector you are using to see if there is an easy way to output the buttons – this logic is handled in the connector, which you can customize.

Thanks for your response!!! Yes, that might work, for telegram. I haven’t tried it yet though.

I would prefer something more universal, like with fb msg too. But thats ok. I have implemented another approach.

Now, i am emitting each in a separate message. Each message has all the real-estate it needs. No need to crunch all together.

I believe this is a temporary solution however. But that will do for now.

Thanks again!!!

Seems like the best shortterm solution. Unfortunately each platform has different formats for outputs and what it can accomplish, so we can only do so much :grinning_face_with_smiling_eyes:

1 Like

You have actually done so much! Top top job and kudos to the whole team and the community!!!

:heart_eyes: :heart_eyes: :heart_eyes:

1 Like

Appreciate the Rasa love!

I am beginner in rasa can you please provide me a sample code how can we use it? And where we have to use it in your code .