class UiBibz::Ui::Core::Navigations::TabGroup

Create a tab_group

This element is an extend of UiBibz::Ui::Core::Component.

Attributes

Options

You can add HTML attributes using the html_options. You can pass arguments in options attribute:

Signatures

UiBibz::Ui::Core::Navigations::TabGroup.new(content, options = nil, html_options = nil)

UiBibz::Ui::Core::Navigations::TabGroup.new(options = nil, html_options = nil).tap do |n|
  ...
  n.tab content = nil, options = nil, html_options = nil, block
  n.tab content = nil, options = nil, html_options = nil, block
  n.dropdown content = nil, options = nil, html_options = nil, block
  ...
end

Examples

UiBibz::Ui::Core::Navigations::TabGroup.new(tag_type: :span).tap do |n|
  n.tab 'Test', url: '#test'
  n.tab 'Test2', url: '#test2', state: :active
  n.dropdown('Action') do |d|
    d.list content = nil, options = nil, html_options = nil, &block
  end
end.render

Helper

ui_tab_group(options = {}, html_options = {}) do |n|
  n.tab(content, options = {}, html_options = {})
  n.tab(options = {}, html_options = {}) do
    content
  end
  n.dropdown(name, options = {}, html_options = {}) do |d|
    d.list(content, options = {}, html_options = {})
    d.list(options = {}, html_options = {}) do
      content
    end
  end
end

Public Instance Methods

tab(content = nil, options = {}, html_options = nil, &block) click to toggle source

Add nav link items See UiBibz::Ui::Core::Navigations::NavLink

# File lib/ui_bibz/ui/core/navigations/tab_group.rb, line 69
def tab(content = nil, options = {}, html_options = nil, &block)
  if block
    content[:nav_type] = type
    content[:tag_type] = @options[:tag_type]
  else
    options[:nav_type] = type
    options[:tag_type] = @options[:tag_type]
  end
  @items << NavLink.new(content, options, html_options, &block)
end

Private Instance Methods

component_html_classes() click to toggle source
# File lib/ui_bibz/ui/core/navigations/tab_group.rb, line 82
def component_html_classes
  ['nav', 'nav-tabs', position, justify, fill]
end
component_html_options() click to toggle source
# File lib/ui_bibz/ui/core/navigations/tab_group.rb, line 86
def component_html_options
  { role: 'tablist' }
end
type() click to toggle source
# File lib/ui_bibz/ui/core/navigations/tab_group.rb, line 90
def type
  'nav-tabs'
end