Class: PhlexKit::SidebarRail

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

Overview

Invisible grab strip along the sidebar's trailing edge — clicking it toggles the collapse, like shadcn/ui's SidebarRail. Place it as the last child of a Sidebar inside a collapsible wrapper. See sidebar.rb.

Instance Method Summary collapse

Methods inherited from BaseComponent

#on

Constructor Details

#initialize(**attrs) ⇒ SidebarRail

Returns a new instance of SidebarRail.



6
7
8
# File 'app/components/phlex_kit/sidebar/sidebar_rail.rb', line 6

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

Instance Method Details

#view_templateObject



10
11
12
13
14
15
16
17
18
19
# File 'app/components/phlex_kit/sidebar/sidebar_rail.rb', line 10

def view_template
  button(**mix({
    type: :button,
    class: "pk-sidebar-rail",
    aria_label: "Toggle sidebar",
    tabindex: "-1",
    title: "Toggle sidebar",
    data: { action: "click->phlex-kit--sidebar#toggle" }
  }, @attrs))
end