Method: Primer::Beta::ClipboardCopy#initialize

Defined in:
app/components/primer/beta/clipboard_copy.rb

#initialize(value: nil, **system_arguments) ⇒ ClipboardCopy

Returns a new instance of ClipboardCopy.

Parameters:

  • aria-label (String)

    String that will be read to screenreaders when the component is focused

  • value (String) (defaults to: nil)

    Text to copy into the users clipboard when they click the component.

  • for (String)

    Element id from where to get the copied value.

  • system_arguments (Hash)

    <%= link_to_system_arguments_docs %>

[View source]

22
23
24
25
26
27
28
29
30
# File 'app/components/primer/beta/clipboard_copy.rb', line 22

def initialize(value: nil, **system_arguments)
  @system_arguments = deny_tag_argument(**system_arguments)
  @value = value

  validate!

  @system_arguments[:tag] = "clipboard-copy"
  @system_arguments[:value] = value if value.present?
end