Class: UI::BreadcrumbLink

Inherits:
Phlex::HTML
  • Object
show all
Includes:
BreadcrumbLinkBehavior
Defined in:
app/components/ui/breadcrumb_link.rb

Overview

Link - Phlex implementation

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

Examples:

Basic usage

render UI::Link.new(href: "/") { "Home" }

Instance Method Summary collapse

Methods included from BreadcrumbLinkBehavior

#breadcrumb_link_classes, #breadcrumb_link_html_attributes

Constructor Details

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

Returns a new instance of BreadcrumbLink.

Parameters:

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

    URL for the link

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

    Additional CSS classes to merge

  • attributes (Hash)

    Additional HTML attributes



16
17
18
19
20
# File 'app/components/ui/breadcrumb_link.rb', line 16

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

Instance Method Details

#view_template(&block) ⇒ Object



22
23
24
25
26
# File 'app/components/ui/breadcrumb_link.rb', line 22

def view_template(&block)
  a(**breadcrumb_link_html_attributes) do
    yield if block_given?
  end
end