Class: Spark::Button
- Inherits:
-
Component::Base
- Object
- ActionView::Component::Base
- Component::Base
- Spark::Button
- Defined in:
- app/components/spark/button.rb,
app/components/spark/button/group.rb
Direct Known Subclasses
Defined Under Namespace
Classes: Group
Constant Summary collapse
- COLORS =
%i[blue green yellow red purple]
- SIZES =
%i[xs small base medium large]
- STYLES =
%i[fill outline text]
- THEME =
%i[add danger primary launch]
- TYPE =
%i[button submit reset]
Instance Method Summary collapse
-
#initialize ⇒ Button
constructor
A new instance of Button.
Methods inherited from Component::Base
Constructor Details
#initialize ⇒ Button
Returns a new instance of Button.
45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 |
# File 'app/components/spark/button.rb', line 45 def initialize(*) super tag_attrs.add attr_hash(:value, :disabled, :name, :target) if (@href && (data[:remote] || data[:method])) tag_attrs.add rel: "nofollow" end if @icon_only aria.add label: @text classname.add("icon-only") end aria.add attr_hash(:hidden) tag_attrs.add(type: :button) classname.base = "spark-button" end |