0.0
The project is in a healthy, maintained state
Stop losing time creating a navbar from scratch. Use this gem to create a simple and easy navbar for your Rails applications.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Runtime

~> 6.0
 Project Readme

Simple Navbar

SimpleNavbar Logo SimpleNavbar is a Ruby gem that provides a simple and customizable navigation bar for your web applications.

Usage

Installation

Add this line to your application's Gemfile:

gem "simple_navbar"

And then execute:

$ bundle

Or install it yourself as:

$ gem install simple_navbar

You need to install and configure the files

The gem is compatible with stimulus, or legacy js on assets/javascripts

with stimulus execute:

$ rails generate simple_navbar:install --stimulus

no stimulus:

$ rails generate simple_navbar:install

os legacy mode with assets/javascripts

$ rails generate simple_navbar:install --legacy

This will generate for you js files, css and include the helper SimpleNavba on ApplicationController.rb and javascript include tags with no stimulus

Usage

with stimulus use

<%= simple_navbar_s( brand: { logo: "/icon.png", url: root_path },
      links: [
      { label: "About", url: about_path },
      { label: "Posts", url: posts_path }]) %>

no stimulus simple_navbar with no "s"

<%= simple_navbar( brand: { logo: "/icon.png", url: root_path },
      links: [
      { label: "About", url: about_path },
      { label: "Posts", url: posts_path }]) %>

with dropdown menus

<%= simple_navbar_s(
  brand: { logo: "/icon.png", url: root_path },
  links: [
    { label: "About", url: about_path },
    { label: "Posts", url: posts_path }
    { dropdown: { label: "More", links: [
          { label: "Hello", url: root_path },
          { label: "World", url: root_path }
        ]
      }
    }
  ]) %>

you can set a title instead of a logo on the brand

<%= simple_navbar( brand: { title: "Fumo", url: root_path },
      links: [
      { label: "About", url: about_path },
      { label: "Posts", url: posts_path }]) %>

Contributing

Fell free to open issues and pr to contribute.

License

The gem is available as open source under the terms of the MIT License.