Class: Primer::Alpha::ActionBar
- Defined in:
- app/components/primer/alpha/action_bar.rb,
app/components/primer/alpha/action_bar/item.rb,
app/components/primer/alpha/action_bar/divider.rb
Overview
Add a general description of component here Add additional usage considerations or best practices that may aid the user to use the component correctly.
Defined Under Namespace
Constant Summary collapse
- DEFAULT_SIZE =
:medium
- SIZE_MAPPINGS =
{ DEFAULT_SIZE => nil, :small => "ActionBar--small", :large => "ActionBar--large" }.freeze
- SIZE_OPTIONS =
SIZE_MAPPINGS.keys.freeze
Constants inherited from Component
Component::INVALID_ARIA_LABEL_TAGS
Constants included from Status::Dsl
Constants included from ViewHelper
Constants included from TestSelectorHelper
TestSelectorHelper::TEST_SELECTOR_TAG
Constants included from FetchOrFallbackHelper
FetchOrFallbackHelper::InvalidValueError
Constants included from Primer::AttributesHelper
Primer::AttributesHelper::PLURAL_ARIA_ATTRIBUTES, Primer::AttributesHelper::PLURAL_DATA_ATTRIBUTES
Instance Method Summary collapse
-
#initialize(size: Primer::Alpha::ActionBar::DEFAULT_SIZE, overflow_menu: true, **system_arguments) ⇒ ActionBar
constructor
A new instance of ActionBar.
Methods inherited from Component
Methods included from JoinStyleArgumentsHelper
Methods included from TestSelectorHelper
Methods included from FetchOrFallbackHelper
#fetch_or_fallback, #fetch_or_fallback_boolean, #silence_deprecations?
Methods included from ClassNameHelper
Methods included from Primer::AttributesHelper
#aria, #data, #extract_data, #merge_aria, #merge_data, #merge_prefixed_attribute_hashes
Methods included from ExperimentalSlotHelpers
Methods included from ExperimentalRenderHelpers
Constructor Details
#initialize(size: Primer::Alpha::ActionBar::DEFAULT_SIZE, overflow_menu: true, **system_arguments) ⇒ ActionBar
Returns a new instance of ActionBar.
37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 |
# File 'app/components/primer/alpha/action_bar.rb', line 37 def initialize(size: Primer::Alpha::ActionBar::DEFAULT_SIZE, overflow_menu: true, **system_arguments) @system_arguments = system_arguments @overflow_menu = @size = fetch_or_fallback(Primer::Alpha::ActionBar::SIZE_OPTIONS, size, Primer::Alpha::ActionBar::DEFAULT_SIZE) @system_arguments[:classes] = class_names( system_arguments[:classes], "ActionBar", SIZE_MAPPINGS[@size] ) @system_arguments[:role] = "toolbar" return unless @action_menu = Primer::Alpha::ActionMenu.new( menu_id: self.class.generate_id, "data-target": "action-bar.moreMenu", hidden: true, classes: "ActionBar-more-menu", anchor_align: :end ) end |