class Primer::ButtonComponent
Use ‘Button` for actions (e.g. in forms). Use links for destinations, or moving from one page to another.
def initialize(
-
system_arguments
(Hash
) -- <%= link_to_system_arguments_docs %> -
dropdown
(Boolean
) -- Whether or not to render a dropdown caret. -
block
(Boolean
) -- Whether button is full-width with `display: block`. -
group_item
(Boolean
) -- Whether button is part of a ButtonGroup. -
type
(Symbol
) -- (Primer::Beta::BaseButton::DEFAULT_TYPE) <%= one_of(Primer::Beta::BaseButton::TYPE_OPTIONS) %> -
tag
(Symbol
) -- (Primer::Beta::BaseButton::DEFAULT_TAG) <%= one_of(Primer::Beta::BaseButton::TAG_OPTIONS) %> -
size
(Symbol
) -- <%= one_of(Primer::ButtonComponent::SIZE_OPTIONS) %> -
variant
(Symbol
) -- DEPRECATED. <%= one_of(Primer::ButtonComponent::SIZE_OPTIONS) %> -
scheme
(Symbol
) -- <%= one_of(Primer::ButtonComponent::SCHEME_OPTIONS) %>
def initialize( scheme: DEFAULT_SCHEME, variant: nil, size: DEFAULT_SIZE, group_item: false, block: false, dropdown: false, **system_arguments ) @scheme = scheme @dropdown = dropdown @system_arguments = system_arguments @id = @system_arguments[:id] @system_arguments[:classes] = class_names( system_arguments[:classes], SCHEME_MAPPINGS[fetch_or_fallback(SCHEME_OPTIONS, scheme, DEFAULT_SCHEME)], SIZE_MAPPINGS[fetch_or_fallback(SIZE_OPTIONS, variant || size, DEFAULT_SIZE)], "btn" => !link?, "btn-block" => block, "BtnGroup-item" => group_item ) end
def link?
def link? @scheme == LINK_SCHEME end