cmdk_ui

Platform-aware inputs and modal helpers for cmdk. Keep your command menu's layout and styling, and use native text editing for search, selection, and clipboard actions.

cmdk_ui re-exports cmdk, so one import gives you the command widgets and adapters.

Installation

Requires Flutter 3.47 or newer and Dart 3.13 or newer. Add cmdk_ui to your pubspec.yaml:

dependencies:
  cmdk_ui: ^0.1.0

Then run flutter pub get.

Search menu

Use AdaptiveCommandInput inside a Command. It follows the platform's text editing conventions: Cupertino on iOS/macOS and Material on other platforms.

import 'package:cmdk_ui/cmdk_ui.dart';
import 'package:flutter/widgets.dart';

Widget searchMenu({
  required VoidCallback openSettings,
  required VoidCallback openHelp,
}) {
  return SizedBox(
    width: 320,
    height: 240,
    child: Command(
      label: 'Quick actions',
      onSearchChange: (query) => debugPrint('Search: $query'),
      child: Column(
        children: [
          const AdaptiveCommandInput(
            placeholder: 'Search commands...',
            filled: true,
          ),
          Expanded(
            child: CommandList(
              children: [
                const CommandEmpty(child: Text('No results found.')),
                CommandItem(
                  value: 'Settings',
                  keywords: const ['preferences'],
                  onSelect: openSettings,
                  child: const Text('Settings'),
                ),
                CommandItem(
                  value: 'Help',
                  keywords: const ['support'],
                  onSelect: openHelp,
                  child: const Text('Help'),
                ),
              ],
            ),
          ),
        ],
      ),
    ),
  );
}

Type “preferences” to find Settings or “support” to find Help. Command handles filtering and ranking automatically; onSearchChange lets your app observe the query. Use ↑ / ↓ and Enter, or tap a result, to run its action.

The adapters use material_ui and cupertino_ui. Provide their corresponding themes and localizations in your app; the showcase app setup uses MaterialApp from package:material_ui/material_ui.dart. Menu rows remain yours to style with CommandItem.builder.

If you already use CommandInput, set its editorBuilder to adaptiveCommandInputBuilder(), materialCommandInputBuilder(), or cupertinoCommandInputBuilder() to keep your existing input layout. See the editor guide for selection menus, keyboard settings, and custom editors.

Dialogs and bottom sheets

Open the modal showcase to try showMaterialCommandDialog, showCupertinoCommandDialog, and showCommandModalBottomSheet with the same menu. Each helper presents the widget you build and returns the result passed to Navigator.pop, or null on dismissal. Use a context below your app's Navigator when opening a modal.

The complete presentation examples and shared menu show how to return a selected command and handle keyboard insets in a bottom sheet.

For async search, nested pages, and selection-driven previews, explore the example app. Run the full showcase from a repository checkout:

flutter pub get
cd example
flutter run -d chrome

Libraries

adaptive
Adaptive platform-aware widgets and builders for cmdk.
cmdk_ui
UI library adapters, platform integrations, and mobile patterns for cmdk.
cupertino
Cupertino adapters and widgets for cmdk.
material
Material adapters and widgets for cmdk.
mobile
Mobile adapters and bottom sheet patterns for cmdk.
scrollbar
Scrollbar adapters and utilities for cmdk.