Skip to main content
All search classes below use the Flex\Theme\Search namespace. Shortcut classes use Flex\Theme\Keyboard. These are the application-facing configuration/extension APIs; rendering internals and signed transport tokens should remain implementation details.

SearchConfiguration

Start with SearchConfiguration::make(). Fluent methods return the configuration instance. Collection-registration methods replace their respective explicit list. Pass the complete list once, or deliberately merge it in your own configuration factory. Inspection methods include defaults(), lockedSettings(), getSources(), getCategories(), getCommands(), getIncludedPages(), getResultView(), getEmptyView(), getStateView(), panelIds() and the corresponding boolean accessors. resourceSource($class) builds the configured automatic resource source. Do not mutate authorization-sensitive runtime snapshots globally between users. See Configuration for every saved search key and allowed value.

NativeResourceSource

The source also implements metadata(), canAccess(), page(SearchRequest) and navigationActions(). Registered resources remain subject to native global-search eligibility and policies.

CallbackSearchSource

CallbackSearchSource::make('customers') accepts a stable source ID. Its fluent methods are label(string|Closure), icon(string), aliases(array), authorize(bool|Closure), resolveUsing(Closure), filters(array) and root(bool $condition = true, bool $preload = false). resolveUsing() receives request, query and context. It must return a SearchPage within the requested page-size limit. authorize() receives user and panel. Labels are evaluated on demand; aliases are bounded to 30 entries.

SearchCommand

SearchCommand::make(string $id, string|Closure $label) creates a command. Command callbacks can receive user, panel, context (string), trail (SearchContext) and query. Match/authorization callbacks are evaluated when building a command result; use the native Action’s own authorization and service-level rules for sensitive execution.

Results and requests

  • SearchRequest(SearchContext $context, string $query = '', int $page = 1, int $perPage = 25, ?string $cursor = null) is immutable. Query length is bounded to 1000 characters, page to 1–10000, page size to 10/25/50/100 and cursor to 4096 characters.
  • SearchPage(array $items, bool $hasMore = false, ?string $nextCursor = null) is immutable. Items are native Filament GlobalSearchResult instances; at most 100 per page.
  • MediaSearchResult extends a native result with optional media, hydrated record, stable identity and recordSource.
  • SearchItem extends MediaSearchResult with sourceId, primaryAction, closeOnSelect, icon, contextData and group for command/context/navigation semantics.
Use identity when distinct custom records share a URL. Do not fabricate native recordSource identities or signed references to bypass the native adapter; implement a properly authorized custom source/action instead.

Media

ResultMedia::avatar(?string $url = null, ?string $thumbnailUrl = null), image(string $url, ?string $thumbnailUrl = null) and gravatar(string $email, string $default = 'mp') create presentation metadata. Chain initials(string), alt(string) and srcset(array $sources) as needed. See Media for URL and thumbnail bounds.

SearchCategory adapter

SearchCategory::make($id) supports label(), icon(), layout(), sort(), limit(), visible(), source(), results(), suggestions(), browse(), mediaUsing(), favorites(), actions() and emptyView(). Category IDs are lowercase identifiers up to 40 characters. Reserved names include all, recent, favorites, navigation and commands. Layout is tiles/list/chips; the collection limit is clamped to 1–5000, but large data should use bounded source pagination. browse() receives page, perPage and returns an authorized paginator or bounded iterable.

Extension interfaces

  • SearchSource: id(), metadata(), canAccess(), page(SearchRequest): SearchPage.
  • SearchSourceActions extends SearchSource with navigationActions(): array.
  • SearchCollectionStore: bounded scoped read() and write().
  • AtomicSearchCollectionStore: adds an atomic scoped mutate() callback.
  • Flex\Theme\Contracts\CanUseFlexSearch: User method canUseFlexSearch(Panel): bool.
  • Flex\Theme\Contracts\SearchableInFlex: Page/Resource static method canUseFlexSearch(): bool.

ShortcutConfiguration

ShortcutConfiguration::make() supports enabled(bool), settings(bool), footer(bool), bindings(string $action, array|string|null $bindings), search(), sidebar(), theme() and themeTransition(string). Search-related binding actions are search, sidebar, theme, next, previous, activate and back. Workspace/table bindings additionally include help, undo, navigation, row_next, row_previous, row_open, row_select, page_select, page_previous, page_next and filters. Up to four alternatives are accepted per action. defaults(), resolve(), isLocked() and canToggleSidebar() expose the effective configuration. See Keyboard for normalization, platform behavior and the UI recorder. The full workspace API, table controls, navigation sequences and custom commands are documented in Keyboard controls and Table shortcuts and selection.