telebot-ts API Documentation - v1.0.0
    Preparing search index...

    Class PaginationKeyboard<T>

    Fluent builder for creating paginated InlineKeyboardMarkup menus.

    const products = ["Item 1", "Item 2", "Item 3", "Item 4", "Item 5", "Item 6"];
    const keyboard = new PaginationKeyboard({
    items: products,
    page: 1,
    pageSize: 3,
    itemButton: (product) => ({ text: product, callback_data: `buy:${product}` }),
    callbackData: (action, targetPage) => `page:${targetPage}`,
    navigation: {
    prev: "Previous",
    next: "Next",
    pageIndicator: (curr, total) => `Page ${curr} of ${total}`,
    },
    });

    await bot.sendMessage({
    chat_id: 12345,
    text: "Store Catalog:",
    reply_markup: keyboard.build(),
    });

    Type Parameters

    • T = unknown
    Index
    • get currentPage(): number

      Gets the active page clamped between 1 and totalPages.

      Returns number

    • get totalPages(): number

      Calculates the total number of pages.

      Returns number