Class: PhlexKit::Breadcrumb

Inherits:
BaseComponent show all
Defined in:
app/components/phlex_kit/breadcrumb/breadcrumb.rb

Overview

Navigational hierarchy trail. Ported from ruby_ui's RubyUI::Breadcrumb. Compose Breadcrumb > BreadcrumbList > BreadcrumbItem (+ Link/Page/Separator/Ellipsis).

Instance Method Summary collapse

Methods inherited from BaseComponent

#on

Constructor Details

#initialize(**attrs) ⇒ Breadcrumb

Returns a new instance of Breadcrumb.



5
# File 'app/components/phlex_kit/breadcrumb/breadcrumb.rb', line 5

def initialize(**attrs) = (@attrs = attrs)

Instance Method Details

#view_templateObject



7
8
9
10
11
12
13
# File 'app/components/phlex_kit/breadcrumb/breadcrumb.rb', line 7

def view_template(&)
  base = { class: "pk-breadcrumb" }
  # Default only when the caller didn't supply their own accessible name
  # (localization, two breadcrumbs on a page) — `mix` would fuse them.
  base[:aria] = { label: "breadcrumb" } unless aria_labelled?
  nav(**mix(base, @attrs), &)
end