Class: Cmdk::List
Overview
Contains items, groups and separators. Port of ‘<Command.List>` from cmdk. The JS runtime keeps the `–cmdk-list-height` CSS variable updated on this element so the list height can be animated.
Constant Summary
Constants inherited from Base
Instance Method Summary collapse
-
#initialize(label: 'Suggestions', **attributes) ⇒ List
constructor
A new instance of List.
- #view_template(&block) ⇒ Object
Constructor Details
#initialize(label: 'Suggestions', **attributes) ⇒ List
Returns a new instance of List.
6 7 8 9 |
# File 'lib/cmdk/list.rb', line 6 def initialize(label: 'Suggestions', **attributes) @label = label @attributes = attributes end |
Instance Method Details
#view_template(&block) ⇒ Object
11 12 13 14 15 |
# File 'lib/cmdk/list.rb', line 11 def view_template(&block) div(**merged({ 'cmdk-list' => '', role: 'listbox', tabindex: '-1', aria_label: @label }, @attributes)) do div('cmdk-list-sizer' => '') { block ? block.call : nil } end end |