Reflex
  • Blocks
    • Header
    • Hero
    • Features
    • Call to action
    • Forms
    • Pricing
    • Team
    • Testimonials
    • Cards
    • Footer
    • Posts
    • Videos
  • Examples
  • Learn
  • Videos
  • Docs
  • Theme

    Theme reference

    • Colors
    • Font family
    • Font size
    • Font weight
    • Line height
    • Box shadow
    Create a theme Extend base
arshadcnv0.5.3
Reflex
Reflex

Navs

Creating navigation menus.

  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11

Like everything else in Reflex, creating navs is as easy as writing Markdown.

Navs are placed in the content/navs directory.

Add a new example.mdx nav.

- [Home](/)
- [About](/about)
- Dropdown
- [Item One](/item-one)
- [Item Two](/item-two)
- [Item Three](/item-three)
- [Contact](/contact)
- Mega menu
- <Block src="name-of-block" />

Display nav

Use the NavMenu component. This will handle dropdown and mobile for you.

<NavMenu name="example" />

Or you can use the useNav hook to retrieve navs and render them manually.

// blocks/example-nav.mdx
import { useNav } from "@reflexjs/gatsby-theme-nav"
export const ExampleNav = () => {
const [nav] = useNav("example")
return nav.items ? (
<Ul d="grid" col={`repeat(auto, ${nav.items.length})`} gap="4">
{nav.items.map(({ value, url, items }, index) => (
<Li key={index}>
<Link href={url}>{value}</Link>
</Li>
))}
</Ul>
) : null
}

Then place them in your page:

<Block src="example-nav" />
  • Home
  • About
  • Dropdown
    • Item One
    • Item Two
    • Item Three
  • Mega menu

    Section One

    Autem maiores ab praesentium. Blanditiis numquam eaque odit. Corporis totam sit aliquid.

    Section One

    Autem maiores ab praesentium. Blanditiis numquam eaque odit. Corporis totam sit aliquid.

  • Contact
Dynamic blocksDone

© 2020 Reflex

  • Blocks
  • Examples
  • Learn
  • Docs
  • Github