The breadcrumbs component provides a navigation aid that shows users their current location within your application's hierarchy. They're easy to add to any view with just a few lines of code.
rails g instrumental:breadcrumbs
To insert a breadcrumb navigation into a view:
rails g instrumental:breadcrumbs:insert
Want to see the breadcrumbs navigation in action? Just look at the top of these docs!
A typical breadcrumb navigation should be placed in any view and look something like the the following example (shown on a Post's edit view):
<%= content_for(:breadcrumbs) do %>
<%= render "shared/components/breadcrumbs/breadcrumbs" do %>
<%= render "shared/components/breadcrumbs/breadcrumb_link",
text: "Posts",
link: posts_path %>
<%= render "shared/components/breadcrumbs/divider" %>
<%= render "shared/components/breadcrumbs/breadcrumb_link",
link: post_path(@post),
text: @post.title %>
<%= render "shared/components/breadcrumbs/divider" %>
<%= render "shared/components/breadcrumbs/breadcrumb_link",
text: "Edit" %>
<% end %>
<% end %>
Find all of your customization options (via local variables) in these files:
app/views/shared/components/breadcrumbs/_breadcrumbs.html.erb
app/views/shared/components/breadcrumbs/_breadcrumb_link.html.erb
I created Instrumental Components to make designing and building professional apps with Ruby on Rails easy, fast, and fun. I use it on all of my projects and I hope it helps you build something great.