Share via

Server Ribbon XML

Applies to: SharePoint Foundation 2010

The following topic describes Server ribbon XML and explains the values that are used for the attributes.

Server Ribbon XML Walkthrough

            Description="My New Tab" 
            Title="My New Tab">

The Location on the CommandUIDefinition element defines where the controls inside it will render. In this example, you reference the Tabs collection of the Server ribbon. The _children convention tells the ribbon to insert the following XML into the output for rendering the ribbon. In this case, you are inserting the Tab element XML. The Sequence attribute defines where the tab will render in regards to other tabs. The default tabs use multiples of 100, so the Sequence attribute should not be a multiple of 100 to prevent collisions. Collisions should be avoided to ensure correct handling of the ribbon XML.

                Size="OneLargeTwoMedium" />

When creating a custom tab, you must define how the tab will scale when controls are added. This is handled by using the Scaling element along with a GroupTemplate. The MaxSize element defines the maximum size of the controls in the group. The Scale element defines how the group will scale in different situations. The GroupId attribute associates a group with the scale size. The Size attribute is defined by the Layout element, which is defined later in this topic.

            <Groups Id="Ribbon.CustomTabExample.Groups">
                Description="This is a custom group!" 
                Title="Custom Group" 
                <Controls Id="Ribbon.CustomTabExample.CustomGroupExample.Controls">
                    Description="Says Hello to the World!" 
                    LabelText="Hello, World!" 

The Groups element defines the groups that will appear on the tab. The Group element itself has attributes similar to other controls along with a Template attribute. The Template attribute references the GroupTemplate that is defined later in this topic. The Controls element contains the controls that will render in the group. The acceptable types of controls are defined in Architecture of the Server Ribbon. The controls inside the group must define the TemplateAlias and Command attributes. Like tabs, each control has a Sequence attribute that defines where they will render in the group. The default controls are based on multiples of 10, so any custom controls should not use a multiple of 10 to avoid collisions. The Command attribute is used by the CommandUIHandler element but is required even if the CommandUIHandler is not specified. The TemplateAlias attribute defines where the control will render in relationship to the GroupTemplate.

          <GroupTemplate Id="Ribbon.Templates.CustomTemplateExample">
              <Section Alignment="Top" Type="OneRow">
                  <ControlRef DisplayMode="Large" TemplateAlias="cust1" />
              <Section Alignment="Top" Type="TwoRow">
                  <ControlRef DisplayMode="Medium" TemplateAlias="cust2" />
                  <ControlRef DisplayMode="Medium" TemplateAlias="cust3" />

When defining a group template, you must define it another CommandUIDefinition. The CommandUIDefinition has a location of Ribbon.Templates._children. This is the same pattern that is used for groups and tabs.

The GroupTemplate element contains a Layout element that contains Section or OverflowSection elements. The Layout element has a Title attribute that is used for the Size attribute on the MaxSize and Scale elements.

The Section element has two attributes. The Alignment attribute defines where the controls in the following Row elements are positioned. The Type attribute defines the number how many rows will render inside that section. A Section has a maximum of 3 Row elements.

The Row element contains one or more ControlRef elements. Each ControlRef element defines how a single control renders in the ribbon. The DisplayMode attribute has the following values.


Not all controls have all DisplayMode values available.




Renders as a small icon without label text.


Renders as a 16 by 16 icon with label text.


Renders as a 32 by 32 icon with label text.


Renders as text only.

You can also have an OverflowSection element instead of a Section element. This element defines an area where multiple controls can render without the need for the Row elements. All controls render the same size defined by the DisplayMode attribute. The DividerAfter and DividerBefore attributes define where the divider appears when the overflow section is rendered.

When adding controls to the default ribbon locations, you should consider the group template and scaling. Adding a control to the default locations can alter the rendering of the group. Most of the default group templates contain overflow sections that grow with your custom controls. In more advanced scenarios, you can override the scaling to render the controls as necessary for your design.

          CommandAction="javascript:alert('Hello, world!');" />
          CommandAction="javascript:alert('Good-bye, world!');" />
          CommandAction="javascript:alert('I love you, world!');" />

The CommandUIHandlers element contains all of the CommandUIHandler elements. The CommandUIHandler elements define how controls on the ribbon respond to an action. The Command attribute is a unique name for the command that is used in conjunction with the Command attribute defined with the controls. The CommandAction attribute contains the action that is performed for the control. This can be ECMAScript (JavaScript, JScript), a URL, or anything that was previously contained in an UrlAction element.

<?xml version="1.0" encoding="utf-8"?>
<Elements xmlns="">

When customizing the ribbon, you use a CustomAction element along with ribbon XML. For more information about custom actions, see Custom Action. The Location attribute tells the CustomAction where to apply the customization. The following table explains the values.




Customization appears everywhere for the specified RegistrationId.


Customization appears when the list view Web Part is present.


Customization appears on the edit form.


Customization appears on the new form.


Customization appears on the display form.

See Also


Declarative Customization of the Server Ribbon

Default Server Ribbon Customization Locations

Architecture of the Server Ribbon

Server Ribbon Schema