Class: UI::Breadcrumb

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

Overview

Breadcrumb - Phlex implementation

A navigation breadcrumb component for displaying hierarchical navigation. Uses BreadcrumbBehavior concern for shared styling logic.

Examples:

Basic usage

render UI::Breadcrumb.new do
  render UI::List.new do
    render UI::Item.new do
      render UI::Link.new(href: "/") { "Home" }
    end
  end
end

Instance Method Summary collapse

Methods included from BreadcrumbBehavior

#breadcrumb_classes, #breadcrumb_html_attributes

Constructor Details

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

Returns a new instance of Breadcrumb.

Parameters:

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

    Additional CSS classes to merge

  • attributes (Hash)

    Additional HTML attributes



21
22
23
24
# File 'app/components/ui/breadcrumb.rb', line 21

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

Instance Method Details

#view_template(&block) ⇒ Object



26
27
28
29
30
# File 'app/components/ui/breadcrumb.rb', line 26

def view_template(&block)
  nav(**breadcrumb_html_attributes) do
    yield if block_given?
  end
end