Sha256: 7fc4d2c7aed71f260a71b53be399357f9ae5125726f2d18fb044868dd6dcee1d

Contents?: true

Size: 1.02 KB

Versions: 4

Compression:

Stored size: 1.02 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"
          @system_arguments[:"aria-current"] = selected
          @system_arguments[:scheme] = :invisible
        end
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
primer_view_components-0.0.108 app/components/primer/alpha/segmented_control/item.rb
primer_view_components-0.0.107 app/components/primer/alpha/segmented_control/item.rb
primer_view_components-0.0.106 app/components/primer/alpha/segmented_control/item.rb
primer_view_components-0.0.105 app/components/primer/alpha/segmented_control/item.rb