<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Horizontal Nav in Office UI Fabric &#8211; Sibeesh Passion</title>
	<atom:link href="https://mail.sibeeshpassion.com/tag/horizontal-nav-in-office-ui-fabric/feed/" rel="self" type="application/rss+xml" />
	<link>https://mail.sibeeshpassion.com</link>
	<description>My passion towards life</description>
	<lastBuildDate>Tue, 20 Aug 2019 09:00:06 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=6.9.4</generator>

<image>
	<url>/wp-content/uploads/2017/04/Sibeesh_Passion_Logo_Small.png</url>
	<title>Horizontal Nav in Office UI Fabric &#8211; Sibeesh Passion</title>
	<link>https://mail.sibeeshpassion.com</link>
	<width>32</width>
	<height>32</height>
</image> 
	<item>
		<title>Creating a Custom Horizontal Nav Component Using React Office UI Fabric</title>
		<link>https://mail.sibeeshpassion.com/creating-a-custom-horizontal-nav-component-using-react-office-ui-fabric/</link>
					<comments>https://mail.sibeeshpassion.com/creating-a-custom-horizontal-nav-component-using-react-office-ui-fabric/#disqus_thread</comments>
		
		<dc:creator><![CDATA[SibeeshVenu]]></dc:creator>
		<pubDate>Tue, 16 Oct 2018 21:37:40 +0000</pubDate>
				<category><![CDATA[React]]></category>
		<category><![CDATA[Horizontal Nav in Office UI Fabric]]></category>
		<category><![CDATA[Nav in React]]></category>
		<category><![CDATA[Office UI Fabric]]></category>
		<category><![CDATA[React Component]]></category>
		<category><![CDATA[sharepoint]]></category>
		<guid isPermaLink="false">https://sibeeshpassion.com/?p=13281</guid>

					<description><![CDATA[[toc] Introduction Welcome to my blog. I assume that you are working in Office UI Fabric React components and you wanted to create a horizontal menu component in your react solution.&#160; Unfortunately, the normal Nav component in the Office UI Fabric doesn&#8217;t give you this option.&#160; And somehow you reached here by searching for a solution to implement the horizontal menu. You are in the right place then. Let&#8217;s skip the talking and jump into the code.&#160; I hope you will like this article. Let&#8217;s start coding. Source Code The source code can be found here. Background As I mentioned [&#8230;]]]></description>
										<content:encoded><![CDATA[
<p>[toc]</p>



<h2 class="wp-block-heading">Introduction</h2>



<p>Welcome to my blog. I assume that you are working in Office UI Fabric React components and you wanted to create a horizontal menu component in your react solution.&nbsp; Unfortunately, the normal Nav component in the Office UI Fabric doesn&#8217;t give you this option.&nbsp; And somehow you reached here by searching for a solution to implement the horizontal menu. You are in the right place then. Let&#8217;s skip the talking and jump into the code.&nbsp; I hope you will like this article. Let&#8217;s start coding.</p>



<h2 class="wp-block-heading">Source Code</h2>



<p>The source code can be found <a href="https://github.com/SibeeshVenu/Office-UI-Fabric-React-Horizontal-Nav">here</a>.</p>



<h2 class="wp-block-heading">Background</h2>



<p>As I mentioned in the introduction, there is no option to make a horizontal menu if you are using <a href="https://developer.microsoft.com/en-us/fabric#/components/nav">UI Fabric Nav component</a>. And I also ended up in spending some time playing with the Nav component to make it horizontal, but it wasn&#8217;t working as expected. And I found a different way to achieve the same, hereby I am sharing it as I couldn&#8217;t find such a solution on the internet.&nbsp; You can always see my answer <a href="https://sharepoint.stackexchange.com/questions/235501/fabric-ui-navbar-components-how-to-swtich-to-horizontal-layout/250919#250919">here</a> on <a href="https://stackoverflow.com/users/5550507/sibeesh-venu">StackOverflow</a>.</p>



<figure class="wp-block-image alignnone"><a href="https://sibeeshpassion.com/wp-content/uploads/2018/10/Nav-menu-vertical.png"><img fetchpriority="high" decoding="async" width="446" height="1025" src="https://sibeeshpassion.com/wp-content/uploads/2018/10/Nav-menu-vertical.png" alt="Nav menu vertical" class="wp-image-13282" srcset="/wp-content/uploads/2018/10/Nav-menu-vertical.png 446w, /wp-content/uploads/2018/10/Nav-menu-vertical-131x300.png 131w, /wp-content/uploads/2018/10/Nav-menu-vertical-400x919.png 400w, /wp-content/uploads/2018/10/Nav-menu-vertical-261x600.png 261w" sizes="(max-width: 446px) 100vw, 446px" /></a><figcaption>Nav menu vertical</figcaption></figure>



<h2 class="wp-block-heading">Creating Horizontal Nav component</h2>



<p>I believe that you have already created your solution and you are just trying to create a new Menu web part in the existing solution. If you haven&#8217;t created a solution, you can create one using the below command.</p>



<pre class="EnlighterJSRAW" data-enlighter-language="shell" data-enlighter-theme="" data-enlighter-highlight="" data-enlighter-linenumbers="" data-enlighter-lineoffset="" data-enlighter-title="" data-enlighter-group="">yo @microsoft/sharepoint</pre>



<h3 class="wp-block-heading">MenuWebPart.ts</h3>



<p>Once you have created a new web part, you can see that there is a file called MenuWebPart.ts. This is the file we are going to edit first. You can see the content of that file below.</p>



<script src="https://gist.github.com/SibeeshVenu/13b21a27e09c6d3b5b4ef7c461601af8.js"></script>



<p>As you can see I am calling the Menu component here with the property items, this is where you need to mention the contents of your menu.</p>



<h3 class="wp-block-heading">Menu.tsx</h3>



<p>Now let&#8217;s start editing the code in Menu.tsx file.</p>



<script src="https://gist.github.com/SibeeshVenu/e00cfcb9e94fbd6c3edce04a5d8cbc87.js"></script>



<p>As you can see that I am using CommandBar here which accepts the items property which we have set before.</p>



<h3 class="wp-block-heading">IMenuProps.ts</h3>



<p>You would also need to add the items property in the IMenuProps.ts file.</p>



<script src="https://gist.github.com/SibeeshVenu/83bb889668b07bff561f6039f277a792.js"></script>



<h2 class="wp-block-heading">Output</h2>



<p>If you have configured the CommandBar component in an above-mentioned way, you would have seen a horizontal menu by now. Please be keep in mind that there are some limitations using in <a href="https://developer.microsoft.com/en-us/fabric#/components/commandbar">CommandBar</a>. I would use this until Microsoft introduces a new property in the existing Nav component to make it horizontal.</p>



<figure class="wp-block-image alignnone"><a href="https://sibeeshpassion.com/wp-content/uploads/2018/10/Nav-horizontal-e1539726187582.png"><img decoding="async" src="https://sibeeshpassion.com/wp-content/uploads/2018/10/Nav-horizontal-e1539726187582.png" alt="Nav horizontal" class="wp-image-13286"/></a><figcaption>Nav horizontal</figcaption></figure>



<h2 class="wp-block-heading"><span id="conclusion_1"><span id="conclusion">Conclusion</span></span></h2>



<p>Thanks a lot for reading. Did I miss anything that you may think which is needed? Could you find this post as useful? I hope you liked this article. Please share me your valuable suggestions and feedback.</p>



<h2 class="wp-block-heading"><span id="your-turn-what-do-you-think">Your turn. What do you think?</span></h2>



<p>A blog isn’t a blog without comments, but do try to stay on topic. If you have a question unrelated to this post, you’re better off posting it on C# Corner, Code Project, Stack Overflow, Asp.Net Forum instead of commenting here. Tweet or email me a link to your question there and I’ll definitely try to help if I can.</p>



<p>Kindest Regards<br>Sibeesh Venu</p>
]]></content:encoded>
					
					<wfw:commentRss>https://mail.sibeeshpassion.com/creating-a-custom-horizontal-nav-component-using-react-office-ui-fabric/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
	</channel>
</rss>
