Share via

How to create a toggle button in the ribbon in the Excel JS API

Sharon Choong 40 Reputation points
2026-03-11T19:38:05.1+00:00
Microsoft 365 and Office | Development | Office JavaScript API
0 comments No comments
{count} votes

Answer accepted by question author
  1. Teddie-D 12,925 Reputation points Microsoft External Staff Moderator
    2026-03-12T00:21:44.36+00:00

    Hi @Sharon Choong 

    Thank you for posting your question in the Microsoft Q&A forum. 

    According to Basic concepts for add-in commands - Office Add-ins | Microsoft Learn, Office.js add-ins can only define ribbon buttons and menus, which act as command triggers rather than stateful UI controls. 

    There is no <toggleButton> control in the Office Add-in manifest schema, so Office.js add-ins cannot create RibbonX-style toggle buttons with a persistent pressed state like those available in VBA or COM/VSTO add-ins. 

    As a result, Office.js add-ins typically implement toggle behavior by storing state in the add-in or document and updating workbook behavior, rather than relying on a stateful ribbon control. 

    Please note that this is a user-to-user support forum. Moderators, contributors including external Microsoft employees cannot directly intervene in Microsoft product features or access back-end systems.  Our role here is limited to sharing technical guidance based on publicly available resources and experience 

    If native ribbon toggle buttons are important for your scenario, I recommend submitting feedback through the OfficeDev/office‑js GitHub repository, where feature requests for the Office Add-ins platform are tracked and discussed. 


    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.  


0 additional answers

Sort by: Most helpful

Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.