Class: UI::BreadcrumbLinkComponent

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

Overview

BreadcrumbLinkComponent - ViewComponent implementation

Clickable breadcrumb link for navigation. Uses BreadcrumbLinkBehavior concern for shared styling logic.

Examples:

Basic usage

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

Instance Method Summary collapse

Methods included from BreadcrumbLinkBehavior

#breadcrumb_link_classes, #breadcrumb_link_html_attributes

Constructor Details

#initialize(href: "#", classes: "", **attributes) ⇒ BreadcrumbLinkComponent

Returns a new instance of BreadcrumbLinkComponent.

Parameters:

  • href (String) (defaults to: "#") —

    URL for the link

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

    Additional CSS classes to merge

  • attributes (Hash) —

    Additional HTML attributes



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

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

Instance Method Details

#call ⇒ Object



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

def call
   :a, **breadcrumb_link_html_attributes do
    content
  end
end