Shortcut Key
A component for displaying keyboard shortcuts.
Usage
Example
⌘K
Note this does not trigger anything, it is purely a visual prompt
div(class: "flex flex-col items-center gap-y-4") do ShortcutKey do span(class: "text-xs") { "⌘" } plain "K" end p(class: "text-muted-foreground text-sm text-center") { "Note this does not trigger anything, it is purely a visual prompt" } end
Copied!
Copy failed!
Installation
Using RubyUI CLI
Run the install command
rails g ruby_ui:component ShortcutKey
Copied!
Copy failed!
Manual installation
1
Add RubyUI::ShortcutKey
to app/components/ruby_ui/shortcut_key.rb
# frozen_string_literal: true module RubyUI class ShortcutKey < Base def view_template(&) kbd(**attrs, &) end private def default_attrs { class: "pointer-events-none inline-flex h-5 select-none items-center gap-1 rounded border bg-muted px-1.5 font-mono text-[10px] font-medium text-muted-foreground opacity-100" } end end end
Copied!
Copy failed!
Components
Component | Built using | Source |
---|---|---|
ShortcutKey | Phlex |