Class: PhlexKit::Sidebar

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

Overview

Sidebar shell, ported from ruby_ui's RubyUI::Sidebar: a flex-column rail. Static by default; SidebarWrapper(collapsible: :offcanvas) + SidebarTrigger give it shadcn's offcanvas behavior (desktop slide-away, mobile overlay drawer with scrim — see sidebar_wrapper.rb / sidebar_controller.js). The part set matches shadcn/ui's Sidebar: compose with SidebarWrapper (the page root) + SidebarHeader / SidebarContent / SidebarGroup (+ Label / Content / Action) / SidebarMenu (+ Item / Button / Action / Badge / Skeleton / Sub / SubItem / SubButton) / SidebarSeparator / SidebarInput / SidebarFooter, alongside a SidebarInset for the main content. Tailwind → vanilla .pk-sidebar* (sidebar.css).

Constant Summary collapse

{ default: nil, solid: "menu-solid" }.freeze

Instance Method Summary collapse

Methods inherited from BaseComponent

#on

Constructor Details

#initialize(menu: :default, **attrs) ⇒ Sidebar

Returns a new instance of Sidebar.



17
18
19
20
# File 'app/components/phlex_kit/sidebar/sidebar.rb', line 17

def initialize(menu: :default, **attrs)
  @menu = menu.to_sym
  @attrs = attrs
end

Instance Method Details

#view_template(&block) ⇒ Object



22
23
24
# File 'app/components/phlex_kit/sidebar/sidebar.rb', line 22

def view_template(&block)
  div(**mix({ class: classes }, @attrs), &block)
end