Skip to main content

Overview

Hux UI provides a comprehensive context menu system with smart positioning and cross-platform support:
  • HuxContextMenu - Main wrapper widget with smart positioning
  • HuxContextMenuItem - Individual menu items with icons and states
  • HuxContextMenuDivider - Visual separators for menu groups
HuxContextMenu Component

Component Variants

Basic Context Menu

Simple context menu with basic actions:

Context Menu with Dividers

Organized menu with visual separators:

Context Menu with Disabled Items

Menu with disabled and destructive actions:

File Context Menu

Context menu for file operations:

Basic Usage

Features

  • Smart Positioning - Automatic menu positioning to prevent screen overflow
  • Cross-Platform - Works on desktop, mobile, and web
  • Web Optimization - Proper browser context menu prevention
  • Consistent Design - Follows Hux UI design system
  • Theme Aware - Adapts to light and dark themes

Components

HuxContextMenu

Main wrapper that handles context menu display and positioning. Properties:
  • menuItems - List of menu items and dividers
  • child - Widget that triggers the context menu

HuxContextMenuItem

Individual menu item with icon, text, and interaction handling. Properties:
  • text - Menu item label
  • icon - Optional icon (FeatherIcons recommended)
  • onTap - Action callback
  • isDisabled - Whether the item is disabled
  • isDestructive - Whether the item represents a destructive action

HuxContextMenuDivider

Visual separator for organizing menu items into groups.

Advanced Example

Platform Support

  • Desktop - Right-click support with proper positioning
  • Mobile - Long-press gesture support
  • Web - Proper browser context menu prevention
Context menus automatically prevent the browser’s default context menu on web platforms using the universal_html package.

Examples

File Manager

See context menus in a file management interface

Text Editor

Learn how to implement editor context menus
Right-click any component in the example app to see context menus in action!