Class: PhlexKit::Sidebar
- Inherits:
-
BaseComponent
- Object
- Phlex::HTML
- BaseComponent
- PhlexKit::Sidebar
- 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
- MENUS =
Active-item treatment (ui.shadcn.com/create's "Menu" option): :default is shadcn's stock accent tint; :solid fills with the primary/brand role.
{ default: nil, solid: "menu-solid" }.freeze
Instance Method Summary collapse
-
#initialize(menu: :default, **attrs) ⇒ Sidebar
constructor
A new instance of Sidebar.
- #view_template(&block) ⇒ Object
Methods inherited from BaseComponent
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 = .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 |