Input Style

Free Themes

Built-in component themes created by the PrimeFaces Theme Designer.

Saga Saga
Vela Vela
Arya Arya

Legacy Free Themes

Luna Amber Luna Amber
Luna Blue Luna Blue
Luna Green Luna Green
Luna Pink Luna Pink
Nova Nova
Nova Nova Alt
Nova Nova Accent

PREMIUM TEMPLATES

Create awesome applications in no time using the premium templates and impress your users.

AutoComplete

AutoComplete displays suggestions while the input is being type. AutoComplete features various options, customizable content, multiple selection, effects and events.

Single
Multiple

<div class="card ui-fluid ">
    <h:form>
        <p:growl id="msgs" showDetail="true" skipDetailIfEqualsSummary="true"/>

        <h5 class="p-mt-0">Single</h5>
        <div class="p-formgrid p-grid">
            <div class="p-field p-col-12 p-md-4">
                <p:outputLabel value="Simple" for="@next"/>
                <p:autoComplete id="acSimple" value="#{autoCompleteView.txt1}"
                            completeMethod="#{autoCompleteView.completeText}" scrollHeight="250"/>
            </div>

            <div class="p-field p-col-12 p-md-4">
                <p:outputLabel value="Min Length (3)" for="@next"/>
                <p:autoComplete id="acMinLength" minQueryLength="3" value="#{autoCompleteView.txt2}"
                                completeMethod="#{autoCompleteView.completeText}" effect="fade" scrollHeight="250"/>
            </div>

            <div class="p-field p-col-12 p-md-4">
                <p:outputLabel value="Delay(1000)" for="@next"/>
                <p:autoComplete id="acDelay" queryDelay="1000" value="#{autoCompleteView.txt3}"
                            completeMethod="#{autoCompleteView.completeText}" effect="blind" scrollHeight="250"/>
            </div>

            <div class="p-field p-col-12 p-md-4">
                <p:outputLabel value="Max Results(5)" for="@next"/>
                <p:autoComplete id="acMaxResults" maxResults="5" value="#{autoCompleteView.txt4}"
                            completeMethod="#{autoCompleteView.completeText}" scrollHeight="250"/>
            </div>

            <div class="p-field p-col-12 p-md-4">
                <p:outputLabel value="Force Selection" for="@next"/>
                <p:autoComplete id="acForce" forceSelection="true" value="#{autoCompleteView.txt5}"
                            completeMethod="#{autoCompleteView.completeText}" scrollHeight="250"/>
            </div>

            <div class="p-field p-col-12 p-md-4">
                <p:outputLabel value="DropDown" for="@next"/>
                <p:autoComplete id="dd" dropdown="true" value="#{autoCompleteView.txt6}"
                            completeMethod="#{autoCompleteView.completeText}" scrollHeight="250"/>
            </div>

            <div class="p-field p-col-12 p-md-4">
                <p:outputLabel value="Cache" for="@next"/>
                <p:autoComplete id="cache" cache="true" cacheTimeout="30000" value="#{autoCompleteView.txt7}"
                            completeMethod="#{autoCompleteView.completeText}" scrollHeight="250"/>
            </div>

            <div class="p-field p-col-12 p-md-4">
                <p:outputLabel value="Select Event" for="@next"/>
                <p:autoComplete id="event" value="#{autoCompleteView.txt8}"
                                completeMethod="#{autoCompleteView.completeText}" scrollHeight="250">
                    <p:ajax event="itemSelect" listener="#{autoCompleteView.onItemSelect}" update="msgs"/>
                </p:autoComplete>
            </div>

            <div class="p-field p-col-12 p-md-4">
                <p:outputLabel value="Empty message" for="@next"/>
                <p:autoComplete id="emptyMessage" value="#{autoCompleteView.txt9}"
                                completeMethod="#{autoCompleteView.noResults}"
                                emptyMessage="No results" scrollHeight="250">
                    <p:ajax event="emptyMessageSelect" listener="#{autoCompleteView.onEmptyMessageSelect}"
                            update="msgs"/>
                </p:autoComplete>
            </div>

            <div class="p-field p-col-12 p-md-4">
                <p:outputLabel value="Pojo" for="@next"/>
                <p:autoComplete id="pojo" value="#{autoCompleteView.country1}"
                                completeMethod="#{autoCompleteView.completeCountry}"
                                var="country" itemLabel="#{country.name}" itemValue="#{country}"
                                converter="#{countryConverter}" forceSelection="true" scrollHeight="250"/>
            </div>

            <div class="p-field p-col-12 p-md-4">
                <p:outputLabel value="Pojo (via REST)" for="pojoRest"/>
                <p:autoComplete id="pojoRest" widgetVar="countryPojoRest" value="#{autoCompleteView.country5}"
                                var="country" itemLabel="#{country.displayName}" itemValue="#{country}"
                                converter="#{countryConverter}"
                                completeEndpoint="#{request.contextPath}/rest/country/autocomplete"
                                forceSelection="true" emptyMessage="sorry, no suggestions"
                                moreText="more items available" scrollHeight="250"/>
            </div>

            <div class="p-field p-col-12 p-md-4">
                <p:outputLabel value="Custom Content" for="@next"/>
                <p:autoComplete id="countryCustom" value="#{autoCompleteView.country2}"
                                completeMethod="#{autoCompleteView.completeCountry}"
                                var="country" itemLabel="#{country.name}" itemValue="#{country}"
                                converter="#{countryConverter}" forceSelection="true" scrollHeight="250">
                    <p:column>
                        <span class="flag flag-#{country.code}" style="width: 30px; height: 20px"/>
                        <h:outputText style="vertical-align: middle; margin-left: .5rem" value="#{country.name}"/>
                    </p:column>
                </p:autoComplete>
            </div>

            <div class="p-field p-col-12 p-md-4">
                <p:outputLabel value="Itemtip" for="@next"/>
                <p:autoComplete id="itemTip" value="#{autoCompleteView.country3}"
                                completeMethod="#{autoCompleteView.completeCountry}"
                                var="country" itemLabel="#{country.name}" itemValue="#{country}"
                                converter="#{countryConverter}" scrollHeight="250">
                    <f:facet name="itemtip">
                        <h:panelGrid columns="2" cellpadding="5">
                            <f:facet name="header">
                                <span class="flag flag-#{country.code}" style="width: 30px; height: 20px"/>
                            </f:facet>

                            <h:outputText value="Name"/>
                            <h:outputText value="#{country.name}"/>

                            <h:outputText value="Code"/>
                            <h:outputText value="#{country.code}"/>
                        </h:panelGrid>
                    </f:facet>
                </p:autoComplete>
            </div>

            <div class="p-field p-col-12 p-md-4">
                <p:outputLabel value="Group" for="@next"/>
                <p:autoComplete id="group" value="#{autoCompleteView.country4}"
                                completeMethod="#{autoCompleteView.completeCountry}"
                                var="country" itemLabel="#{country.name}" itemValue="#{country}"
                                converter="#{countryConverter}" forceSelection="true"
                                groupBy="#{autoCompleteView.getCountryGroup(country)}" escape="false" scrollHeight="250"/>
            </div>
        </div>
        
        <h5>Multiple</h5>
        <p:autoComplete id="countries" multiple="true" value="#{autoCompleteView.selectedCountries}"
                        completeMethod="#{autoCompleteView.completeCountry}"
                        var="country" itemLabel="#{country.name}" itemValue="#{country}"
                        converter="#{countryConverter}" forceSelection="true" scrollHeight="250">
            <p:column>
                <span class="flag flag-#{country.code}" style="width: 30px; height: 20px" />
                <h:outputText style="vertical-align: middle; margin-left: .5rem" value="#{country.name}"/>
            </p:column>
        </p:autoComplete>
    </h:form>
</div>