Class: Ui::Button::Component
- Inherits:
-
Ui::BaseComponent
- Object
- Ui::BaseComponent
- Ui::Button::Component
- Defined in:
- lib/uikit_rails/templates/components/button/component.rb
Overview
Button component with multiple variants and sizes.
Constant Summary collapse
- VARIANTS =
%i[default destructive outline secondary ghost link].freeze
- SIZES =
%i[sm md lg icon].freeze
Instance Attribute Summary collapse
-
#html_attrs ⇒ Object
readonly
Returns the value of attribute html_attrs.
-
#size ⇒ Object
readonly
Returns the value of attribute size.
-
#tag ⇒ Object
readonly
Returns the value of attribute tag.
-
#variant ⇒ Object
readonly
Returns the value of attribute variant.
Instance Method Summary collapse
- #call ⇒ Object
-
#initialize(variant: :default, size: :md, tag: :button, **html_attrs) ⇒ Component
constructor
A new instance of Component.
Constructor Details
#initialize(variant: :default, size: :md, tag: :button, **html_attrs) ⇒ Component
Returns a new instance of Component.
12 13 14 15 16 17 18 |
# File 'lib/uikit_rails/templates/components/button/component.rb', line 12 def initialize(variant: :default, size: :md, tag: :button, **html_attrs) @variant = variant.to_sym @size = size.to_sym @tag = tag @html_attrs = html_attrs super() end |
Instance Attribute Details
#html_attrs ⇒ Object (readonly)
Returns the value of attribute html_attrs.
10 11 12 |
# File 'lib/uikit_rails/templates/components/button/component.rb', line 10 def html_attrs @html_attrs end |
#size ⇒ Object (readonly)
Returns the value of attribute size.
10 11 12 |
# File 'lib/uikit_rails/templates/components/button/component.rb', line 10 def size @size end |
#tag ⇒ Object (readonly)
Returns the value of attribute tag.
10 11 12 |
# File 'lib/uikit_rails/templates/components/button/component.rb', line 10 def tag @tag end |
#variant ⇒ Object (readonly)
Returns the value of attribute variant.
10 11 12 |
# File 'lib/uikit_rails/templates/components/button/component.rb', line 10 def variant @variant end |
Instance Method Details
#call ⇒ Object
20 21 22 |
# File 'lib/uikit_rails/templates/components/button/component.rb', line 20 def call content_tag(tag, content, **computed_attrs) end |