JSFiddle - React, Tailwind, and code Playground

HTML

<label for="search">Search: </label>
    <input id="search" />
    <input id="searchval" />

CSS

<style>
    .ui-autocomplete-category {
        font-weight: bold;
        padding: .2em .4em;
        margin: .8em 0 .2em;
        line-height: 1.5;
    }
    </style>

JavaScript

$.widget( "custom.catcomplete", $.ui.autocomplete, {
        _renderMenu: function( ul, items ) {
            var self = this,
                currentCategory = "";
            $.each( items, function( index, item ) {
                if ( item.category != currentCategory ) {
                    ul.append( "<li class='ui-autocomplete-category'>" + item.category + "</li>" );
                    currentCategory = item.category;
                }
                self._renderItem( ul, item );
            });
        }
    });
    $(function() {
        var data = [
            { label: "anders", id: "1", category: "" },
            { label: "andreas", id: "2", category: "" },
            { label: "antal", id: "3", category: "" },
            { label: "annhhx10", id: "4", category: "Products" },
            { label: "annk K12", id: "5", category: "Products" },
            { label: "annttop C13", id: "6", category: "Products" },
            { label: "anders andersson", id: "7", category: "People" },
            { label: "andreas andersson", id: "8", category: "People" },
            { label: "andreas johnson", id: "9", category: "People" }
        ];
        
        $( "#search" ).catcomplete({
            delay: 0,
            source: data,
            select: function(event, ui) {
                $('#searchval').val(ui.item.id);
            }
        
        });
    });