class Primer::LabelComponent
Use labels to add contextual metadata to a design.
def call
def call render(Primer::BaseComponent.new(**@system_arguments)) { content } end
def initialize(title:, scheme: nil, variant: nil, **system_arguments)
-
system_arguments(Hash) -- <%= link_to_system_arguments_docs %> -
variant(Symbol) -- <%= one_of(Primer::LabelComponent::VARIANT_OPTIONS) %> -
scheme(Symbol) -- <%= one_of(Primer::LabelComponent::SCHEME_MAPPINGS.keys) %> -
title(String) -- `title` attribute for the component element.
Other tags:
- Example: Deprecated schemes -
Example: Variants -
Example: Schemes -
def initialize(title:, scheme: nil, variant: nil, **system_arguments) @system_arguments = system_arguments @system_arguments[:bg] = :blue if scheme.nil? @system_arguments[:tag] ||= :span @system_arguments[:title] = title @system_arguments[:classes] = class_names( "Label", system_arguments[:classes], SCHEME_MAPPINGS[fetch_or_fallback(SCHEME_OPTIONS, scheme)], VARIANT_MAPPINGS[fetch_or_fallback(VARIANT_OPTIONS, variant)] ) end