platform-bible-react
    Preparing search index...

    Interface RecentSearchesProps<T>

    Interface defining the properties for the RecentSearches component

    interface RecentSearchesProps<T> {
        ariaLabel?: string;
        buttonClassName?: string;
        buttonVariant?:
            | null
            | "link"
            | "default"
            | "outline"
            | "secondary"
            | "destructive"
            | "ghost"
            | "subtle";
        classNameForItems?: string;
        getItemKey?: (item: T) => string;
        groupHeading?: string;
        id?: string;
        onOpenChange?: (open: boolean) => void;
        onSearchItemSelect: (item: T) => void;
        open?: boolean;
        recentSearches: T[];
        renderItem?: (item: T) => string;
    }

    Type Parameters

    • T
    Index

    Properties

    ariaLabel?: string

    Accessible name for the trigger button, which is also rendered as the button's visible tooltip text. Write it as user-visible microcopy (sentence case), not as a screen-reader-only phrase.

    Passing an empty string suppresses the tooltip AND leaves the icon-only button without an accessible name, so prefer omitting the prop — which falls back to a sensible default — over passing ''.

    A value that is still a raw %localization_key% is treated as not-yet-localized and falls back to the default, so a key can never reach the screen as tooltip text.

    buttonClassName?: string

    Class name for the trigger button. Defaults to absolute positioning inside an input field. Pass a custom value to render the button standalone (e.g. "tw:h-9 tw:w-9")

    buttonVariant?:
        | null
        | "link"
        | "default"
        | "outline"
        | "secondary"
        | "destructive"
        | "ghost"
        | "subtle"

    Variant for the trigger button. Defaults to "ghost"

    classNameForItems?: string

    Class name for styling the DropdownMenuItem for each recent search result

    getItemKey?: (item: T) => string

    Function to create a unique key for each item

    groupHeading?: string

    Heading for the recent searches list. Rendered as the list's visible heading and used as its accessible name, so a screen reader announces what the list is rather than a bare "menu". Falls back to the default when omitted or still a raw %localization_key%.

    id?: string

    Optional ID for the dropdown menu content for accessibility

    onOpenChange?: (open: boolean) => void

    Called when the open state changes. Required when open is provided.

    onSearchItemSelect: (item: T) => void

    Callback when a recent search item is selected

    open?: boolean

    Controlled open state of the dropdown menu. If provided, the component becomes controlled.

    recentSearches: T[]

    Array of recent search items

    renderItem?: (item: T) => string

    Function to render each search item as a string for display