Module: NfgUi::Components::Traits::Button
- Included in:
- Elements::Button
- Defined in:
- lib/nfg_ui/components/traits/button.rb
Overview
Access to pre-designed Button traits
Constant Summary collapse
- TRAITS =
%i[block close link outlined remote submit].freeze
Instance Method Summary collapse
- #block_trait ⇒ Object
- #close_trait ⇒ Object
- #link_trait ⇒ Object
- #outlined_trait ⇒ Object
- #remote_trait ⇒ Object
- #submit_trait ⇒ Object
Instance Method Details
#block_trait ⇒ Object
19 20 21 |
# File 'lib/nfg_ui/components/traits/button.rb', line 19 def block_trait [:block] = true end |
#close_trait ⇒ Object
23 24 25 26 27 28 29 30 |
# File 'lib/nfg_ui/components/traits/button.rb', line 23 def close_trait self.as = :button data[:dismiss] = .delete(:dismiss) [:theme] = nil @css_classes = 'close' @body = '×'.html_safe assistive_html_attributes.merge!(aria: { label: 'close' }) end |
#link_trait ⇒ Object
15 16 17 |
# File 'lib/nfg_ui/components/traits/button.rb', line 15 def link_trait [:theme] = :link end |
#outlined_trait ⇒ Object
41 42 43 |
# File 'lib/nfg_ui/components/traits/button.rb', line 41 def outlined_trait [:outlined] = true end |
#remote_trait ⇒ Object
32 33 34 |
# File 'lib/nfg_ui/components/traits/button.rb', line 32 def remote_trait [:remote] = true end |
#submit_trait ⇒ Object
36 37 38 39 |
# File 'lib/nfg_ui/components/traits/button.rb', line 36 def submit_trait self.as = :button [:type] = 'submit' end |