Class: Shadcn::ButtonGroupComponent
- Inherits:
-
BaseComponent
- Object
- ViewComponent::Base
- BaseComponent
- Shadcn::ButtonGroupComponent
- Defined in:
- app/components/shadcn/button_group_component.rb
Overview
Button Group component for grouping related buttons Matches shadcn/ui Button Group pattern
Constant Summary collapse
- ORIENTATIONS =
{ horizontal: "flex-row", vertical: "flex-col" }.freeze
- BASE_CLASSES =
"inline-flex"
Instance Attribute Summary
Attributes inherited from BaseComponent
#class_name, #data, #html_options
Instance Method Summary collapse
- #call ⇒ Object
-
#initialize(orientation: :horizontal, **options) ⇒ ButtonGroupComponent
constructor
A new instance of ButtonGroupComponent.
Methods inherited from BaseComponent
Methods included from Rails::Helpers::ClassNameHelper
Constructor Details
#initialize(orientation: :horizontal, **options) ⇒ ButtonGroupComponent
Returns a new instance of ButtonGroupComponent.
47 48 49 50 |
# File 'app/components/shadcn/button_group_component.rb', line 47 def initialize(orientation: :horizontal, **) super(**) @orientation = orientation.to_sym end |
Instance Method Details
#call ⇒ Object
52 53 54 55 56 |
# File 'app/components/shadcn/button_group_component.rb', line 52 def call tag.div(class: group_classes, role: "group", **.merge(build_data)) do safe_join() end end |