Skip to content

Commit 3e0eb01

Browse files
[all hosts] (UI/UX) Copy a UI sample from the conceptual docs (#2301)
* Copy a UI sample from the conceptual docs * Update docs/code-snippets/office-snippets.yaml Co-authored-by: Sam Ramon <[email protected]> --------- Co-authored-by: Sam Ramon <[email protected]>
1 parent 63878e9 commit 3e0eb01

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

docs/code-snippets/office-snippets.yaml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1290,6 +1290,17 @@ Office.ContextMenuUpdaterData#controls:member:
12901290
},
12911291
]
12921292
});
1293+
Office.Control:interface:
1294+
- |-
1295+
// This snippet enables a control (a button) in a custom ribbon tab.
1296+
// Note that "MyButton", "OfficeAddinTab1", and "CustomGroup111" are defined in the manifest.
1297+
const enableButton = async () => {
1298+
const button: Control = { id: "MyButton", enabled: true };
1299+
const parentGroup: Group = { id: "CustomGroup111", controls: [button] };
1300+
const parentTab: Tab = { id: "OfficeAddinTab1", groups: [parentGroup] };
1301+
const ribbonUpdater: RibbonUpdaterData = { tabs: [parentTab] };
1302+
Office.ribbon.requestUpdate(ribbonUpdater);
1303+
}
12931304
Office.CustomXmlNode#baseName:member:
12941305
- |-
12951306
function showXmlNodeBaseNames() {

0 commit comments

Comments
 (0)