class UiBibz::Ui::Core::Forms::Buttons::ButtonGroup
Create a button group
This element is an extend of UiBibz::Ui::Core::Component
.
Attributes¶ ↑
-
content
- Content of element -
options
- Options of element -
html_options
- Html Options of element
Options¶ ↑
You can add HTML attributes using the html_options
. You can pass arguments in options attribute:
-
state
(:active
,:disabled
) -
status
- status of element withsymbol
value: (:primary
,:secondary
,:info
,:warning
,:danger
) -
size
- Size of element withsymbol
value: (:xs
,:sm
,:lg
) -
position
- Position vertical or horizontal withsymbol
value: (:vertical
,:horizontal
)
Signatures¶ ↑
UiBibz::Ui::Core::Forms::Buttons::ButtonGroup.new(options = nil, html_options = nil) do |bg| ... end
Examples¶ ↑
UiBibz::Ui::Core::Forms::Buttons::ButtonGroup.new(position: :vertical, size: :xs) do |bg| bg.ui_button 'test' bg.ui_button 'test2' end.render
Helper¶ ↑
ui_button_group(options = {}, html_options = {}) do |bg| bg.ui_button 'content' bg.ui_button_link 'Link', url: '#' end
Public Class Methods
new(content = nil, options = nil, html_options = nil, &block)
click to toggle source
See UiBibz::Ui::Core::Component.initialize
Calls superclass method
UiBibz::Ui::Core::Component::new
# File lib/ui_bibz/ui/core/forms/buttons/button_group.rb, line 53 def initialize(content = nil, options = nil, html_options = nil, &block) super @items = [] end
Public Instance Methods
choice_group(content = nil, options = nil, html_options = nil, &block)
click to toggle source
# File lib/ui_bibz/ui/core/forms/buttons/button_group.rb, line 103 def choice_group(content = nil, options = nil, html_options = nil, &block) @items << UiBibz::Ui::Core::Forms::Choices::ChoiceGroup.new(content, options, html_options).tap(&block) end
dropdown(content, options = {}, html_options = nil, &block)
click to toggle source
# File lib/ui_bibz/ui/core/forms/buttons/button_group.rb, line 83 def dropdown(content, options = {}, html_options = nil, &block) options = @options.merge(options) @items << ButtonGroupDropdown.new(content, options, html_options).tap(&block) end
html(content = nil, options = nil, html_options = nil, &block)
click to toggle source
# File lib/ui_bibz/ui/core/forms/buttons/button_group.rb, line 99 def html(content = nil, options = nil, html_options = nil, &block) @items << UiBibz::Ui::Core::Component.new(content, options, html_options, &block) end
input(attribute_name, options = {}, &block)
click to toggle source
# File lib/ui_bibz/ui/core/forms/buttons/button_group.rb, line 93 def input(attribute_name, options = {}, &block) options = @options.merge(options) @items << @options[:form].input(attribute_name, options.merge({ label: false, wrapper: false }), &block) end
pre_render()
click to toggle source
Render html tag
# File lib/ui_bibz/ui/core/forms/buttons/button_group.rb, line 59 def pre_render content_tag :div, @items.map { |item| item.respond_to?(:render) ? item.try(:render) : item }.join.html_safe, html_options end
split_dropdown(content, options = {}, html_options = nil, &block)
click to toggle source
# File lib/ui_bibz/ui/core/forms/buttons/button_group.rb, line 88 def split_dropdown(content, options = {}, html_options = nil, &block) options = @options.merge(options) @items << ButtonGroupSplitDropdown.new(content, options, html_options).tap(&block) end
Private Instance Methods
class_name()
click to toggle source
# File lib/ui_bibz/ui/core/forms/buttons/button_group.rb, line 121 def class_name 'btn-group' if options[:position] != :vertical end
component_html_classes()
click to toggle source
Calls superclass method
UiBibz::Ui::Core::Component#component_html_classes
# File lib/ui_bibz/ui/core/forms/buttons/button_group.rb, line 109 def component_html_classes super << [class_name, size, position] end
component_html_options()
click to toggle source
# File lib/ui_bibz/ui/core/forms/buttons/button_group.rb, line 113 def component_html_options { role: type } end
position()
click to toggle source
# File lib/ui_bibz/ui/core/forms/buttons/button_group.rb, line 129 def position "btn-group-#{options[:position]}" if options[:position] end
size()
click to toggle source
# File lib/ui_bibz/ui/core/forms/buttons/button_group.rb, line 125 def size "btn-group-#{options[:size]}" if options[:size] end
type()
click to toggle source
# File lib/ui_bibz/ui/core/forms/buttons/button_group.rb, line 117 def type options[:type] || :group end