Class: UiBibz::Ui::Core::ButtonGroup

Inherits:
Component show all
Defined in:
lib/ui_bibz/ui/core/button/button_group.rb

Overview

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 - State of element with symbol value: (:default, :primary, :info, :warning, :danger)

  • size - Size of element with symbol value: (:xs, :sm, :lg)

  • position - Position vertical or horizontal with symbol value: (:vertical, :horizontal)

Signatures

UiBibz::Ui::Core::ButtonGroup.new(options = nil, html_options = nil) do
  ...
end

Examples

UiBibz::Ui::Core::ButtonGroup.new(position: :vertical, size: :xs) do
  UiBibz::Ui::Core.Button.new('test').render
  UiBibz::Ui::Core.Button.new('test2').render
end.render

Helper

button_group(content, options = {}, html_options = {})

button_group(options = {}, html_options = {}) do
  content
end

Instance Attribute Summary

Attributes inherited from Component

#content, #html_options, #options

Attributes inherited from Base

#output_buffer

Instance Method Summary (collapse)

Methods inherited from Component

#add_classes, #badge_html, #class_and_html_options, #glyph, #glyph_and_content_html, #glyph_with_space, #state

Methods inherited from Base

#i18n_set?

Constructor Details

- (ButtonGroup) initialize(content = nil, options = nil, html_options = nil, &block)

See UiBibz::Ui::Core::Component.initialize



48
49
50
# File 'lib/ui_bibz/ui/core/button/button_group.rb', line 48

def initialize content = nil, options = nil, html_options = nil, &block
  super
end

Instance Method Details

- (Object) render

Render html tag



53
54
55
# File 'lib/ui_bibz/ui/core/button/button_group.rb', line 53

def render
   :div, @content, class_and_html_options(["btn-#{ type }", size, position]).merge({ role: type })
end