Class: UI::ButtonGroupText
- Inherits:
-
Phlex::HTML
- Object
- Phlex::HTML
- UI::ButtonGroupText
- Includes:
- ButtonGroupTextBehavior
- Defined in:
- app/components/ui/button_group_text.rb
Overview
Text - Phlex implementation
Displays text within a button group. Uses TextBehavior module for shared styling logic. Supports asChild pattern for rendering custom components.
Based on shadcn/ui ButtonGroup: ui.shadcn.com/docs/components/button-group
Instance Method Summary collapse
-
#initialize(as_child: false, classes: "", **attributes) ⇒ ButtonGroupText
constructor
A new instance of ButtonGroupText.
- #view_template(&block) ⇒ Object
Methods included from ButtonGroupTextBehavior
#text_classes, #text_html_attributes
Constructor Details
#initialize(as_child: false, classes: "", **attributes) ⇒ ButtonGroupText
Returns a new instance of ButtonGroupText.
30 31 32 33 34 |
# File 'app/components/ui/button_group_text.rb', line 30 def initialize(as_child: false, classes: "", **attributes) @as_child = as_child @classes = classes @attributes = attributes end |
Instance Method Details
#view_template(&block) ⇒ Object
36 37 38 39 40 41 42 43 44 |
# File 'app/components/ui/button_group_text.rb', line 36 def view_template(&block) if @as_child # Yield attributes to the block for custom rendering yield(text_html_attributes.deep_merge(@attributes)) else # Render as a div div(**text_html_attributes.deep_merge(@attributes), &block) end end |