Toolbar / Tabbar - 图1

Toolbar React Component

Toolbar is a fixed (with Fixed and Through layout types) area at the bottom of a screen that contains navigation elements. Toolbar does not have any parts, just plain links inside

Toolbar React component represents Toolbar component.

Toolbar Components

There are following components included:

  • Toolbar / F7Toolbar

Toolbar Properties

PropTypeDefaultDescription
<Toolbar> properties
innerbooleantrueWhen enabled (by default), it will put all the content within internal toolbarInner element. Disable it only in case you want to put totally custom layout inside
positionstringToolbar position, can be top or bottom
topbooleanTop positioned toolbar. Shortening for position=”top”
topIosbooleanTop positioned toolbar only for iOS theme
topMdbooleanTop positioned toolbar only for MD theme
topAurorabooleanTop positioned toolbar only for Aurora theme
bottombooleanBottom positioned toolbar. Shortening for position=”bottom”
bottomIosbooleanBottom positioned toolbar only for iOS theme
bottomMdbooleanBottom positioned toolbar only for MD theme
bottomAurorabooleanBottom positioned toolbar only for Aurora theme
tabbarbooleanfalseDefines whether the Toolbar is also a Tabbar or not
labelsbooleanfalseEnables Tabbar with labels (affects only when tabbar: true)
scrollablebooleanfalseEnables scrollable Tabbar (affects only when tabbar: true)
noShadowbooleanDisable shadow rendering for Material theme
noHairlinebooleanfalseDisable toolbar/tabbar top thin border (hairline) for iOS theme
hiddenbooleanfalseMakes toolbar hidden

Toolbar Methods

<Toolbar> methods
.hide(animate)Hide toolbar
.show(animate)Show toolbar

Toolbar Events

EventDescription
<Toolbar> events
toolbarHideEvent will be triggered when Toolbar becomes hidden
toolbarShowEvent will be triggered when Toolbar becomes visible

Toolbar Slots

Toolbar React component (<Toolbar>) has additional slots for custom elements:

  • default - element will be inserted as a child of <div class="toolbarInner"> element
  • beforeInner - element will be inserted right before <div class="toolbarInner"> element
  • afterInner - element will be inserted right after <div class="toolbarInner"> element
  1. <Toolbar>
  2. <div slot="beforeInner">Before Inner</div>
  3. <div slot="afterInner">After Inner</div>
  4. {/* Goes to default slot: */}
  5. <Link>Left Link</Link>
  6. <Link>Right Link</Link>
  7. </Toolbar>
  8. {/* Renders to: */}
  9. <div class="toolbar">
  10. <div>Before Inner</div>
  11. <div class="toolbarInner">
  12. <a href="#" class="link">Left Link</a>
  13. <a href="#" class="link">Right Link</a>
  14. </div>
  15. <div>After Inner</div>
  16. </div>

Examples

Toolbar

  1. export default class extends React.Component{
  2. constructor() {
  3. this.state = {
  4. isBottom: true,
  5. };
  6. }
  7. render() {
  8. return (
  9. <Page>
  10. <Navbar title="Toolbar" backLink="Back"></Navbar>
  11. <Toolbar position={this.state.isBottom ? 'bottom' : 'top'}>
  12. <Link>Left Link</Link>
  13. <Link>Right Link</Link>
  14. </Toolbar>
  15. <BlockTitle>Toolbar Position</BlockTitle>
  16. <Block>
  17. <p>Toolbar supports both top and bottom positions. Click the following button to change its position.</p>
  18. <p>
  19. <Button raised onClick={() => this.setState({isBottom: !this.state.isBottom})}>Toggle Toolbar Position</Button>
  20. </p>
  21. </Block>
  22. <Block>
  23. <p>Lorem ipsum dolor sit amet, consectetur adipisicing elit. Ullam enim quia molestiae facilis laudantium voluptates obcaecati officia cum, sit libero commodi...</p>
  24. </Block>
  25. </Page>
  26. )
  27. }
  28. }

Tabbar

  1. export default class extends React.Component{
  2. constructor() {
  3. this.state = {
  4. isBottom: true,
  5. };
  6. }
  7. render() {
  8. return (
  9. <Page pageContent={false}>
  10. <Navbar title="Tabbar" backLink="Back">
  11. <NavRight>
  12. <Link iconIos="f7:arrow_up_arrow_down_circle_fill" iconAurora="f7:arrow_up_arrow_down_circle_fill" iconMd="material:compare_arrows" onClick={() => this.setState({isBottom: !this.state.isBottom})}></Link>
  13. </NavRight>
  14. </Navbar>
  15. <Toolbar tabbar position={this.state.isBottom ? 'bottom' : 'top'}>
  16. <Link tabLink="#tab-1" tabLinkActive>Tab 1</Link>
  17. <Link tabLink="#tab-2">Tab 2</Link>
  18. <Link tabLink="#tab-3">Tab 3</Link>
  19. </Toolbar>
  20. <Tabs>
  21. <Tab id="tab-1" className="page-content" tabActive>
  22. <Block>
  23. <p>Tab 1 content</p>
  24. ...
  25. </Block>
  26. </Tab>
  27. <Tab id="tab-2" className="page-content">
  28. <Block>
  29. <p>Tab 2 content</p>
  30. ...
  31. </Block>
  32. </Tab>
  33. <Tab id="tab-3" className="page-content">
  34. <Block>
  35. <p>Tab 3 content</p>
  36. ...
  37. </Block>
  38. </Tab>
  39. </Tabs>
  40. </Page>
  41. )
  42. }

Tabbar Labels

  1. export default class extends React.Component{
  2. constructor() {
  3. this.state = {
  4. isBottom: true,
  5. };
  6. }
  7. render() {
  8. return (
  9. <Page pageContent={false}>
  10. <Navbar title="Tabbar Labels" backLink="Back">
  11. <NavRight>
  12. <Link iconIos="f7:arrow_up_arrow_down_circle_fill" iconAurora="f7:arrow_up_arrow_down_circle_fill" iconMd="material:compare_arrows" onClick={() => this.setState({isBottom: !this.state.isBottom})}></Link>
  13. </NavRight>
  14. </Navbar>
  15. <Toolbar tabbar labels position={this.state.isBottom ? 'bottom' : 'top'}>
  16. <Link tabLink="#tab-1" tabLinkActive text="Tab 1" iconIos="f7:envelope_fill" iconAurora="f7:envelope_fill" iconMd="material:email"></Link>
  17. <Link tabLink="#tab-2" text="Tab 2" iconIos="f7:calendar_fill" iconAurora="f7:calendar_fill" iconMd="material:today"></Link>
  18. <Link tabLink="#tab-3" text="Tab 3" iconIos="f7:cloud_upload_fill" iconAurora="f7:cloud_upload_fill" iconMd="material:file_upload"></Link>
  19. </Toolbar>
  20. <Tabs>
  21. <Tab id="tab-1" className="page-content" tabActive>
  22. <Block>
  23. <p>Tab 1 content</p>
  24. ...
  25. </Block>
  26. </Tab>
  27. <Tab id="tab-2" className="page-content">
  28. <Block>
  29. <p>Tab 2 content</p>
  30. ...
  31. </Block>
  32. </Tab>
  33. <Tab id="tab-3" className="page-content">
  34. <Block>
  35. <p>Tab 3 content</p>
  36. ...
  37. </Block>
  38. </Tab>
  39. </Tabs>
  40. </Page>
  41. )
  42. }
  43. }

Tabbar Scrollable

  1. export default class extends React.Component{
  2. constructor() {
  3. this.state = {
  4. isBottom: true,
  5. };
  6. }
  7. render() {
  8. const tabs = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10];
  9. return (
  10. <Page pageContent={false}>
  11. <Navbar title="Tabbar Scrollable" backLink="Back">
  12. <NavRight>
  13. <Link iconIos="f7:arrow_up_arrow_down_circle_fill" iconAurora="f7:arrow_up_arrow_down_circle_fill" iconMd="material:compare_arrows" onClick={() => this.setState({isBottom: !this.state.isBottom})}></Link>
  14. </NavRight>
  15. </Navbar>
  16. <Toolbar tabbar scrollable position={this.state.isBottom ? 'bottom' : 'top'}>
  17. {tabs.map((tab, index) => (
  18. <Link
  19. key={tab}
  20. tabLink={`#tab-${tab}`}
  21. tabLinkActive={index === 0}
  22. >Tab {tab}</Link>
  23. ))}
  24. </Toolbar>
  25. <Tabs>
  26. {tabs.map((tab, index) => (
  27. <Tab
  28. key={tab}
  29. id={`tab-${tab}`}
  30. className="page-content"
  31. tabActive={index === 0}
  32. >
  33. <Block>
  34. <p><b>Tab {tab} content</b></p>
  35. ...
  36. </Block>
  37. </Tab>
  38. ))}
  39. </Tabs>
  40. </Page>
  41. )
  42. }
  43. }

Hide Toolbar On Scroll

  1. export default () => (
  2. <Page hideToolbarOnScroll>
  3. <Navbar title="Hide Toolbar On Scroll" backLink="Back"></Navbar>
  4. <Toolbar bottom-md>
  5. <Link>Left Link</Link>
  6. <Link>Right Link</Link>
  7. </Toolbar>
  8. <Block strong>
  9. <p>Toolbar will be hidden if you scroll bottom</p>
  10. </Block>
  11. <Block>
  12. <p>Lorem ipsum dolor sit amet, consectetur adipisicing elit. Quos maxime incidunt id ab culpa ipsa omnis eos, vel excepturi officiis neque illum perferendis dolorum magnam rerum natus dolore nulla ex.</p>
  13. ...
  14. </Block>
  15. </Page>
  16. );

← Toggle

Treeview →