Sha256: a935715e1e72841ce487a9998a2161b6856d9c5c0d14c0dfcb180c8349f52410

Contents?: true

Size: 1.35 KB

Versions: 54

Compression:

Stored size: 1.35 KB

Contents

# frozen_string_literal: true

module Primer
  # Use `TabContainer` to create tabbed content with keyboard support. This component does not add any styles.
  # It only provides the tab functionality. If you want styled Tabs you can look at <%= link_to_component(Primer::Alpha::TabNav) %>.
  #
  # This component requires javascript.
  class TabContainerComponent < Primer::Component
    # @example Default
    #   <%= render(Primer::TabContainerComponent.new)  do %>
    #     <div role="tablist">
    #       <button type="button" role="tab" aria-selected="true">Tab one</button>
    #       <button type="button" role="tab" tabindex="-1">Tab two</button>
    #       <button type="button" role="tab" tabindex="-1">Tab three</button>
    #     </div>
    #     <div role="tabpanel">
    #       Panel 1
    #     </div>
    #     <div role="tabpanel" hidden>
    #       Panel 2
    #     </div>
    #     <div role="tabpanel" hidden>
    #       Panel 3
    #     </div>
    #   <% end %>
    #
    # @param system_arguments [Hash] <%= link_to_system_arguments_docs %>
    def initialize(**system_arguments)
      @system_arguments = deny_tag_argument(**system_arguments)
      @system_arguments[:tag] = "tab-container"
    end

    def call
      render(Primer::BaseComponent.new(**@system_arguments)) { content }
    end

    def render?
      content.present?
    end
  end
end

Version data entries

54 entries across 54 versions & 1 rubygems

Version Path
primer_view_components-0.0.116 app/components/primer/tab_container_component.rb
primer_view_components-0.0.114 app/components/primer/tab_container_component.rb
primer_view_components-0.0.113 app/components/primer/tab_container_component.rb
primer_view_components-0.0.112 app/components/primer/tab_container_component.rb
primer_view_components-0.0.111 app/components/primer/tab_container_component.rb
primer_view_components-0.0.110 app/components/primer/tab_container_component.rb
primer_view_components-0.0.109 app/components/primer/tab_container_component.rb
primer_view_components-0.0.108 app/components/primer/tab_container_component.rb
primer_view_components-0.0.107 app/components/primer/tab_container_component.rb
primer_view_components-0.0.106 app/components/primer/tab_container_component.rb
primer_view_components-0.0.105 app/components/primer/tab_container_component.rb
primer_view_components-0.0.104 app/components/primer/tab_container_component.rb
primer_view_components-0.0.103 app/components/primer/tab_container_component.rb
primer_view_components-0.0.102 app/components/primer/tab_container_component.rb
primer_view_components-0.0.101 app/components/primer/tab_container_component.rb
primer_view_components-0.0.100 app/components/primer/tab_container_component.rb
primer_view_components-0.0.99 app/components/primer/tab_container_component.rb
primer_view_components-0.0.98 app/components/primer/tab_container_component.rb
primer_view_components-0.0.97 app/components/primer/tab_container_component.rb
primer_view_components-0.0.96 app/components/primer/tab_container_component.rb