Docusaurus: Using icons in the navigation bar

Created on 20 Apr 2020  路  3Comments  路  Source: facebook/docusaurus

I want to use icons in navbar as in the screenshot:
Screenshot 2020-04-20 at 5 30 42 PM

Is this possible with docusaurus v2?
If not, how difficult is it to implement it?

needs triage questions

Most helpful comment

Let's add some examples for this to the docs if possible.

All 3 comments

Hi @awibox - it should be possible to swizzle and customize the Navbar component to add icon menu items. I can't speak to the difficulty level but my suggestion would be to wrap the icons in an Infima avatar, minus the additional text: https://facebookincubator.github.io/infima/docs/components/avatar#horizontal

Basically, add something like this to your custom Navbar component:

<div class="avatar">
  <a
    class="avatar__photo-link avatar__photo avatar__photo--sm"
    href="https://example.com"
  >
    <img
      alt="Your Alt"
      src="your/icon/path"
    />
  </a>
</div>

In the upcoming version of D2, it will be possible to specify a custom CSS class for any navbar item.
I think this is enough to styling a navbar item in such a way as to add an icon.
As example, you can go to v2 website, it now uses the GH icon instead of text.

Let's add some examples for this to the docs if possible.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

sebqq picture sebqq  路  3Comments

JoelMarcey picture JoelMarcey  路  3Comments

muuvmuuv picture muuvmuuv  路  3Comments

lex111 picture lex111  路  3Comments

MoogyG picture MoogyG  路  3Comments