Sha256: e930565944e344e85883296a41f31aebf066e1b971f34f0779e4a1315f01cca5

Contents?: true

Size: 1.05 KB

Versions: 12

Compression:

Stored size: 1.05 KB

Contents

# frozen_string_literal: true

module Primer
  module Alpha
    class SegmentedControl
      # SegmentedControl::Item is a private component that is only used by SegmentedControl
      # It wraps the Button and IconButton components to provide the correct styles
      class Item < Primer::BaseComponent
        status :alpha

        # @param label [String] The label to use
        # @param selected [Boolean] Whether the item is selected
        # @param icon [Symbol] The icon to use
        # @param hide_labels [Symbol] Whether to only show the icon
        def initialize(label:, selected: false, icon: nil, hide_labels: false, **system_arguments)
          @icon = icon
          @hide_labels = hide_labels
          @label = label
          @selected = selected

          @system_arguments = system_arguments
          @system_arguments[:"data-action"] = "click:segmented-control#select" if system_arguments[:href].nil?
          @system_arguments[:"aria-current"] = selected
          @system_arguments[:scheme] = :invisible
        end
      end
    end
  end
end

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
primer_view_components-0.0.120 app/components/primer/alpha/segmented_control/item.rb
primer_view_components-0.0.119 app/components/primer/alpha/segmented_control/item.rb
primer_view_components-0.0.118 app/components/primer/alpha/segmented_control/item.rb
primer_view_components-0.0.117 app/components/primer/alpha/segmented_control/item.rb
primer_view_components-0.0.116 app/components/primer/alpha/segmented_control/item.rb
primer_view_components-0.0.115 app/components/primer/alpha/segmented_control/item.rb
primer_view_components-0.0.114 app/components/primer/alpha/segmented_control/item.rb
primer_view_components-0.0.113 app/components/primer/alpha/segmented_control/item.rb
primer_view_components-0.0.112 app/components/primer/alpha/segmented_control/item.rb
primer_view_components-0.0.111 app/components/primer/alpha/segmented_control/item.rb
primer_view_components-0.0.110 app/components/primer/alpha/segmented_control/item.rb
primer_view_components-0.0.109 app/components/primer/alpha/segmented_control/item.rb