Skip to content
This repository was archived by the owner on Dec 31, 2019. It is now read-only.

Commit 4f6028e

Browse files
committed
Add components/contextual menu closing #27
1 parent 6bb4db3 commit 4f6028e

File tree

2 files changed

+135
-2
lines changed

2 files changed

+135
-2
lines changed
Lines changed: 133 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,133 @@
1+
<!DOCTYPE html>
2+
<html>
3+
4+
<head lang="en">
5+
<title>Office UI Fabric - Components - Contextual Menu</title>
6+
<meta charset="UTF-8">
7+
<!-- fav icons -->
8+
<link rel="shortcut icon" href="/img/favicon/favicon.ico">
9+
<link rel="apple-touch-icon" sizes="57x57" href="/img/favicon/apple-touch-icon-57x57.png">
10+
<link rel="apple-touch-icon" sizes="114x114" href="/img/favicon/apple-touch-icon-114x114.png">
11+
<link rel="apple-touch-icon" sizes="72x72" href="/img/favicon/apple-touch-icon-72x72.png">
12+
<link rel="apple-touch-icon" sizes="144x144" href="/img/favicon/apple-touch-icon-144x144.png">
13+
<link rel="apple-touch-icon" sizes="60x60" href="/img/favicon/apple-touch-icon-60x60.png">
14+
<link rel="apple-touch-icon" sizes="120x120" href="/img/favicon/apple-touch-icon-120x120.png">
15+
<link rel="apple-touch-icon" sizes="76x76" href="/img/favicon/apple-touch-icon-76x76.png">
16+
<link rel="apple-touch-icon" sizes="152x152" href="/img/favicon/apple-touch-icon-152x152.png">
17+
<link rel="apple-touch-icon" sizes="180x180" href="/img/favicon/apple-touch-icon-180x180.png">
18+
<link rel="icon" type="image/png" href="/img/favicon/favicon-192x192.png" sizes="192x192">
19+
<link rel="icon" type="image/png" href="/img/favicon/favicon-160x160.png" sizes="160x160">
20+
<link rel="icon" type="image/png" href="/img/favicon/favicon-96x96.png" sizes="96x96">
21+
<link rel="icon" type="image/png" href="/img/favicon/favicon-16x16.png" sizes="16x16">
22+
<link rel="icon" type="image/png" href="/img/favicon/favicon-32x32.png" sizes="32x32">
23+
24+
<!-- azure application insights -->
25+
<script src="/js/azure-app-insights.js" type="text/javascript"></script>
26+
27+
<!-- codepen -->
28+
<script async src="//assets.codepen.io/assets/embed/ei.js"></script>
29+
30+
<link rel="stylesheet" href="//appsforoffice.microsoft.com/fabric/1.0/fabric.min.css" />
31+
<link rel="stylesheet" href="//appsforoffice.microsoft.com/fabric/1.0/fabric.components.min.css" />
32+
<link rel="stylesheet" href="/css/styles.min.css" />
33+
</head>
34+
35+
<body>
36+
<div class="ms-Grid">
37+
<!-- header -->
38+
<header id="page-header" class="ms-Grid-row ms-Grid-col ms-u-sm12">
39+
<div id="brand-name" class="ms-font-su ms-fontWeight-semibold ms-fontColor-white">
40+
Office Fabric UI
41+
</div>
42+
<div id="site-tagline" class="ms-font-l ms-fontColor-white ms-fontWeight-light">
43+
Demos of the front-end framework for building experiences using Office, Office 365 &amp; SharePoint.
44+
</div>
45+
</header>
46+
47+
<!-- navigation -->
48+
<nav class="ms-Grid-row ms-Grid-col ms-u-sm12">
49+
<ul id="global-nav">
50+
<li class="ms-font-l ms-fontWeight-light"><a href="/">Home</a></li>
51+
<li class="ms-font-l ms-fontWeight-light"><a href="/features">Features</a></li>
52+
<li class="ms-font-l ms-fontWeight-light"><a href="/components">Components</a></li>
53+
<li class="ms-font-l ms-fontWeight-light"><a href="/resources.html">Resources</a></li>
54+
<li class="ms-font-l ms-fontWeight-light"><a href="/status.html">Status</a></li>
55+
<li class="ms-font-l ms-fontWeight-light"><a href="/contribute.html">Contribute!</a></li>
56+
</ul>
57+
</nav>
58+
59+
<div class="ms-Grid-row">
60+
<!-- side-nav -->
61+
<aside id="local-nav" class="ms-Grid-col ms-u-sm-3 ">
62+
<ul>
63+
<li><a class="ms-font-l ms-fontColor-neutralSecondaryAlt" href="#Top">Contextual Menu</a></li>
64+
<li><a class="ms-font-l ms-fontColor-neutralSecondaryAlt" href="#Usage">Usage</a></li>
65+
<li><a class="ms-font-l ms-fontColor-neutralSecondaryAlt" href="#Submenus">Submenus</a></li>
66+
<li><a class="ms-font-l ms-fontColor-neutralSecondaryAlt" href="#Dividers">Dividers</a></li>
67+
<li><a class="ms-font-l ms-fontColor-neutralSecondaryAlt" href="#Headings">Headings &amp; Multi-select</a></li>
68+
</ul>
69+
</aside>
70+
71+
<!-- page body -->
72+
<article id="page-main" class="ms-Grid-col ms-u-sm9 ms-font-m">
73+
<a name="Top"></a>
74+
<p class="ms-font-su"><a href="/components" class="ms-Link">Components</a> <i class="ms-Icon ms-Icon--caretRight" aria-hidden="true"></i> Contextual Menu</p>
75+
<p class="ms-font-l">The Office UI Fabric contains a contextual menu, or a right-click menu, that can be used on pages or within other controls like the <a href="/components/nav-bar" class="ms-Link">Nav Bar</a> control.</p>
76+
77+
<p class="ms-font-l"><i class="ms-Icon ms-Icon--chevronsUp"></i><a href="#Top" class="ms-Link">Back to top</a></p>
78+
79+
<a name="Usage"></a>
80+
<p class="ms-font-xxl">Usage</p>
81+
<p class="ms-font-l">The contextual menu is implemented as a <code>&lt;ul&gt;</code> list decorated with the <code>.ms-ContextualMenu</code> class. It isn't visible by default but when the css class <code>.is-open</code> class is added to the <code>&lt;ul&gt;</code> element, the menu is made visible.</p>
82+
<p class="ms-font-l">Each list item is implemented as a <code>&lt;li&gt;</code> decorated with the CSS class <code>.ms-ContextualMenu-item</code> class. You can indicate if an item is currently selected by setting the <code>.is-selected</code> class on the nested <code>&lt;a&gt;</code> tag, or mark it as disabled using the <code>.is-disabled</code> class.</p>
83+
<p class="ms-font-l">You will want to add JavaScript to clear out the placeholder when the control receives focus as shown in the following snippets. An example of this code, using jQuery, can be found in the Office UI Fabric component distribution: <a href="https://github.com/OfficeDev/Office-UI-Fabric/blob/master/src/components/ContextualMenu/Jquery.ContextualMenu.js" class="ms-Link">Jquery.ContextualMenu.js</a>. This also means that you must include a reference to jQuery as the <code>JQuery.ContextualMenu.js</code> depends on the presence of jQuery.</p>
84+
85+
<!-- codepen snippet -->
86+
<p data-height="333" data-theme-id="19054" data-slug-hash="wKoeVN" data-default-tab="result" data-user="andrewconnell" class='codepen'>See the Pen <a href='http://codepen.io/andrewconnell/pen/wKoeVN/'>Office UI Fabric - Context Menu (Standard)</a> by Andrew Connell (<a href='http://codepen.io/andrewconnell'>@andrewconnell</a>) on <a href='http://codepen.io'>CodePen</a>.</p>
87+
<!-- /codepen snippet -->
88+
89+
<p class="ms-font-l"><i class="ms-Icon ms-Icon--chevronsUp"></i><a href="#Top" class="ms-Link">Back to top</a></p>
90+
91+
<a name="Submenus"></a>
92+
<p class="ms-font-xxl">Submenus</p>
93+
<p class="ms-font-l">To implement a submenu in the contextual menu control you simply next another contextual menu control within the list item that contains the menu item that should open it. You will likely want to add some extra styling, such as an icon, to indicate there's a submenu as shown in the following snippet:</p>
94+
95+
<!-- codepen snippet -->
96+
<p data-height="334" data-theme-id="19054" data-slug-hash="rOWzBe" data-default-tab="result" data-user="andrewconnell" class='codepen'>See the Pen <a href='http://codepen.io/andrewconnell/pen/rOWzBe/'>Office UI Fabric - Context Menu (Submenu)</a> by Andrew Connell (<a href='http://codepen.io/andrewconnell'>@andrewconnell</a>) on <a href='http://codepen.io'>CodePen</a>.</p>
97+
<!-- /codepen snippet -->
98+
99+
<p class="ms-font-l"><i class="ms-Icon ms-Icon--chevronsUp"></i><a href="#Top" class="ms-Link">Back to top</a></p>
100+
101+
<a name="Dividers"></a>
102+
<p class="ms-font-xxl">Dividers</p>
103+
<p class="ms-font-l">To add a divider in the menu, add another <code>&lt;li&gt;</code> to the menu, but add the CSS class <code>.ms-ContextualMenu-item--divider</code> with nothing else in the item as shown in the following example:</p>
104+
105+
<!-- codepen snippet -->
106+
<p data-height="393" data-theme-id="19054" data-slug-hash="pjNroo" data-default-tab="result" data-user="andrewconnell" class='codepen'>See the Pen <a href='http://codepen.io/andrewconnell/pen/pjNroo/'>Office UI Fabric - Context Menu (Dividers)</a> by Andrew Connell (<a href='http://codepen.io/andrewconnell'>@andrewconnell</a>) on <a href='http://codepen.io'>CodePen</a>.</p>
107+
<!-- /codepen snippet -->
108+
109+
<p class="ms-font-l"><i class="ms-Icon ms-Icon--chevronsUp"></i><a href="#Top" class="ms-Link">Back to top</a></p>
110+
111+
<a name="Headings"></a>
112+
<p class="ms-font-xxl">Headings and Multi-select</p>
113+
<p class="ms-font-l">Add a non-selectable heading to the menu for groups of items, typically seperated with dividers, by adding another <code>&lt;li&gt;</code> item and add the CSS class <code>.ms-ContextualMenu-item--header</code>. In addition you can make the menu items multi-selectable by adding the CSS class <code>.ms-ContextualMenu--multiselect</code> which lets you pick check-marks next to multiple list items. This class should be added to the top-level <code>&lt;ul&gt;</code> element.</p>
114+
115+
<!-- codepen snippet -->
116+
<p data-height="469" data-theme-id="19054" data-slug-hash="rOWzNL" data-default-tab="result" data-user="andrewconnell" class='codepen'>See the Pen <a href='http://codepen.io/andrewconnell/pen/rOWzNL/'>Office UI Fabric - Context Menu (Headings+Multiselect)</a> by Andrew Connell (<a href='http://codepen.io/andrewconnell'>@andrewconnell</a>) on <a href='http://codepen.io'>CodePen</a>.</p>
117+
<!-- /codepen snippet -->
118+
119+
<p class="ms-font-l"><i class="ms-Icon ms-Icon--chevronsUp"></i><a href="#Top" class="ms-Link">Back to top</a></p>
120+
121+
</article>
122+
</div>
123+
124+
<!-- footer -->
125+
<footer id="page-footer" class="ms-Grid-row ms-Grid-col ms-u-sm12 ms-font-m ms-fontWeight-light ms-fontColor-white">
126+
<p>Microsoft, Office, Office 365 and SharePoint are registered trademarks of Microsoft Corporation.</p>
127+
<p>Current Version of the Office UI Fabric used on this site: v1.0.0</p>
128+
</footer>
129+
130+
</div>
131+
132+
</body>
133+
</html>

components/index.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -234,8 +234,8 @@
234234
</button>
235235
</div>
236236
<div class="ms-Grid-col ms-u-sm3 ms-font-l">
237-
<button class="ms-Button ms-Button--hero" onclick="goIssue('27');">
238-
<span class="ms-Button-icon"><i class="ms-Icon"></i></span>
237+
<button class="ms-Button ms-Button--hero" onclick="goComponent('contextual-menu');">
238+
<span class="ms-Button-icon"><i class="ms-Icon ms-Icon--check"></i></span>
239239
<span class="ms-Button-label">Contextual Menu</span>
240240
</button>
241241
</div>

0 commit comments

Comments
 (0)