class Ariadne::UI::ClipboardCopy::Component
This component has a built-in ‘aria-live` region that announces “Copied!” when the copy element is pressed.
Always set an accessible label (through `aria-label`) to help the user interact with the component.
@accessibility
Use this to copy element text content or input values to the clipboard.
def before_render
def before_render validate_aria_label!(html_attrs) if content.blank? end
def classes
def classes style(:button, size:) + style(:size) end
def initialize(**options)
def initialize(**options) super validate! end
def validate!
def validate! ArgumentError, "Must provide either `value` or `for`" if @value.blank? && @for.blank? ArgumentError, "Must provide only `value` or `for`, not both" if @value.present? && @for.present?