Class: Cmdk::Loading
Overview
Loading indicator for asynchronous items. Port of ‘<Command.Loading>`. Conditionally render this yourself while loading, as in React cmdk.
Constant Summary
Constants inherited from Base
Instance Method Summary collapse
-
#initialize(progress: nil, label: 'Loading...', **attributes) ⇒ Loading
constructor
A new instance of Loading.
- #view_template(&block) ⇒ Object
Constructor Details
#initialize(progress: nil, label: 'Loading...', **attributes) ⇒ Loading
Returns a new instance of Loading.
5 6 7 8 9 |
# File 'lib/cmdk/loading.rb', line 5 def initialize(progress: nil, label: 'Loading...', **attributes) @progress = progress @label = label @attributes = attributes end |
Instance Method Details
#view_template(&block) ⇒ Object
11 12 13 14 15 16 17 18 19 20 21 22 23 |
# File 'lib/cmdk/loading.rb', line 11 def view_template(&block) defaults = { 'cmdk-loading' => '', role: 'progressbar', aria_valuenow: @progress, aria_valuemin: '0', aria_valuemax: '100', aria_label: @label } div(**merged(defaults, @attributes)) do div(aria_hidden: 'true', &block) end end |