Sha256: b6ca8384f39ad5fbc85fb9a574a4ce7f0cf46188b444d9b228ab33a52088ecd3

Contents?: true

Size: 1.73 KB

Versions: 15

Compression:

Stored size: 1.73 KB

Contents

# frozen_string_literal: true

module Primer
  module Alpha
    # @label RadioButton
    class RadioButtonPreview < ViewComponent::Preview
      # @label Playground
      #
      # @param name text
      # @param id text
      # @param value text
      # @param label text
      # @param caption text
      # @param visually_hide_label toggle
      # @param disabled toggle
      def playground(
        name: "my-radio-button",
        id: nil,
        value: "bsg",
        label: "Battlestar Galactica",
        caption: "A pretty good show",
        visually_hide_label: false,
        disabled: false
      )
        system_arguments = {
          name: name,
          value: value,
          label: label,
          caption: caption,
          visually_hide_label: visually_hide_label,
          disabled: disabled
        }

        render(Primer::Alpha::RadioButton.new(**system_arguments))
      end

      # @label Default
      def default
        render(Primer::Alpha::RadioButton.new(name: "my-radio-button", label: "Battlestar Galactica", value: "bsg"))
      end

      # @!group Options
      #
      # @label With caption
      def with_caption
        render(Primer::Alpha::RadioButton.new(caption: "With a caption", name: "my-radio-button", label: "Battlestar Galactica", value: "bsg1"))
      end

      # @label Visually hidden label
      def visually_hide_label
        render(Primer::Alpha::RadioButton.new(visually_hide_label: true, name: "my-radio-button", label: "Battlestar Galactica", value: "bsg2"))
      end

      # @label Disabled
      def disabled
        render(Primer::Alpha::RadioButton.new(disabled: true, name: "my-radio-button", label: "Battlestar Galactica", value: "bsg4"))
      end
      #
      # @!endgroup
    end
  end
end

Version data entries

15 entries across 15 versions & 1 rubygems

Version Path
primer_view_components-0.3.1 previews/primer/alpha/radio_button_preview.rb
primer_view_components-0.3.0 previews/primer/alpha/radio_button_preview.rb
primer_view_components-0.2.0 previews/primer/alpha/radio_button_preview.rb
primer_view_components-0.1.9 previews/primer/alpha/radio_button_preview.rb
primer_view_components-0.1.8 previews/primer/alpha/radio_button_preview.rb
primer_view_components-0.1.7 previews/primer/alpha/radio_button_preview.rb
primer_view_components-0.1.6 previews/primer/alpha/radio_button_preview.rb
primer_view_components-0.1.5 previews/primer/alpha/radio_button_preview.rb
primer_view_components-0.1.4 previews/primer/alpha/radio_button_preview.rb
primer_view_components-0.1.3 previews/primer/alpha/radio_button_preview.rb
primer_view_components-0.1.2 previews/primer/alpha/radio_button_preview.rb
primer_view_components-0.1.1 previews/primer/alpha/radio_button_preview.rb
primer_view_components-0.1.0 previews/primer/alpha/radio_button_preview.rb
primer_view_components-0.0.123 previews/primer/alpha/radio_button_preview.rb
primer_view_components-0.0.122 previews/primer/alpha/radio_button_preview.rb