Class: DsfrComponent::ButtonComponent
- Defined in:
- app/components/dsfr_component/button_component.rb
Constant Summary collapse
- SIZES =
%i[sm md lg].freeze
- ICON_POSITIONS =
%i[left right].freeze
- ICON_LEVELS =
%i[primary secondary tertiary].freeze
Constants inherited from Base
DsfrComponent::Base::HEADING_LEVELS
Instance Attribute Summary
Attributes inherited from Base
Instance Method Summary collapse
- #call ⇒ Object
-
#initialize(label: nil, title: nil, icon: nil, icon_position: :left, level: nil, size: nil, classes: [], html_attributes: {}) ⇒ ButtonComponent
constructor
A new instance of ButtonComponent.
Constructor Details
#initialize(label: nil, title: nil, icon: nil, icon_position: :left, level: nil, size: nil, classes: [], html_attributes: {}) ⇒ ButtonComponent
Returns a new instance of ButtonComponent.
13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 |
# File 'app/components/dsfr_component/button_component.rb', line 13 def initialize(label: nil, title: nil, icon: nil, icon_position: :left, level: nil, size: nil, classes: [], html_attributes: {}) @label = label @title = title @icon = icon @icon_position = icon_position @level = level @outline = outline @size = size validate_size validate_icon_position validate_level validate_label super(classes: classes, html_attributes: html_attributes) end |
Instance Method Details
#call ⇒ Object
30 31 32 |
# File 'app/components/dsfr_component/button_component.rb', line 30 def call tag.(**html_attributes) { label } end |