CtrlK
BlogDocsLog inGet started
Tessl Logo

tessl/npm-slidev--types

Comprehensive TypeScript type definitions and interfaces for the Slidev presentation framework ecosystem

Pending
Overview
Eval results
Files

context-menu.mddocs/

Context Menu System

Types for Slidev's context menu system, providing right-click menus and interactive options within presentations.

Capabilities

Context Menu Item Types

Union type for context menu items, supporting both options and separators.

/**
 * Context menu item - either an option or separator
 */
type ContextMenuItem = ContextMenuOption | 'separator';

Context Menu Option

Configuration interface for context menu options with different display modes.

/**
 * Context menu option configuration
 */
type ContextMenuOption = {
  /** Function to execute when option is selected */
  action: () => void;
  /** Whether the option is disabled */
  disabled?: boolean;
} & (
  | {
    /** Not in small mode (default) */
    small?: false;
    /** Icon component or string identifier */
    icon?: Component | string;
    /** Label text or component */
    label: string | Component;
  }
  | {
    /** Small display mode */
    small: true;
    /** Icon component or string identifier (required in small mode) */
    icon: Component | string;
    /** Label text (must be string in small mode) */
    label: string;
  }
);

Usage Examples:

import type { ContextMenuItem } from "@slidev/types";

// Regular context menu option
const printOption: ContextMenuItem = {
  label: "Print Slide",
  icon: "mdi:printer",
  action: () => window.print(),
  disabled: false
};

// Small context menu option
const shareOption: ContextMenuItem = {
  small: true,
  label: "Share",
  icon: "mdi:share",
  action: () => navigator.share({ title: "My Presentation" })
};

// Separator
const separator: ContextMenuItem = 'separator';

// Complete context menu
const contextMenuItems: ContextMenuItem[] = [
  printOption,
  shareOption,
  separator,
  {
    label: "Settings",
    action: () => openSettings()
  }
];

Types

import type { Component } from 'vue';

Install with Tessl CLI

npx tessl i tessl/npm-slidev--types

docs

cli-build.md

clicks-interactions.md

code-execution.md

config-frontmatter.md

context-menu.md

index.md

markdown-transform.md

options-system.md

setup-plugins.md

slide-data.md

table-of-contents.md

tile.json