Class: UI::BreadcrumbItemComponent

Inherits:
ViewComponent::Base
  • Object
show all
Includes:
BreadcrumbItemBehavior
Defined in:
app/view_components/ui/breadcrumb_item_component.rb

Overview

BreadcrumbItemComponent - ViewComponent implementation

Individual breadcrumb entry within the breadcrumb list. Uses BreadcrumbItemBehavior concern for shared styling logic.

Examples:

Basic usage

<%= render UI::BreadcrumbItemComponent.new do %>
  <%= render UI::BreadcrumbLinkComponent.new(href: "/") do %>
    Home
  <% end %>
<% end %>

Instance Method Summary collapse

Methods included from BreadcrumbItemBehavior

#breadcrumb_item_classes, #breadcrumb_item_html_attributes

Constructor Details

#initialize(classes: "", **attributes) ⇒ BreadcrumbItemComponent

Returns a new instance of BreadcrumbItemComponent.

Parameters:

  • classes (String) (defaults to: "")

    Additional CSS classes to merge

  • attributes (Hash)

    Additional HTML attributes



19
20
21
22
# File 'app/view_components/ui/breadcrumb_item_component.rb', line 19

def initialize(classes: "", **attributes)
  @classes = classes
  @attributes = attributes
end

Instance Method Details

#callObject



24
25
26
27
28
# File 'app/view_components/ui/breadcrumb_item_component.rb', line 24

def call
   :li, **breadcrumb_item_html_attributes do
    content
  end
end