class Primer::Beta::BaseButton

Use ‘BaseButton` to render an unstyled `<button>` tag that can be customized.

def call

def call
  render(Primer::BaseComponent.new(**@system_arguments)) { content }
end

def initialize(

Parameters:
  • system_arguments (Hash) -- <%= link_to_system_arguments_docs %>
  • inactive (Boolean) -- Whether the button looks visually disabled, but can still accept all the same interactions as an enabled button.
  • disabled (Boolean) -- Whether or not the button is disabled. If true, this option forces `tag:` to `:button`.
  • block (Boolean) -- Whether button is full-width with `display: block`.
  • type (Symbol) -- <%= one_of(Primer::Beta::BaseButton::TYPE_OPTIONS) %>
  • tag (Symbol) -- <%= one_of(Primer::Beta::BaseButton::TAG_OPTIONS) %>
def initialize(
  tag: DEFAULT_TAG,
  type: DEFAULT_TYPE,
  block: false,
  disabled: false,
  inactive: false,
  **system_arguments
)
  @system_arguments = system_arguments
  @system_arguments[:tag] = fetch_or_fallback(TAG_OPTIONS, tag, DEFAULT_TAG)
  @system_arguments[:type] = fetch_or_fallback(TYPE_OPTIONS, type, DEFAULT_TYPE) if @system_arguments[:tag] == :button
  @system_arguments[:classes] = class_names(
    system_arguments[:classes],
    "btn-block" => block,
    "Button--inactive" => inactive
  )
  @disabled = disabled
  return unless @disabled
  @system_arguments[:tag] = :button
  @system_arguments[:disabled] = ""
end