class Ariadne::UI::Button::Component
@behaviors <%= link_to_component(Ariadne::Behaviors::Tooltipable) %>
@accessibility If ‘as_icon` is called, you must provide an `aria-label` or `aria-description` to the button.
You can call `as_icon` to render a button with only an icon.
Used to initiate actions on a page or form.
def as_icon(**options)
def as_icon(**options) validate_aria_label!(html_attrs) @icon_only = true @aria_label = aria(html_attrs, "label") @aria_description = aria(html_attrs, "description") options[:size] = @size if options[:svg] @svg = options[:svg] else @icon = Ariadne::UI::Heroicon::Component.new(**options) end self end
def button? = as == :button
def button? = as == :button
def button_tag
def button_tag k? ton"
def icon_or_svg
def icon_or_svg return @svg if @svg render(@icon) end
def link? = as == :link
def link? = as == :link
def trimmed_content
def trimmed_content if content.blank? d_content = content.strip trimmed_content unless content.html_safe? p unsets `html_safe`, so we have to set it back again to guarantee that HTML blocks won't break d_content.html_safe