Class: UI::BreadcrumbSeparatorComponent

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

Overview

BreadcrumbSeparatorComponent - ViewComponent implementation

Visual divider between breadcrumb items with default chevron icon. Uses BreadcrumbSeparatorBehavior concern for shared styling logic.

Examples:

Default separator

<%= render UI::BreadcrumbSeparatorComponent.new %>

Custom separator

<%= render UI::BreadcrumbSeparatorComponent.new do %>
  /
<% end %>

Instance Method Summary collapse

Methods included from BreadcrumbSeparatorBehavior

#breadcrumb_separator_classes, #breadcrumb_separator_html_attributes

Constructor Details

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

Returns a new instance of BreadcrumbSeparatorComponent.

Parameters:

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

    Additional CSS classes to merge

  • attributes (Hash)

    Additional HTML attributes



20
21
22
23
# File 'app/view_components/ui/breadcrumb_separator_component.rb', line 20

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

Instance Method Details

#callObject



25
26
27
28
29
30
31
32
33
# File 'app/view_components/ui/breadcrumb_separator_component.rb', line 25

def call
   :li, **breadcrumb_separator_html_attributes do
    if content.present?
      content
    else
      default_separator_icon
    end
  end
end