
Hi Mike,
I understand your challenge with pagination buttons in a Google Workspace Add-on. Here are a few suggestions to address your issue:
1. Reducing Button Width
Use Icons Instead of Text: Since MaterialIcon buttons are more compact, consider replacing numbered buttons (e.g., [1], [2]) with icons (e.g., [1️⃣], [2️⃣]) where feasible. While this may not be ideal for all use cases, it can save space.
Custom CSS (Limited): Google Apps Script does not support direct CSS styling for buttons, but you can experiment with .setText() to use shorter labels (e.g., [Pg 1] → [1]).
2. Alternative Pagination UI
Dropdown Menu: Replace the button set with a SelectionInput dropdown for page selection. This is more compact and works well for large page ranges.
}
Prev/Next Only: Simplify to just two buttons (← and →) and dynamically update the card content on navigation. Add a small TextParagraph to display the current page (e.g., "Page 5 of 10").
3. Ellipses Logic Improvement
Your ellipses logic ((1+4)/2 => 2) is clever! To make it more intuitive, you could:
Replace [...] with a ButtonSet of two buttons: [<<] (jump backward) and [>>] (jump forward).
Use a TextInput for direct page entry (though this requires handling user input validation).
4. Example Code for Dynamic Buttons
Here’s a snippet to dynamically generate a compact button set:
5. Further Reading
[Cards Reference](https://developers.google.com/apps-script/reference/card-service) for UI limitations.
Consider using a Navigation object to refresh the card without full reloads (better performance).
If you’d like a more detailed example or have specific constraints, feel free to share more details!