Class: Yattho::Alpha::HellipButton

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

Overview

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

Direct Known Subclasses

HellipButton

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

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

Constructor Details

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

Returns a new instance of HellipButton.

Examples:

Default

<%= render(Yattho::Alpha::HellipButton.new("aria-label": "No effect")) %>

Inline

<%= render(Yattho::Alpha::HellipButton.new(inline: true, "aria-label": "No effect")) %>

Styling the button

<%= render(Yattho::Alpha::HellipButton.new(p: 1, classes: "custom-class", "aria-label": "No effect")) %>

Parameters:

  • inline (Boolean) (defaults to: false)

    Whether or not the button is inline.

  • system_arguments (Hash)

    <%= link_to_system_arguments_docs %>



23
24
25
26
27
28
29
30
31
32
33
34
# File 'app/components/yattho/alpha/hellip_button.rb', line 23

def initialize(inline: 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
  )
end

Instance Method Details

#callObject



36
37
38
# File 'app/components/yattho/alpha/hellip_button.rb', line 36

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