N
N
Nikolai Kisil2020-01-07 12:40:13
In contact with
Nikolai Kisil, 2020-01-07 12:40:13

How to make buttons in separate rows?

It is necessary that when sending the keyboard, the buttons do not squeeze into one line, but are transferred to different ones.
How to do it?
The code:

keyboard:JSON.stringify(
    {
      "one_time": false,
      "buttons": [
      [{
        "action": {
        "type": "text",
        "payload": "{\"button\": \"1\"}",
        "label": "Помощь"
    },
      "color": "negative"
    },
    {
        "action": {
        "type": "text",
        "payload": "{\"button\": \"1\"}",
        "label": "Бонус"
    },
      "color": "positive"
      },
    {
        "action": {
        "type": "text",
        "payload": "{\"button\": \"2\"}",
        "label": "Админы"
    },
      "color": "positive"
      },
      {
        "action": {
        "type": "text",
        "payload": "{\"button\": \"1\"}",
        "label": "Питомцы"
      },
        "color": "primary"
    },
        {
          "action": {
          "type": "text",
          "payload": "{\"button\": \"2\"}",
          "label": "Привет"
      },
        "color": "positive"
      }]
    ]
      })
});
}
);

Answer the question

In order to leave comments, you need to log in

3 answer(s)
S
Stockholm Syndrome, 2020-01-07
@nikuso

"buttons": [
    [/* кнопка */, /* кнопка */, /* кнопка */],  // 1 ряд
    [/* кнопка */, /* кнопка */, /* кнопка */]  // 2 ряд
]

D
Dmitry Belyaev, 2020-01-07
@bingo347

https://developer.mozilla.org/en/docs/Web/JavaScript...

X
xmoonlight, 2020-01-07
@xmoonlight

Buttons render not in json data.
If there is no such possibility using the API flag for rendering, then no way.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question