Widgets and Rendering#

Base information#

Currently there are 4 kinds of widgets: texts, keyboards, input, media and you can create your own widgets.

  • Texts used to render text anywhere in dialog. It can be message text, button title and so on.

  • Keyboards represent parts of InlineKeyboard

  • Media represent media attachment to message

  • Input allows to process incoming messages from user. Is has no representation.

Widgets can display static (e.g. Const) and dynamic (e.g. Format) content. To use dynamic data you have to set it. See passing data.

Also there are 2 general types:

  • Whenable can be hidden or shown depending on data or some conditions. Currently all widgets are whenable. See: Hiding widgets

  • Actionable is any widget with action (currently only any type of keyboard). It has id and can be found by that id. It recommended for all stateful widgets (e.g Checkboxes) to have unique id within dialog. Buttons with different behavior also must have different ids.

Note

Widget id can contain only ascii letters, numbers, underscore and dot symbol.

  • 123, com.mysite.id, my_item - valid ids

  • hello world, my:item, птичка - invalid ids