class Primer::ButtonMarketingComponent
Use buttons for actions (e.g. in forms). Use links for destinations, or moving from one page to another.
def call
def call render(Primer::BaseComponent.new(**@system_arguments)) { content } end
def initialize(
-
system_arguments(Hash) -- <%= link_to_system_arguments_docs %> -
type(Symbol) -- <%= one_of(Primer::ButtonMarketingComponent::TYPE_OPTIONS) %> -
tag(Symbol) -- <%= one_of(Primer::ButtonMarketingComponent::TAG_OPTIONS) %> -
variant(Symbol) -- <%= one_of(Primer::ButtonMarketingComponent::VARIANT_OPTIONS) %> -
button_type(Symbol) -- <%= one_of(Primer::ButtonMarketingComponent::BUTTON_TYPE_OPTIONS) %>
Other tags:
- Example: Sizes -
Example: Button types -
def initialize( button_type: DEFAULT_BUTTON_TYPE, variant: DEFAULT_VARIANT, tag: DEFAULT_TAG, type: DEFAULT_TYPE, **system_arguments ) @system_arguments = system_arguments @system_arguments[:tag] = fetch_or_fallback(TAG_OPTIONS, tag, DEFAULT_TAG) if @system_arguments[:tag] == :a @system_arguments[:role] = :button else @system_arguments[:type] = fetch_or_fallback(TYPE_OPTIONS, type, DEFAULT_TYPE) end @system_arguments[:classes] = class_names( "btn-mktg", BUTTON_TYPE_MAPPINGS[fetch_or_fallback(BUTTON_TYPE_OPTIONS, button_type, DEFAULT_BUTTON_TYPE)], VARIANT_MAPPINGS[fetch_or_fallback(VARIANT_OPTIONS, variant, DEFAULT_VARIANT)], system_arguments[:classes] ) end