Class: Shadcn::SidebarComponent
- Inherits:
-
BaseComponent
- Object
- ViewComponent::Base
- BaseComponent
- Shadcn::SidebarComponent
- Defined in:
- app/components/shadcn/sidebar_component.rb
Overview
Sidebar component for application layouts Matches shadcn/ui Sidebar component A composable, themeable sidebar with collapsible state
Constant Summary collapse
- SIDEBAR_WIDTH =
"16rem"- SIDEBAR_WIDTH_MOBILE =
"18rem"- SIDEBAR_WIDTH_ICON =
"3rem"- SIDES =
{ left: "left", right: "right" }.freeze
- VARIANTS =
{ sidebar: "sidebar", floating: "floating", inset: "inset" }.freeze
- COLLAPSIBLE_MODES =
{ offcanvas: "offcanvas", icon: "icon", none: "none" }.freeze
Instance Attribute Summary
Attributes inherited from BaseComponent
#class_name, #data, #html_options
Instance Method Summary collapse
- #call ⇒ Object
-
#initialize(side: :left, variant: :sidebar, collapsible: :offcanvas, default_open: true, **options) ⇒ SidebarComponent
constructor
A new instance of SidebarComponent.
Methods inherited from BaseComponent
Methods included from Rails::Helpers::ClassNameHelper
Constructor Details
#initialize(side: :left, variant: :sidebar, collapsible: :offcanvas, default_open: true, **options) ⇒ SidebarComponent
Returns a new instance of SidebarComponent.
74 75 76 77 78 79 80 81 82 83 84 85 86 |
# File 'app/components/shadcn/sidebar_component.rb', line 74 def initialize( side: :left, variant: :sidebar, collapsible: :offcanvas, default_open: true, ** ) super(**) @side = side.to_sym @variant = variant.to_sym @collapsible = collapsible.to_sym @default_open = default_open end |
Instance Method Details
#call ⇒ Object
88 89 90 |
# File 'app/components/shadcn/sidebar_component.rb', line 88 def call content_tag(:aside, , ) end |