Class Kbd<T extends Kbd<T>>


public class Kbd<T extends Kbd<T>> extends PhrasingContentElement<T>
Represents an HTML <kbd> (keyboard input) element.

The <kbd> element represents user input from a keyboard, voice input, or any other text entry device. It is typically used to mark keystrokes, keyboard shortcuts, or commands that users should type. Browsers usually render kbd elements in a monospace font to distinguish them from regular text.

Features:

  • Represents keyboard input or user commands
  • Typically rendered in monospace font
  • Used for documenting keyboard shortcuts and commands
  • Improves semantic meaning of technical documentation

Usage:


 // Show a keyboard shortcut
 Kbd shortcut = new Kbd("Ctrl+C");

 // Document a command
 P instruction = new P();
 instruction.addText("Press ");
 instruction.addElement(new Kbd("Enter"));
 instruction.addText(" to submit.");

 // Multiple keys
 Kbd combo = new Kbd("Alt+Tab");
 
Since:
2007
Version:
1.0
Author:
Marvin P. Warble Jr.
See Also:
  • Constructor Details

    • Kbd

      public Kbd()
      Constructs an empty <kbd> element.

      Creates a keyboard input element without initial content. Text representing keyboard input can be added later using inherited methods.

    • Kbd

      public Kbd(String text)
      Constructs a <kbd> element with the specified keyboard input text.
      Parameters:
      text - the keyboard input text (e.g., "Ctrl+S", "Enter"); may be null or empty