Class: Primer::Alpha::HellipButton

Inherits:
Component
  • Object
show all
Defined in:
app/components/primer/alpha/hellip_button.rb

Overview

Use ‘HellipButton` to render a button with a hellip. Often used for hidden text expanders.

Constant Summary

Constants inherited from Component

Component::INVALID_ARIA_LABEL_TAGS

Constants included from Status::Dsl

Status::Dsl::STATUSES

Constants included from ViewHelper

ViewHelper::HELPERS

Constants included from TestSelectorHelper

TestSelectorHelper::TEST_SELECTOR_TAG

Constants included from FetchOrFallbackHelper

FetchOrFallbackHelper::InvalidValueError

Constants included from Primer::AttributesHelper

Primer::AttributesHelper::PLURAL_ARIA_ATTRIBUTES, Primer::AttributesHelper::PLURAL_DATA_ATTRIBUTES

Instance Method Summary collapse

Methods inherited from Component

deprecated?, generate_id

Methods included from JoinStyleArgumentsHelper

#join_style_arguments

Methods included from TestSelectorHelper

#add_test_selector

Methods included from FetchOrFallbackHelper

#fetch_or_fallback, #fetch_or_fallback_boolean, #silence_deprecations?

Methods included from ClassNameHelper

#class_names

Methods included from Primer::AttributesHelper

#aria, #data, #merge_aria, #merge_data, #merge_prefixed_attribute_hashes

Constructor Details

#initialize(inline: false, disabled: false, **system_arguments) ⇒ HellipButton

Returns a new instance of HellipButton.

Parameters:

  • inline (Boolean) (defaults to: false)

    Whether or not the button is inline.

  • disabled (Boolean) (defaults to: false)

    Whether or not the button is disabled.

  • system_arguments (Hash)

    <%= link_to_system_arguments_docs %>



15
16
17
18
19
20
21
22
23
24
25
26
27
# File 'app/components/primer/alpha/hellip_button.rb', line 15

def initialize(inline: false, disabled: false, **system_arguments)
  @system_arguments = deny_tag_argument(**system_arguments)

  validate_aria_label

  @system_arguments[:tag] = :button
  @system_arguments[:"aria-expanded"] = false
  @system_arguments[:classes] = class_names(
    @system_arguments[:classes],
    "inline" => inline
  )
  @system_arguments[:disabled] = disabled
end

Instance Method Details

#callObject



29
30
31
# File 'app/components/primer/alpha/hellip_button.rb', line 29

def call
  render(Primer::Beta::BaseButton.new(**@system_arguments)) { "&hellip;".html_safe }
end