Skip to content

Commit 1556e63

Browse files
committedFeb 17, 2015
[added] Example for collapsable Navbar in docs.
1 parent f26e39f commit 1556e63

File tree

3 files changed

+39
-2
lines changed

3 files changed

+39
-2
lines changed
 

Diff for: ‎docs/examples/NavbarBasic.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
var navbarInstance = (
2-
<Navbar>
2+
<Navbar brand="React-Bootstrap">
33
<Nav>
44
<NavItem eventKey={1} href="#">Link</NavItem>
55
<NavItem eventKey={2} href="#">Link</NavItem>
@@ -14,4 +14,4 @@ var navbarInstance = (
1414
</Navbar>
1515
);
1616

17-
React.render(navbarInstance, mountNode);
17+
React.render(navbarInstance, mountNode);

Diff for: ‎docs/examples/NavbarCollapsable.js

+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
var navbarInstance = (
2+
<Navbar brand="React-Bootstrap" inverse toggleNavKey={0}>
3+
<Nav right eventKey={0}> {/* This is the eventKey referenced */}
4+
<NavItem eventKey={1} href="#">Link</NavItem>
5+
<NavItem eventKey={2} href="#">Link</NavItem>
6+
<DropdownButton eventKey={3} title="Dropdown">
7+
<MenuItem eventKey="1">Action</MenuItem>
8+
<MenuItem eventKey="2">Another action</MenuItem>
9+
<MenuItem eventKey="3">Something else here</MenuItem>
10+
<MenuItem divider />
11+
<MenuItem eventKey="4">Separated link</MenuItem>
12+
</DropdownButton>
13+
</Nav>
14+
</Navbar>
15+
);
16+
17+
React.render(navbarInstance, mountNode);

Diff for: ‎docs/src/ComponentsPage.js

+20
Original file line numberDiff line numberDiff line change
@@ -331,8 +331,28 @@ var ComponentsPage = React.createClass({
331331
<div className="bs-docs-section">
332332
<h1 id="navbars" className="page-header">Navbars <small>Navbar, Nav, NavItem</small></h1>
333333
<h2 id="navbars-examples">Example navbars</h2>
334+
<p>You can specify a brand by passing a renderable component or string in <code>brand</code></p>
335+
<p>Navbars are by default accessible and will provide <code>role="navigation"</code>.</p>
336+
<p>They also supports all the different Bootstrap classes as properties. Just camelCase the css class and remove navbar from it. For example <code>navbar-fixed-top</code> becomes the property <code>fixedTop</code>. The different properties are <code>fixedTop</code>, <code>fixedBottom</code>, <code>staticTop</code>, <code>inverse</code>, <code>fluid</code>.</p>
337+
<p>You can drag elements to the right by specifying the <code>right</code> property on a nav group.</p>
334338

335339
<ReactPlayground codeText={fs.readFileSync(__dirname + '/../examples/NavbarBasic.js', 'utf8')} />
340+
341+
<h3>Mobile Friendly</h3>
342+
<p>To have a mobile friendly Navbar, specify the property <code>toggleNavKey</code> on the Navbar with a value corresponding to an <code>eventKey</code> of one of his <code>Nav</code> children. This child will be the one collapsed.</p>
343+
<p>By setting the property {React.DOM.code(null, "defaultNavExpanded={true}")} the Navbar will start expanded by default.</p>
344+
<div className="bs-callout bs-callout-info">
345+
<h4>Scrollbar overflow</h4>
346+
<p>The height of the collapsable is slightly smaller than the real height. To hide the scroll bar, add the following css to your style files.</p>
347+
<pre>
348+
{React.DOM.code(null,
349+
".navbar-collapse {\n" +
350+
" overflow: hidden;\n" +
351+
"}\n"
352+
)}
353+
</pre>
354+
</div>
355+
<ReactPlayground codeText={fs.readFileSync(__dirname + '/../examples/NavbarCollapsable.js', 'utf8')} />
336356
</div>
337357

338358
{/* Tabbed Areas */}

0 commit comments

Comments
 (0)