Class: Cmdk::Footer
Overview
Palette footer, as seen in Raycast-style command menus (an extension over the React API). Render any content; include an element with the ‘cmdk-footer-hint` attribute (or pass no block to get one) and the runtime fills it with the selected item’s ‘hint:` text and `kbd:` keys:
Cmdk::Item(hint: 'Open in New Tab', kbd: '⌘ ↵') { 'Figma' }
Cmdk::Footer() do
span { '🚀' }
div('cmdk-footer-hint' => '')
end
The hint container gets ‘data-empty` when the selected item has no hint.
Constant Summary
Constants inherited from Base
Instance Method Summary collapse
-
#initialize(**attributes) ⇒ Footer
constructor
A new instance of Footer.
- #view_template(&block) ⇒ Object
Constructor Details
#initialize(**attributes) ⇒ Footer
Returns a new instance of Footer.
16 17 18 |
# File 'lib/cmdk/footer.rb', line 16 def initialize(**attributes) @attributes = attributes end |
Instance Method Details
#view_template(&block) ⇒ Object
20 21 22 23 24 25 26 27 28 |
# File 'lib/cmdk/footer.rb', line 20 def view_template(&block) div(**merged({ 'cmdk-footer' => '' }, @attributes)) do if block block.call else div('cmdk-footer-hint' => '') end end end |