Group#
Group widget does more complex unions. By default, it places one keyboard below another. For example, you can stack multiple rows (or groups, or whatever)
from aiogram_dialog.widgets.kbd import Button, Group, Row
from aiogram_dialog.widgets.text import Const
group = Group(
Row(
Button(Const("Go"), id="go"),
Button(Const("Run"), id="run"),
),
Button(Const("Fly"), id="fly"),
)
Also it can be used to produce rows of fixed width. To do it just set width
to desired value. Row
and Column
widgets are groups with predefined width.
from aiogram_dialog.widgets.kbd import Button, Group
from aiogram_dialog.widgets.text import Const
group = Group(
Button(Const("Crawl"), id="crawl"),
Button(Const("Go"), id="go"),
Button(Const("Run"), id="run"),
Button(Const("Fly"), id="fly"),
Button(Const("Teleport"), id="tele"),
width=2,
)