Skip to main content

Overview

The hints system displays overlays on clickable elements, allowing keyboard-based navigation and interaction. Hints can be shown for both content elements (links, buttons) and browser UI elements.

Methods

show()

Find and show hints for clickable elements.
glide.hints.show(opts?: HintShowOptions): void
opts
object
Options for configuring hint generation and behavior

Examples

// Basic usage - hint all clickable elements
glide.hints.show();

// Hint only links
glide.hints.show({ selector: "a" });

// Hint editable fields with auto-focus
glide.hints.show({ 
  editable: true,
  auto_activate: true,
  action({ content }) {
    content.execute((el) => el.focus());
  }
});

// Copy link URLs to clipboard
glide.hints.show({
  selector: "a[href]",
  async action({ content }) {
    const href = await content.execute((el) => el.href);
    navigator.clipboard.writeText(href);
  }
});

// Hint browser tabs
glide.hints.show({ 
  location: "browser-ui",
  include: "tab" 
});

Label Generators

label_generators.prefix_free

Generates prefix-free hint labels using characters from glide.o.hint_chars. This ensures you never need to press more keys than necessary.
glide.hints.show({
  label_generator: glide.hints.label_generators.prefix_free
});

label_generators.numeric

Generates sequential numeric labels starting at 1.
glide.hints.show({
  label_generator: glide.hints.label_generators.numeric
});

Types

HintAction

type HintAction = 
  | "click"
  | "newtab-click"
  | ((props: HintActionProps) => Promise<void> | void);

interface HintActionProps {
  hint: Hint;
  content: {
    execute<R>(cb: (target: HTMLElement) => R): Promise<R>;
  };
}

HintLabelGenerator

type HintLabelGenerator = (ctx: HintLabelGeneratorProps) => string[] | Promise<string[]>;

interface HintLabelGeneratorProps {
  hints: Hint[];
  content: {
    map<R>(
      cb: (target: HTMLElement, index: number) => R
    ): Promise<R[]>;
  };
}

HintPicker

type HintPicker = (props: HintPickerProps) => Hint[] | Promise<Hint[]>;

interface HintPickerProps {
  hints: Hint[];
  content: {
    map<R>(
      cb: (target: HTMLElement, index: number) => R
    ): Promise<R[]>;
  };
}

Hint

interface Hint {
  id: number;
  x: number;
  y: number;
  width: number;
  height: number;
  label?: string;
}

Configuration

Hint behavior can be configured globally via glide.o:
// Change hint label characters
glide.o.hint_chars = "asdfjkl;";

// Change hint label size
glide.o.hint_size = "14px";

// Set default label generator
glide.o.hint_label_generator = glide.hints.label_generators.numeric;

Hintable Elements

By default, hints are shown for:
  • Links (<a>)
  • Buttons (<button>)
  • Input fields (<input>, <textarea>)
  • Interactive elements (<details>, <summary>, <label>)
  • Elements with click listeners (when include_click_listeners is enabled)
  • Elements with specific ARIA roles (button, link, tab, etc.)
  • Elements matching the include selector
  • Editable elements (when editable is true)

See Also

Build docs developers (and LLMs) love