Sha256: 62b19e163a0fec01cb775b75206a5f0ecb6367ced5e5efeeb2421fe8ded47040
Contents?: true
Size: 1.3 KB
Versions: 21
Compression:
Stored size: 1.3 KB
Contents
# frozen_string_literal: true module Primer module Beta # Use `ButtonGroup` to render a series of buttons. class ButtonGroup < Primer::Component status :beta # Required list of buttons to be rendered. # # @param kwargs [Hash] The same arguments as <%= link_to_component(Primer::Beta::Button) %> renders_many :buttons, lambda { |**kwargs| kwargs[:size] = @size kwargs[:scheme] = @scheme if kwargs[:icon] Primer::Beta::IconButton.new(**kwargs) else Primer::Beta::Button.new(**kwargs) end } # @param scheme [Symbol] DEPRECATED. <%= one_of(Primer::Beta::Button::SCHEME_OPTIONS) %> # @param size [Symbol] <%= one_of(Primer::Beta::Button::SIZE_OPTIONS) %> # @param system_arguments [Hash] <%= link_to_system_arguments_docs %> def initialize(scheme: Primer::Beta::Button::DEFAULT_SCHEME, size: Primer::Beta::Button::DEFAULT_SIZE, **system_arguments) @size = size @scheme = scheme @system_arguments = deny_tag_argument(**system_arguments) @system_arguments[:tag] = :div @system_arguments[:classes] = class_names( "ButtonGroup", system_arguments[:classes] ) end def render? buttons.any? end end end end
Version data entries
21 entries across 21 versions & 2 rubygems