Autosuggest
An enhanced text input that provides real-time search suggestions and matching results as users type.
Summary
Use the autosuggest component to display selectable options based on typed input. As users type, it filters and displays matching suggestions directly below the input field, reducing typing effort and preventing spelling errors.
Use autosuggest for known datasets, such as locations, courses or medical conditions. It helps users select standardised values quickly and accurately.
<div
class="tel-auto-suggestion tel-auto-suggestion--page"
data-module="tel-auto-suggestion"
data-display-length="12"
>
<div class="nhsuk-form-group tel-auto-suggestion__search-wrapper">
<input
class="nhsuk-input"
id="auto-suggest-search-page-search-example"
name="search-query"
type="text"
placeholder="Search the learning hub"
autocomplete="off"
aria-autocomplete="list"
/>
</div>
<div class="tel-auto-suggestion__menu" role="region" aria-live="polite">
<div class="tel-auto-suggestion__list">
<div class="tel-auto-suggestion__item" data-filter-categories="">
<a href="/search?q=cardiovascular" class="tel-auto-suggestion__link">
<span class="tel-auto-suggestion__icon-container" aria-hidden="true">
<svg
width="16"
height="16"
viewBox="0 0 16 16"
fill="none"
xmlns="http://www.w3.org/2000/svg"
aria-hidden="true"
class="tel-auto-suggestion__svg-icon"
>
<path
fill-rule="evenodd"
clip-rule="evenodd"
d="M11.8558 10.5296L15.7218 14.3861C15.8998 14.5627 16 14.8031 16 15.0539C16 15.3047 15.8998 15.5451 15.7218 15.7218C15.5451 15.8998 15.3047 16 15.0539 16C14.8031 16 14.5627 15.8998 14.3861 15.7218L10.5296 11.8558C7.76424 13.9254 3.86973 13.5064 1.60799 10.8959C-0.653748 8.28537 -0.513826 4.37088 1.92852 1.92852C4.37088 -0.513826 8.28537 -0.653748 10.8959 1.60799C13.5064 3.86973 13.9254 7.76424 11.8558 10.5296ZM6.58834 1.88537C3.9909 1.88537 1.88525 3.99101 1.88525 6.58846C1.88525 9.1859 3.9909 11.2915 6.58834 11.2915C9.18578 11.2915 11.2914 9.1859 11.2914 6.58846C11.2914 3.99101 9.18578 1.88537 6.58834 1.88537Z"
fill="currentColor"
/>
</svg>
</span>
<span class="tel-auto-suggestion__link-text">
<span class="tel-auto-suggestion__search-text-highlight"
>cardio</span
>vascular
</span>
</a>
</div>
<div class="tel-auto-suggestion__item" data-filter-categories="">
<a href="/search?q=cardiology" class="tel-auto-suggestion__link">
<span class="tel-auto-suggestion__icon-container" aria-hidden="true">
<svg
width="16"
height="16"
viewBox="0 0 16 16"
fill="none"
xmlns="http://www.w3.org/2000/svg"
aria-hidden="true"
class="tel-auto-suggestion__svg-icon"
>
<path
fill-rule="evenodd"
clip-rule="evenodd"
d="M11.8558 10.5296L15.7218 14.3861C15.8998 14.5627 16 14.8031 16 15.0539C16 15.3047 15.8998 15.5451 15.7218 15.7218C15.5451 15.8998 15.3047 16 15.0539 16C14.8031 16 14.5627 15.8998 14.3861 15.7218L10.5296 11.8558C7.76424 13.9254 3.86973 13.5064 1.60799 10.8959C-0.653748 8.28537 -0.513826 4.37088 1.92852 1.92852C4.37088 -0.513826 8.28537 -0.653748 10.8959 1.60799C13.5064 3.86973 13.9254 7.76424 11.8558 10.5296ZM6.58834 1.88537C3.9909 1.88537 1.88525 3.99101 1.88525 6.58846C1.88525 9.1859 3.9909 11.2915 6.58834 11.2915C9.18578 11.2915 11.2914 9.1859 11.2914 6.58846C11.2914 3.99101 9.18578 1.88537 6.58834 1.88537Z"
fill="currentColor"
/>
</svg>
</span>
<span class="tel-auto-suggestion__link-text">
<span class="tel-auto-suggestion__search-text-highlight"
>cardio</span
>logy
</span>
</a>
</div>
<div class="tel-auto-suggestion__item" data-filter-categories="">
<a href="/search?q=cardiomyopathy" class="tel-auto-suggestion__link">
<span class="tel-auto-suggestion__icon-container" aria-hidden="true">
<svg
width="16"
height="16"
viewBox="0 0 16 16"
fill="none"
xmlns="http://www.w3.org/2000/svg"
aria-hidden="true"
class="tel-auto-suggestion__svg-icon"
>
<path
fill-rule="evenodd"
clip-rule="evenodd"
d="M11.8558 10.5296L15.7218 14.3861C15.8998 14.5627 16 14.8031 16 15.0539C16 15.3047 15.8998 15.5451 15.7218 15.7218C15.5451 15.8998 15.3047 16 15.0539 16C14.8031 16 14.5627 15.8998 14.3861 15.7218L10.5296 11.8558C7.76424 13.9254 3.86973 13.5064 1.60799 10.8959C-0.653748 8.28537 -0.513826 4.37088 1.92852 1.92852C4.37088 -0.513826 8.28537 -0.653748 10.8959 1.60799C13.5064 3.86973 13.9254 7.76424 11.8558 10.5296ZM6.58834 1.88537C3.9909 1.88537 1.88525 3.99101 1.88525 6.58846C1.88525 9.1859 3.9909 11.2915 6.58834 11.2915C9.18578 11.2915 11.2914 9.1859 11.2914 6.58846C11.2914 3.99101 9.18578 1.88537 6.58834 1.88537Z"
fill="currentColor"
/>
</svg>
</span>
<span class="tel-auto-suggestion__link-text">
<span class="tel-auto-suggestion__search-text-highlight"
>cardio</span
>myopathy
</span>
</a>
</div>
<div class="tel-auto-suggestion__item" data-filter-categories="">
<a href="/search?q=cardiologist" class="tel-auto-suggestion__link">
<span class="tel-auto-suggestion__icon-container" aria-hidden="true">
<svg
width="16"
height="16"
viewBox="0 0 16 16"
fill="none"
xmlns="http://www.w3.org/2000/svg"
aria-hidden="true"
class="tel-auto-suggestion__svg-icon"
>
<path
fill-rule="evenodd"
clip-rule="evenodd"
d="M11.8558 10.5296L15.7218 14.3861C15.8998 14.5627 16 14.8031 16 15.0539C16 15.3047 15.8998 15.5451 15.7218 15.7218C15.5451 15.8998 15.3047 16 15.0539 16C14.8031 16 14.5627 15.8998 14.3861 15.7218L10.5296 11.8558C7.76424 13.9254 3.86973 13.5064 1.60799 10.8959C-0.653748 8.28537 -0.513826 4.37088 1.92852 1.92852C4.37088 -0.513826 8.28537 -0.653748 10.8959 1.60799C13.5064 3.86973 13.9254 7.76424 11.8558 10.5296ZM6.58834 1.88537C3.9909 1.88537 1.88525 3.99101 1.88525 6.58846C1.88525 9.1859 3.9909 11.2915 6.58834 11.2915C9.18578 11.2915 11.2914 9.1859 11.2914 6.58846C11.2914 3.99101 9.18578 1.88537 6.58834 1.88537Z"
fill="currentColor"
/>
</svg>
</span>
<span class="tel-auto-suggestion__link-text">
<span class="tel-auto-suggestion__search-text-highlight"
>cardio</span
>logist
</span>
</a>
</div>
<div class="tel-auto-suggestion__item" data-filter-categories="">
<a href="/search?q=cardiothoracic" class="tel-auto-suggestion__link">
<span class="tel-auto-suggestion__icon-container" aria-hidden="true">
<svg
width="16"
height="16"
viewBox="0 0 16 16"
fill="none"
xmlns="http://www.w3.org/2000/svg"
aria-hidden="true"
class="tel-auto-suggestion__svg-icon"
>
<path
fill-rule="evenodd"
clip-rule="evenodd"
d="M11.8558 10.5296L15.7218 14.3861C15.8998 14.5627 16 14.8031 16 15.0539C16 15.3047 15.8998 15.5451 15.7218 15.7218C15.5451 15.8998 15.3047 16 15.0539 16C14.8031 16 14.5627 15.8998 14.3861 15.7218L10.5296 11.8558C7.76424 13.9254 3.86973 13.5064 1.60799 10.8959C-0.653748 8.28537 -0.513826 4.37088 1.92852 1.92852C4.37088 -0.513826 8.28537 -0.653748 10.8959 1.60799C13.5064 3.86973 13.9254 7.76424 11.8558 10.5296ZM6.58834 1.88537C3.9909 1.88537 1.88525 3.99101 1.88525 6.58846C1.88525 9.1859 3.9909 11.2915 6.58834 11.2915C9.18578 11.2915 11.2914 9.1859 11.2914 6.58846C11.2914 3.99101 9.18578 1.88537 6.58834 1.88537Z"
fill="currentColor"
/>
</svg>
</span>
<span class="tel-auto-suggestion__link-text">
<span class="tel-auto-suggestion__search-text-highlight"
>cardio</span
>thoracic
</span>
</a>
</div>
<div class="tel-auto-suggestion__item" data-filter-categories="resources">
<a
href="/search?q=270-reducing-cardio-vascular-risk-in-mh"
class="tel-auto-suggestion__link"
>
<span class="tel-auto-suggestion__link-text">
270 Reducing
<span class="tel-auto-suggestion__search-text-highlight"
>Cardio</span
>
Vascular Risk in MH
</span>
</a>
<div class="tel-auto-suggestion__subtext">
Type:
<span class="tel-auto-suggestion__subtext-value"
>Learning resource</span
>
</div>
</div>
<div class="tel-auto-suggestion__item" data-filter-categories="resources">
<a
href="/search?q=cardiovascular-diseases-toolkit"
class="tel-auto-suggestion__link"
>
<span class="tel-auto-suggestion__link-text">
<span class="tel-auto-suggestion__search-text-highlight"
>Cardio</span
>vascular diseases toolkit
</span>
</a>
<div class="tel-auto-suggestion__subtext">
Type:
<span class="tel-auto-suggestion__subtext-value"
>Learning resource</span
>
</div>
</div>
<div class="tel-auto-suggestion__item" data-filter-categories="resources">
<a
href="/search?q=imt-teaching-cardiology"
class="tel-auto-suggestion__link"
>
<span class="tel-auto-suggestion__link-text">
IMT Teaching -
<span class="tel-auto-suggestion__search-text-highlight"
>Cardio</span
>logy (06/05/26)
</span>
</a>
<div class="tel-auto-suggestion__subtext">
Type:
<span class="tel-auto-suggestion__subtext-value"
>Learning resource</span
>
</div>
</div>
<div class="tel-auto-suggestion__item" data-filter-categories="resources">
<a
href="/search?q=genomics-in-medical-specialties-cardiology"
class="tel-auto-suggestion__link"
>
<span class="tel-auto-suggestion__link-text">
Genomics in Medical Specialties:
<span class="tel-auto-suggestion__search-text-highlight"
>Cardio</span
>logy
</span>
</a>
<div class="tel-auto-suggestion__subtext">
Type:
<span class="tel-auto-suggestion__subtext-value"
>Learning resource</span
>
</div>
</div>
<div class="tel-auto-suggestion__item" data-filter-categories="resources">
<a
href="/search?q=genomics-in-medical-specialties-cardiology"
class="tel-auto-suggestion__link"
>
<span class="tel-auto-suggestion__link-text">
Genomics in Medical Specialties:
<span class="tel-auto-suggestion__search-text-highlight"
>Cardio</span
>logy
</span>
</a>
<div class="tel-auto-suggestion__subtext">
Type:
<span class="tel-auto-suggestion__subtext-value"
>Learning resource</span
>
</div>
</div>
</div>
</div>
</div>
Nunjucks macro options
Use options to customise the appearance, content and behaviour of a component when using a macro, for example, changing the text.
Some options are required for the macro to work; these are marked as "Required" in the option description.
If you're using Nunjucks macros in production with "html" options, or ones ending with "html", you must sanitise the HTML to protect against cross-site scripting exploits.
{% from 'tel/components/auto-suggestion/macro.njk' import telAutoSuggestion %}
{{ telAutoSuggestion({
id: "page-search-example",
input_name: "search-query",
placeholder: "Search the learning hub",
type: "page",
search_text: "cardio",
menu_items: [
{
text: "cardiovascular",
href: "/search?q=cardiovascular",
icon: "search"
},
{
text: "cardiology",
href: "/search?q=cardiology",
icon: "search"
},
{
text: "cardiomyopathy",
href: "/search?q=cardiomyopathy",
icon: "search"
},
{
text: "cardiologist",
href: "/search?q=cardiologist",
icon: "search"
},
{
text: "cardiothoracic",
href: "/search?q=cardiothoracic",
icon: "search"
},
{
text: "270 Reducing Cardio Vascular Risk in MH",
href: "/search?q=270-reducing-cardio-vascular-risk-in-mh",
type: "Learning resource",
category: "resources"
},
{
text: "Cardiovascular diseases toolkit",
href: "/search?q=cardiovascular-diseases-toolkit",
type: "Learning resource",
category: "resources"
},
{
text: "IMT Teaching - Cardiology (06/05/26)",
href: "/search?q=imt-teaching-cardiology",
type: "Learning resource",
category: "resources"
},
{
text: "Genomics in Medical Specialties: Cardiology",
href: "/search?q=genomics-in-medical-specialties-cardiology",
type: "Learning resource",
category: "resources"
},
{
text: "Genomics in Medical Specialties: Cardiology",
href: "/search?q=genomics-in-medical-specialties-cardiology",
type: "Learning resource",
category: "resources"
}
]
}) }}
This is the simplest variation of the autosuggest page pattern where suggestions are offered directly as the user types.
When to use
Use autosuggest when users need to find a specific item from a large or complex list.
It is useful when:
- the list of available choices is too long for a standard select element or radio list
- users might not know the exact spelling or precise name of what they are looking for
- standardising the entered data is important for backend processing
- speeding up input on mobile devices is beneficial
When not to use
Do not use autosuggest as a replacement for simple input controls when choices are limited.
It should not be used:
- when there are fewer than 5 to 10 options (use radio buttons or a select dropdown instead)
- for free-text inputs where suggestions could restrict or confuse the user
- when users are likely to enter unique or unpredictable text that won't match a fixed list
- during high-speed, minimal-interaction entry where predictive popups distract from completion
How it works
The autosuggest component overlays dynamic matching results directly beneath the text input field as the user types.
The component supports:
- matching query strings against display titles, synonyms, or codes
- keyboard navigation (using Up or Down arrow keys and Enter to select)
- status text announcement for screen readers (for example, "5 results available")
- an optional conditional reveal panel for user input when an item is not found
On smaller screens, the suggestion list scales to fit the viewport width to maintain touch target sizing.
Configuration
Common properties
id(string, required) : Unique HTML identifier for the input elementinput_name(string, required) : Name attribute applied to the input fieldtype(string, required) :"page","radio"or"checkbox"placeholder(string) : Input field placeholder textsearch_text(string) : Load component with pre-determined search stringmenu_items(array) : Array of suggestion items rendered by the component
Suggestion menu item properties (menu_items)
text(string, required) : Item texthref(string) : Destination URL when the item is selected (used in page patterns)type(string) : Item subtext displayed below main textvalue(string) : Radio button or checkbox submitted form valuecategory(string) : Category identifier associated with quick filtershint(string) : Secondary text below radio or checkbox itemsicon(string) : Set to"search"for magnifying glass indicating search completion rather than link
Page search properties
show_search_button(boolean) : Determines whether search button is displayed next to the input field; defaults tofalseshow_filters(boolean) : Toggles quick-filters integration; defaults tofalsefilters(object) : Configuration object for quick-filters tags:heading(string) : Heading text preceding the filter buttonsshowAll(boolean) : Enables an "All" filter toggle optionallLabel(string) : Display text for the "All" filter option (for example"All")activeTags(array) : Array of currently active filter tag value strings (for example["all"])tags(array) : List of filter tag objects:label(string) : Visible display label for the filter tagvalue(string) : Value used to filter menu items
Radio button and checkbox properties
show_other(boolean) : Enables a fallback option for users to manually enter an unlisted choiceother_text(string) : Hint text displayed between main list and other list itemother_buttontext(string) : Radio button display text; defaults to"Other"other_label(string) : Label text for the other text inputselected_items(array) : Array of pre-selected values when rendering radio or checkbox options
Pagination properties
pagination(boolean) : Determines whether pagination controls are rendered below the results; defaults tofalsepagination_previous_url(string) : Target URL for the "Previous" page linkpagination_previous_page(string) : Accessible label or link text for the "Previous" page controlpagination_next_url(string) : Target URL for the "Next" page linkpagination_next_page(string) : Accessible label or link text for the "Next" page controlpagination_items(array) : Array of page number objects and truncators:number(number) : Page number valuehref(string) : Target URL for the specific page linkcurrent(boolean) : Set totrueto highlight the current active pageellipsis(boolean) : Set totrueto render a pagination ellipsis (...) visual separator
Examples, variants and states including code and design assets
Below are the framework-specific macros and design file paths for the respective variations.
Page patterns with search
Default page pattern
<div
class="tel-auto-suggestion tel-auto-suggestion--page"
data-module="tel-auto-suggestion"
data-display-length="12"
>
<div class="nhsuk-form-group tel-auto-suggestion__search-wrapper">
<input
class="nhsuk-input"
id="auto-suggest-search-page-search-example"
name="search-query"
type="text"
placeholder="Search the learning hub"
autocomplete="off"
aria-autocomplete="list"
/>
</div>
<div class="tel-auto-suggestion__menu" role="region" aria-live="polite">
<div class="tel-auto-suggestion__list">
<div class="tel-auto-suggestion__item" data-filter-categories="">
<a href="/search?q=cardiovascular" class="tel-auto-suggestion__link">
<span class="tel-auto-suggestion__icon-container" aria-hidden="true">
<svg
width="16"
height="16"
viewBox="0 0 16 16"
fill="none"
xmlns="http://www.w3.org/2000/svg"
aria-hidden="true"
class="tel-auto-suggestion__svg-icon"
>
<path
fill-rule="evenodd"
clip-rule="evenodd"
d="M11.8558 10.5296L15.7218 14.3861C15.8998 14.5627 16 14.8031 16 15.0539C16 15.3047 15.8998 15.5451 15.7218 15.7218C15.5451 15.8998 15.3047 16 15.0539 16C14.8031 16 14.5627 15.8998 14.3861 15.7218L10.5296 11.8558C7.76424 13.9254 3.86973 13.5064 1.60799 10.8959C-0.653748 8.28537 -0.513826 4.37088 1.92852 1.92852C4.37088 -0.513826 8.28537 -0.653748 10.8959 1.60799C13.5064 3.86973 13.9254 7.76424 11.8558 10.5296ZM6.58834 1.88537C3.9909 1.88537 1.88525 3.99101 1.88525 6.58846C1.88525 9.1859 3.9909 11.2915 6.58834 11.2915C9.18578 11.2915 11.2914 9.1859 11.2914 6.58846C11.2914 3.99101 9.18578 1.88537 6.58834 1.88537Z"
fill="currentColor"
/>
</svg>
</span>
<span class="tel-auto-suggestion__link-text">
<span class="tel-auto-suggestion__search-text-highlight"
>cardio</span
>vascular
</span>
</a>
</div>
<div class="tel-auto-suggestion__item" data-filter-categories="">
<a href="/search?q=cardiology" class="tel-auto-suggestion__link">
<span class="tel-auto-suggestion__icon-container" aria-hidden="true">
<svg
width="16"
height="16"
viewBox="0 0 16 16"
fill="none"
xmlns="http://www.w3.org/2000/svg"
aria-hidden="true"
class="tel-auto-suggestion__svg-icon"
>
<path
fill-rule="evenodd"
clip-rule="evenodd"
d="M11.8558 10.5296L15.7218 14.3861C15.8998 14.5627 16 14.8031 16 15.0539C16 15.3047 15.8998 15.5451 15.7218 15.7218C15.5451 15.8998 15.3047 16 15.0539 16C14.8031 16 14.5627 15.8998 14.3861 15.7218L10.5296 11.8558C7.76424 13.9254 3.86973 13.5064 1.60799 10.8959C-0.653748 8.28537 -0.513826 4.37088 1.92852 1.92852C4.37088 -0.513826 8.28537 -0.653748 10.8959 1.60799C13.5064 3.86973 13.9254 7.76424 11.8558 10.5296ZM6.58834 1.88537C3.9909 1.88537 1.88525 3.99101 1.88525 6.58846C1.88525 9.1859 3.9909 11.2915 6.58834 11.2915C9.18578 11.2915 11.2914 9.1859 11.2914 6.58846C11.2914 3.99101 9.18578 1.88537 6.58834 1.88537Z"
fill="currentColor"
/>
</svg>
</span>
<span class="tel-auto-suggestion__link-text">
<span class="tel-auto-suggestion__search-text-highlight"
>cardio</span
>logy
</span>
</a>
</div>
<div class="tel-auto-suggestion__item" data-filter-categories="">
<a href="/search?q=cardiomyopathy" class="tel-auto-suggestion__link">
<span class="tel-auto-suggestion__icon-container" aria-hidden="true">
<svg
width="16"
height="16"
viewBox="0 0 16 16"
fill="none"
xmlns="http://www.w3.org/2000/svg"
aria-hidden="true"
class="tel-auto-suggestion__svg-icon"
>
<path
fill-rule="evenodd"
clip-rule="evenodd"
d="M11.8558 10.5296L15.7218 14.3861C15.8998 14.5627 16 14.8031 16 15.0539C16 15.3047 15.8998 15.5451 15.7218 15.7218C15.5451 15.8998 15.3047 16 15.0539 16C14.8031 16 14.5627 15.8998 14.3861 15.7218L10.5296 11.8558C7.76424 13.9254 3.86973 13.5064 1.60799 10.8959C-0.653748 8.28537 -0.513826 4.37088 1.92852 1.92852C4.37088 -0.513826 8.28537 -0.653748 10.8959 1.60799C13.5064 3.86973 13.9254 7.76424 11.8558 10.5296ZM6.58834 1.88537C3.9909 1.88537 1.88525 3.99101 1.88525 6.58846C1.88525 9.1859 3.9909 11.2915 6.58834 11.2915C9.18578 11.2915 11.2914 9.1859 11.2914 6.58846C11.2914 3.99101 9.18578 1.88537 6.58834 1.88537Z"
fill="currentColor"
/>
</svg>
</span>
<span class="tel-auto-suggestion__link-text">
<span class="tel-auto-suggestion__search-text-highlight"
>cardio</span
>myopathy
</span>
</a>
</div>
<div class="tel-auto-suggestion__item" data-filter-categories="">
<a href="/search?q=cardiologist" class="tel-auto-suggestion__link">
<span class="tel-auto-suggestion__icon-container" aria-hidden="true">
<svg
width="16"
height="16"
viewBox="0 0 16 16"
fill="none"
xmlns="http://www.w3.org/2000/svg"
aria-hidden="true"
class="tel-auto-suggestion__svg-icon"
>
<path
fill-rule="evenodd"
clip-rule="evenodd"
d="M11.8558 10.5296L15.7218 14.3861C15.8998 14.5627 16 14.8031 16 15.0539C16 15.3047 15.8998 15.5451 15.7218 15.7218C15.5451 15.8998 15.3047 16 15.0539 16C14.8031 16 14.5627 15.8998 14.3861 15.7218L10.5296 11.8558C7.76424 13.9254 3.86973 13.5064 1.60799 10.8959C-0.653748 8.28537 -0.513826 4.37088 1.92852 1.92852C4.37088 -0.513826 8.28537 -0.653748 10.8959 1.60799C13.5064 3.86973 13.9254 7.76424 11.8558 10.5296ZM6.58834 1.88537C3.9909 1.88537 1.88525 3.99101 1.88525 6.58846C1.88525 9.1859 3.9909 11.2915 6.58834 11.2915C9.18578 11.2915 11.2914 9.1859 11.2914 6.58846C11.2914 3.99101 9.18578 1.88537 6.58834 1.88537Z"
fill="currentColor"
/>
</svg>
</span>
<span class="tel-auto-suggestion__link-text">
<span class="tel-auto-suggestion__search-text-highlight"
>cardio</span
>logist
</span>
</a>
</div>
<div class="tel-auto-suggestion__item" data-filter-categories="">
<a href="/search?q=cardiothoracic" class="tel-auto-suggestion__link">
<span class="tel-auto-suggestion__icon-container" aria-hidden="true">
<svg
width="16"
height="16"
viewBox="0 0 16 16"
fill="none"
xmlns="http://www.w3.org/2000/svg"
aria-hidden="true"
class="tel-auto-suggestion__svg-icon"
>
<path
fill-rule="evenodd"
clip-rule="evenodd"
d="M11.8558 10.5296L15.7218 14.3861C15.8998 14.5627 16 14.8031 16 15.0539C16 15.3047 15.8998 15.5451 15.7218 15.7218C15.5451 15.8998 15.3047 16 15.0539 16C14.8031 16 14.5627 15.8998 14.3861 15.7218L10.5296 11.8558C7.76424 13.9254 3.86973 13.5064 1.60799 10.8959C-0.653748 8.28537 -0.513826 4.37088 1.92852 1.92852C4.37088 -0.513826 8.28537 -0.653748 10.8959 1.60799C13.5064 3.86973 13.9254 7.76424 11.8558 10.5296ZM6.58834 1.88537C3.9909 1.88537 1.88525 3.99101 1.88525 6.58846C1.88525 9.1859 3.9909 11.2915 6.58834 11.2915C9.18578 11.2915 11.2914 9.1859 11.2914 6.58846C11.2914 3.99101 9.18578 1.88537 6.58834 1.88537Z"
fill="currentColor"
/>
</svg>
</span>
<span class="tel-auto-suggestion__link-text">
<span class="tel-auto-suggestion__search-text-highlight"
>cardio</span
>thoracic
</span>
</a>
</div>
<div class="tel-auto-suggestion__item" data-filter-categories="resources">
<a
href="/search?q=270-reducing-cardio-vascular-risk-in-mh"
class="tel-auto-suggestion__link"
>
<span class="tel-auto-suggestion__link-text">
270 Reducing
<span class="tel-auto-suggestion__search-text-highlight"
>Cardio</span
>
Vascular Risk in MH
</span>
</a>
<div class="tel-auto-suggestion__subtext">
Type:
<span class="tel-auto-suggestion__subtext-value"
>Learning resource</span
>
</div>
</div>
<div class="tel-auto-suggestion__item" data-filter-categories="resources">
<a
href="/search?q=cardiovascular-diseases-toolkit"
class="tel-auto-suggestion__link"
>
<span class="tel-auto-suggestion__link-text">
<span class="tel-auto-suggestion__search-text-highlight"
>Cardio</span
>vascular diseases toolkit
</span>
</a>
<div class="tel-auto-suggestion__subtext">
Type:
<span class="tel-auto-suggestion__subtext-value"
>Learning resource</span
>
</div>
</div>
<div class="tel-auto-suggestion__item" data-filter-categories="resources">
<a
href="/search?q=imt-teaching-cardiology"
class="tel-auto-suggestion__link"
>
<span class="tel-auto-suggestion__link-text">
IMT Teaching -
<span class="tel-auto-suggestion__search-text-highlight"
>Cardio</span
>logy (06/05/26)
</span>
</a>
<div class="tel-auto-suggestion__subtext">
Type:
<span class="tel-auto-suggestion__subtext-value"
>Learning resource</span
>
</div>
</div>
<div class="tel-auto-suggestion__item" data-filter-categories="resources">
<a
href="/search?q=genomics-in-medical-specialties-cardiology"
class="tel-auto-suggestion__link"
>
<span class="tel-auto-suggestion__link-text">
Genomics in Medical Specialties:
<span class="tel-auto-suggestion__search-text-highlight"
>Cardio</span
>logy
</span>
</a>
<div class="tel-auto-suggestion__subtext">
Type:
<span class="tel-auto-suggestion__subtext-value"
>Learning resource</span
>
</div>
</div>
<div class="tel-auto-suggestion__item" data-filter-categories="resources">
<a
href="/search?q=genomics-in-medical-specialties-cardiology"
class="tel-auto-suggestion__link"
>
<span class="tel-auto-suggestion__link-text">
Genomics in Medical Specialties:
<span class="tel-auto-suggestion__search-text-highlight"
>Cardio</span
>logy
</span>
</a>
<div class="tel-auto-suggestion__subtext">
Type:
<span class="tel-auto-suggestion__subtext-value"
>Learning resource</span
>
</div>
</div>
</div>
</div>
</div>
Nunjucks macro options
Use options to customise the appearance, content and behaviour of a component when using a macro, for example, changing the text.
Some options are required for the macro to work; these are marked as "Required" in the option description.
If you're using Nunjucks macros in production with "html" options, or ones ending with "html", you must sanitise the HTML to protect against cross-site scripting exploits.
{% from 'tel/components/auto-suggestion/macro.njk' import telAutoSuggestion %}
{{ telAutoSuggestion({
id: "page-search-example",
input_name: "search-query",
placeholder: "Search the learning hub",
type: "page",
search_text: "cardio",
menu_items: [
{
text: "cardiovascular",
href: "/search?q=cardiovascular",
icon: "search"
},
{
text: "cardiology",
href: "/search?q=cardiology",
icon: "search"
},
{
text: "cardiomyopathy",
href: "/search?q=cardiomyopathy",
icon: "search"
},
{
text: "cardiologist",
href: "/search?q=cardiologist",
icon: "search"
},
{
text: "cardiothoracic",
href: "/search?q=cardiothoracic",
icon: "search"
},
{
text: "270 Reducing Cardio Vascular Risk in MH",
href: "/search?q=270-reducing-cardio-vascular-risk-in-mh",
type: "Learning resource",
category: "resources"
},
{
text: "Cardiovascular diseases toolkit",
href: "/search?q=cardiovascular-diseases-toolkit",
type: "Learning resource",
category: "resources"
},
{
text: "IMT Teaching - Cardiology (06/05/26)",
href: "/search?q=imt-teaching-cardiology",
type: "Learning resource",
category: "resources"
},
{
text: "Genomics in Medical Specialties: Cardiology",
href: "/search?q=genomics-in-medical-specialties-cardiology",
type: "Learning resource",
category: "resources"
},
{
text: "Genomics in Medical Specialties: Cardiology",
href: "/search?q=genomics-in-medical-specialties-cardiology",
type: "Learning resource",
category: "resources"
}
]
}) }}
Use this variation for standard page layouts where users select a suggestion directly from the input without needing an explicit search submit button.
Page pattern with search button
<div
class="tel-auto-suggestion tel-auto-suggestion--page"
data-module="tel-auto-suggestion"
data-display-length="12"
>
<div
class="nhsuk-form-group tel-auto-suggestion__search-wrapper tel-auto-suggestion__search-wrapper--has-button"
>
<input
class="nhsuk-input"
id="auto-suggest-search-page-search-example"
name="search-query"
type="text"
placeholder="Search the learning hub"
autocomplete="off"
aria-autocomplete="list"
/>
<button type="button" class="nhsuk-button tel-auto-suggestion__search-btn">
<span class="nhsuk-u-visually-hidden">Search</span>
<svg
width="20"
height="20"
viewBox="0 0 20 20"
fill="none"
xmlns="http://www.w3.org/2000/svg"
aria-hidden="true"
class="tel-auto-suggestion__svg-icon"
>
<path
fill-rule="evenodd"
clip-rule="evenodd"
d="M11.8558 10.5296L15.7218 14.3861C15.8998 14.5627 16 14.8031 16 15.0539C16 15.3047 15.8998 15.5451 15.7218 15.7218C15.5451 15.8998 15.3047 16 15.0539 16C14.8031 16 14.5627 15.8998 14.3861 15.7218L10.5296 11.8558C7.76424 13.9254 3.86973 13.5064 1.60799 10.8959C-0.653748 8.28537 -0.513826 4.37088 1.92852 1.92852C4.37088 -0.513826 8.28537 -0.653748 10.8959 1.60799C13.5064 3.86973 13.9254 7.76424 11.8558 10.5296ZM6.58834 1.88537C3.9909 1.88537 1.88525 3.99101 1.88525 6.58846C1.88525 9.1859 3.9909 11.2915 6.58834 11.2915C9.18578 11.2915 11.2914 9.1859 11.2914 6.58846C11.2914 3.99101 9.18578 1.88537 6.58834 1.88537Z"
fill="currentColor"
/>
</svg>
</button>
</div>
<div class="tel-auto-suggestion__menu" role="region" aria-live="polite">
<div class="tel-auto-suggestion__list">
<div class="tel-auto-suggestion__item" data-filter-categories="">
<a href="/search?q=cardiovascular" class="tel-auto-suggestion__link">
<span class="tel-auto-suggestion__icon-container" aria-hidden="true">
<svg
width="16"
height="16"
viewBox="0 0 16 16"
fill="none"
xmlns="http://www.w3.org/2000/svg"
aria-hidden="true"
class="tel-auto-suggestion__svg-icon"
>
<path
fill-rule="evenodd"
clip-rule="evenodd"
d="M11.8558 10.5296L15.7218 14.3861C15.8998 14.5627 16 14.8031 16 15.0539C16 15.3047 15.8998 15.5451 15.7218 15.7218C15.5451 15.8998 15.3047 16 15.0539 16C14.8031 16 14.5627 15.8998 14.3861 15.7218L10.5296 11.8558C7.76424 13.9254 3.86973 13.5064 1.60799 10.8959C-0.653748 8.28537 -0.513826 4.37088 1.92852 1.92852C4.37088 -0.513826 8.28537 -0.653748 10.8959 1.60799C13.5064 3.86973 13.9254 7.76424 11.8558 10.5296ZM6.58834 1.88537C3.9909 1.88537 1.88525 3.99101 1.88525 6.58846C1.88525 9.1859 3.9909 11.2915 6.58834 11.2915C9.18578 11.2915 11.2914 9.1859 11.2914 6.58846C11.2914 3.99101 9.18578 1.88537 6.58834 1.88537Z"
fill="currentColor"
/>
</svg>
</span>
<span class="tel-auto-suggestion__link-text">
<span class="tel-auto-suggestion__search-text-highlight"
>cardio</span
>vascular
</span>
</a>
</div>
<div class="tel-auto-suggestion__item" data-filter-categories="">
<a href="/search?q=cardiology" class="tel-auto-suggestion__link">
<span class="tel-auto-suggestion__icon-container" aria-hidden="true">
<svg
width="16"
height="16"
viewBox="0 0 16 16"
fill="none"
xmlns="http://www.w3.org/2000/svg"
aria-hidden="true"
class="tel-auto-suggestion__svg-icon"
>
<path
fill-rule="evenodd"
clip-rule="evenodd"
d="M11.8558 10.5296L15.7218 14.3861C15.8998 14.5627 16 14.8031 16 15.0539C16 15.3047 15.8998 15.5451 15.7218 15.7218C15.5451 15.8998 15.3047 16 15.0539 16C14.8031 16 14.5627 15.8998 14.3861 15.7218L10.5296 11.8558C7.76424 13.9254 3.86973 13.5064 1.60799 10.8959C-0.653748 8.28537 -0.513826 4.37088 1.92852 1.92852C4.37088 -0.513826 8.28537 -0.653748 10.8959 1.60799C13.5064 3.86973 13.9254 7.76424 11.8558 10.5296ZM6.58834 1.88537C3.9909 1.88537 1.88525 3.99101 1.88525 6.58846C1.88525 9.1859 3.9909 11.2915 6.58834 11.2915C9.18578 11.2915 11.2914 9.1859 11.2914 6.58846C11.2914 3.99101 9.18578 1.88537 6.58834 1.88537Z"
fill="currentColor"
/>
</svg>
</span>
<span class="tel-auto-suggestion__link-text">
<span class="tel-auto-suggestion__search-text-highlight"
>cardio</span
>logy
</span>
</a>
</div>
<div class="tel-auto-suggestion__item" data-filter-categories="">
<a href="/search?q=cardiomyopathy" class="tel-auto-suggestion__link">
<span class="tel-auto-suggestion__icon-container" aria-hidden="true">
<svg
width="16"
height="16"
viewBox="0 0 16 16"
fill="none"
xmlns="http://www.w3.org/2000/svg"
aria-hidden="true"
class="tel-auto-suggestion__svg-icon"
>
<path
fill-rule="evenodd"
clip-rule="evenodd"
d="M11.8558 10.5296L15.7218 14.3861C15.8998 14.5627 16 14.8031 16 15.0539C16 15.3047 15.8998 15.5451 15.7218 15.7218C15.5451 15.8998 15.3047 16 15.0539 16C14.8031 16 14.5627 15.8998 14.3861 15.7218L10.5296 11.8558C7.76424 13.9254 3.86973 13.5064 1.60799 10.8959C-0.653748 8.28537 -0.513826 4.37088 1.92852 1.92852C4.37088 -0.513826 8.28537 -0.653748 10.8959 1.60799C13.5064 3.86973 13.9254 7.76424 11.8558 10.5296ZM6.58834 1.88537C3.9909 1.88537 1.88525 3.99101 1.88525 6.58846C1.88525 9.1859 3.9909 11.2915 6.58834 11.2915C9.18578 11.2915 11.2914 9.1859 11.2914 6.58846C11.2914 3.99101 9.18578 1.88537 6.58834 1.88537Z"
fill="currentColor"
/>
</svg>
</span>
<span class="tel-auto-suggestion__link-text">
<span class="tel-auto-suggestion__search-text-highlight"
>cardio</span
>myopathy
</span>
</a>
</div>
<div class="tel-auto-suggestion__item" data-filter-categories="">
<a href="/search?q=cardiologist" class="tel-auto-suggestion__link">
<span class="tel-auto-suggestion__icon-container" aria-hidden="true">
<svg
width="16"
height="16"
viewBox="0 0 16 16"
fill="none"
xmlns="http://www.w3.org/2000/svg"
aria-hidden="true"
class="tel-auto-suggestion__svg-icon"
>
<path
fill-rule="evenodd"
clip-rule="evenodd"
d="M11.8558 10.5296L15.7218 14.3861C15.8998 14.5627 16 14.8031 16 15.0539C16 15.3047 15.8998 15.5451 15.7218 15.7218C15.5451 15.8998 15.3047 16 15.0539 16C14.8031 16 14.5627 15.8998 14.3861 15.7218L10.5296 11.8558C7.76424 13.9254 3.86973 13.5064 1.60799 10.8959C-0.653748 8.28537 -0.513826 4.37088 1.92852 1.92852C4.37088 -0.513826 8.28537 -0.653748 10.8959 1.60799C13.5064 3.86973 13.9254 7.76424 11.8558 10.5296ZM6.58834 1.88537C3.9909 1.88537 1.88525 3.99101 1.88525 6.58846C1.88525 9.1859 3.9909 11.2915 6.58834 11.2915C9.18578 11.2915 11.2914 9.1859 11.2914 6.58846C11.2914 3.99101 9.18578 1.88537 6.58834 1.88537Z"
fill="currentColor"
/>
</svg>
</span>
<span class="tel-auto-suggestion__link-text">
<span class="tel-auto-suggestion__search-text-highlight"
>cardio</span
>logist
</span>
</a>
</div>
<div class="tel-auto-suggestion__item" data-filter-categories="">
<a href="/search?q=cardiothoracic" class="tel-auto-suggestion__link">
<span class="tel-auto-suggestion__icon-container" aria-hidden="true">
<svg
width="16"
height="16"
viewBox="0 0 16 16"
fill="none"
xmlns="http://www.w3.org/2000/svg"
aria-hidden="true"
class="tel-auto-suggestion__svg-icon"
>
<path
fill-rule="evenodd"
clip-rule="evenodd"
d="M11.8558 10.5296L15.7218 14.3861C15.8998 14.5627 16 14.8031 16 15.0539C16 15.3047 15.8998 15.5451 15.7218 15.7218C15.5451 15.8998 15.3047 16 15.0539 16C14.8031 16 14.5627 15.8998 14.3861 15.7218L10.5296 11.8558C7.76424 13.9254 3.86973 13.5064 1.60799 10.8959C-0.653748 8.28537 -0.513826 4.37088 1.92852 1.92852C4.37088 -0.513826 8.28537 -0.653748 10.8959 1.60799C13.5064 3.86973 13.9254 7.76424 11.8558 10.5296ZM6.58834 1.88537C3.9909 1.88537 1.88525 3.99101 1.88525 6.58846C1.88525 9.1859 3.9909 11.2915 6.58834 11.2915C9.18578 11.2915 11.2914 9.1859 11.2914 6.58846C11.2914 3.99101 9.18578 1.88537 6.58834 1.88537Z"
fill="currentColor"
/>
</svg>
</span>
<span class="tel-auto-suggestion__link-text">
<span class="tel-auto-suggestion__search-text-highlight"
>cardio</span
>thoracic
</span>
</a>
</div>
<div class="tel-auto-suggestion__item" data-filter-categories="resources">
<a
href="/search?q=270-reducing-cardio-vascular-risk-in-mh"
class="tel-auto-suggestion__link"
>
<span class="tel-auto-suggestion__link-text">
270 Reducing
<span class="tel-auto-suggestion__search-text-highlight"
>Cardio</span
>
Vascular Risk in MH
</span>
</a>
<div class="tel-auto-suggestion__subtext">
Type:
<span class="tel-auto-suggestion__subtext-value"
>Learning resource</span
>
</div>
</div>
<div class="tel-auto-suggestion__item" data-filter-categories="resources">
<a
href="/search?q=cardiovascular-diseases-toolkit"
class="tel-auto-suggestion__link"
>
<span class="tel-auto-suggestion__link-text">
<span class="tel-auto-suggestion__search-text-highlight"
>Cardio</span
>vascular diseases toolkit
</span>
</a>
<div class="tel-auto-suggestion__subtext">
Type:
<span class="tel-auto-suggestion__subtext-value"
>Learning resource</span
>
</div>
</div>
<div class="tel-auto-suggestion__item" data-filter-categories="resources">
<a
href="/search?q=imt-teaching-cardiology"
class="tel-auto-suggestion__link"
>
<span class="tel-auto-suggestion__link-text">
IMT Teaching -
<span class="tel-auto-suggestion__search-text-highlight"
>Cardio</span
>logy (06/05/26)
</span>
</a>
<div class="tel-auto-suggestion__subtext">
Type:
<span class="tel-auto-suggestion__subtext-value"
>Learning resource</span
>
</div>
</div>
<div class="tel-auto-suggestion__item" data-filter-categories="resources">
<a
href="/search?q=genomics-in-medical-specialties-cardiology"
class="tel-auto-suggestion__link"
>
<span class="tel-auto-suggestion__link-text">
Genomics in Medical Specialties:
<span class="tel-auto-suggestion__search-text-highlight"
>Cardio</span
>logy
</span>
</a>
<div class="tel-auto-suggestion__subtext">
Type:
<span class="tel-auto-suggestion__subtext-value"
>Learning resource</span
>
</div>
</div>
<div class="tel-auto-suggestion__item" data-filter-categories="resources">
<a
href="/search?q=genomics-in-medical-specialties-cardiology"
class="tel-auto-suggestion__link"
>
<span class="tel-auto-suggestion__link-text">
Genomics in Medical Specialties:
<span class="tel-auto-suggestion__search-text-highlight"
>Cardio</span
>logy
</span>
</a>
<div class="tel-auto-suggestion__subtext">
Type:
<span class="tel-auto-suggestion__subtext-value"
>Learning resource</span
>
</div>
</div>
</div>
</div>
</div>
Nunjucks macro options
Use options to customise the appearance, content and behaviour of a component when using a macro, for example, changing the text.
Some options are required for the macro to work; these are marked as "Required" in the option description.
If you're using Nunjucks macros in production with "html" options, or ones ending with "html", you must sanitise the HTML to protect against cross-site scripting exploits.
{% from 'tel/components/auto-suggestion/macro.njk' import telAutoSuggestion %}
{{ telAutoSuggestion({
id: "page-search-example",
input_name: "search-query",
placeholder: "Search the learning hub",
type: "page",
search_text: "cardio",
show_search_button: true,
menu_items: [
{
text: "cardiovascular",
href: "/search?q=cardiovascular",
icon: "search"
},
{
text: "cardiology",
href: "/search?q=cardiology",
icon: "search"
},
{
text: "cardiomyopathy",
href: "/search?q=cardiomyopathy",
icon: "search"
},
{
text: "cardiologist",
href: "/search?q=cardiologist",
icon: "search"
},
{
text: "cardiothoracic",
href: "/search?q=cardiothoracic",
icon: "search"
},
{
text: "270 Reducing Cardio Vascular Risk in MH",
href: "/search?q=270-reducing-cardio-vascular-risk-in-mh",
type: "Learning resource",
category: "resources"
},
{
text: "Cardiovascular diseases toolkit",
href: "/search?q=cardiovascular-diseases-toolkit",
type: "Learning resource",
category: "resources"
},
{
text: "IMT Teaching - Cardiology (06/05/26)",
href: "/search?q=imt-teaching-cardiology",
type: "Learning resource",
category: "resources"
},
{
text: "Genomics in Medical Specialties: Cardiology",
href: "/search?q=genomics-in-medical-specialties-cardiology",
type: "Learning resource",
category: "resources"
},
{
text: "Genomics in Medical Specialties: Cardiology",
href: "/search?q=genomics-in-medical-specialties-cardiology",
type: "Learning resource",
category: "resources"
}
]
}) }}
Use this variation when the autosuggest input sits within an explicit search form. The search button allows users to submit a query manually if they choose not to select a suggested item or want to view full search results on a dedicated page.
Page pattern with search button and filters
<div
class="tel-auto-suggestion tel-auto-suggestion--page"
data-module="tel-auto-suggestion"
data-display-length="12"
>
<div
class="nhsuk-form-group tel-auto-suggestion__search-wrapper tel-auto-suggestion__search-wrapper--has-button"
>
<input
class="nhsuk-input"
id="auto-suggest-search-page-search-example"
name="search-query"
type="text"
placeholder="Search the learning hub"
autocomplete="off"
aria-autocomplete="list"
/>
<button type="button" class="nhsuk-button tel-auto-suggestion__search-btn">
<span class="nhsuk-u-visually-hidden">Search</span>
<svg
width="20"
height="20"
viewBox="0 0 20 20"
fill="none"
xmlns="http://www.w3.org/2000/svg"
aria-hidden="true"
class="tel-auto-suggestion__svg-icon"
>
<path
fill-rule="evenodd"
clip-rule="evenodd"
d="M11.8558 10.5296L15.7218 14.3861C15.8998 14.5627 16 14.8031 16 15.0539C16 15.3047 15.8998 15.5451 15.7218 15.7218C15.5451 15.8998 15.3047 16 15.0539 16C14.8031 16 14.5627 15.8998 14.3861 15.7218L10.5296 11.8558C7.76424 13.9254 3.86973 13.5064 1.60799 10.8959C-0.653748 8.28537 -0.513826 4.37088 1.92852 1.92852C4.37088 -0.513826 8.28537 -0.653748 10.8959 1.60799C13.5064 3.86973 13.9254 7.76424 11.8558 10.5296ZM6.58834 1.88537C3.9909 1.88537 1.88525 3.99101 1.88525 6.58846C1.88525 9.1859 3.9909 11.2915 6.58834 11.2915C9.18578 11.2915 11.2914 9.1859 11.2914 6.58846C11.2914 3.99101 9.18578 1.88537 6.58834 1.88537Z"
fill="currentColor"
/>
</svg>
</button>
</div>
<div class="tel-auto-suggestion__filters-container">
<nav
class="tel-quick-filters"
data-component="tel-quick-filters"
data-module="tel-quick-filters"
>
<ul class="tel-quick-filters__list" role="list">
<span class="tel-quick-filters__list-heading">Show</span>
<li class="tel-quick-filters__list-item">
<a
href="#"
class="tel-quick-filters__button tel-quick-filters__button--active"
role="button"
aria-pressed="true"
data-filter-value="all"
>
<span>All</span>
</a>
</li>
<li class="tel-quick-filters__list-item">
<a
href="#"
class="tel-quick-filters__button"
role="button"
aria-pressed="false"
data-filter-value="catalogues"
>
<span>Catalogues</span>
</a>
</li>
<li class="tel-quick-filters__list-item">
<a
href="#"
class="tel-quick-filters__button"
role="button"
aria-pressed="false"
data-filter-value="courses"
>
<span>Courses</span>
</a>
</li>
<li class="tel-quick-filters__list-item">
<a
href="#"
class="tel-quick-filters__button"
role="button"
aria-pressed="false"
data-filter-value="resources"
>
<span>Resources</span>
</a>
</li>
</ul>
</nav>
</div>
<div class="tel-auto-suggestion__menu" role="region" aria-live="polite">
<div class="tel-auto-suggestion__list">
<div class="tel-auto-suggestion__item" data-filter-categories="">
<a href="/search?q=cardiovascular" class="tel-auto-suggestion__link">
<span class="tel-auto-suggestion__icon-container" aria-hidden="true">
<svg
width="16"
height="16"
viewBox="0 0 16 16"
fill="none"
xmlns="http://www.w3.org/2000/svg"
aria-hidden="true"
class="tel-auto-suggestion__svg-icon"
>
<path
fill-rule="evenodd"
clip-rule="evenodd"
d="M11.8558 10.5296L15.7218 14.3861C15.8998 14.5627 16 14.8031 16 15.0539C16 15.3047 15.8998 15.5451 15.7218 15.7218C15.5451 15.8998 15.3047 16 15.0539 16C14.8031 16 14.5627 15.8998 14.3861 15.7218L10.5296 11.8558C7.76424 13.9254 3.86973 13.5064 1.60799 10.8959C-0.653748 8.28537 -0.513826 4.37088 1.92852 1.92852C4.37088 -0.513826 8.28537 -0.653748 10.8959 1.60799C13.5064 3.86973 13.9254 7.76424 11.8558 10.5296ZM6.58834 1.88537C3.9909 1.88537 1.88525 3.99101 1.88525 6.58846C1.88525 9.1859 3.9909 11.2915 6.58834 11.2915C9.18578 11.2915 11.2914 9.1859 11.2914 6.58846C11.2914 3.99101 9.18578 1.88537 6.58834 1.88537Z"
fill="currentColor"
/>
</svg>
</span>
<span class="tel-auto-suggestion__link-text">
<span class="tel-auto-suggestion__search-text-highlight"
>cardio</span
>vascular
</span>
</a>
</div>
<div class="tel-auto-suggestion__item" data-filter-categories="">
<a href="/search?q=cardiology" class="tel-auto-suggestion__link">
<span class="tel-auto-suggestion__icon-container" aria-hidden="true">
<svg
width="16"
height="16"
viewBox="0 0 16 16"
fill="none"
xmlns="http://www.w3.org/2000/svg"
aria-hidden="true"
class="tel-auto-suggestion__svg-icon"
>
<path
fill-rule="evenodd"
clip-rule="evenodd"
d="M11.8558 10.5296L15.7218 14.3861C15.8998 14.5627 16 14.8031 16 15.0539C16 15.3047 15.8998 15.5451 15.7218 15.7218C15.5451 15.8998 15.3047 16 15.0539 16C14.8031 16 14.5627 15.8998 14.3861 15.7218L10.5296 11.8558C7.76424 13.9254 3.86973 13.5064 1.60799 10.8959C-0.653748 8.28537 -0.513826 4.37088 1.92852 1.92852C4.37088 -0.513826 8.28537 -0.653748 10.8959 1.60799C13.5064 3.86973 13.9254 7.76424 11.8558 10.5296ZM6.58834 1.88537C3.9909 1.88537 1.88525 3.99101 1.88525 6.58846C1.88525 9.1859 3.9909 11.2915 6.58834 11.2915C9.18578 11.2915 11.2914 9.1859 11.2914 6.58846C11.2914 3.99101 9.18578 1.88537 6.58834 1.88537Z"
fill="currentColor"
/>
</svg>
</span>
<span class="tel-auto-suggestion__link-text">
<span class="tel-auto-suggestion__search-text-highlight"
>cardio</span
>logy
</span>
</a>
</div>
<div class="tel-auto-suggestion__item" data-filter-categories="">
<a href="/search?q=cardiomyopathy" class="tel-auto-suggestion__link">
<span class="tel-auto-suggestion__icon-container" aria-hidden="true">
<svg
width="16"
height="16"
viewBox="0 0 16 16"
fill="none"
xmlns="http://www.w3.org/2000/svg"
aria-hidden="true"
class="tel-auto-suggestion__svg-icon"
>
<path
fill-rule="evenodd"
clip-rule="evenodd"
d="M11.8558 10.5296L15.7218 14.3861C15.8998 14.5627 16 14.8031 16 15.0539C16 15.3047 15.8998 15.5451 15.7218 15.7218C15.5451 15.8998 15.3047 16 15.0539 16C14.8031 16 14.5627 15.8998 14.3861 15.7218L10.5296 11.8558C7.76424 13.9254 3.86973 13.5064 1.60799 10.8959C-0.653748 8.28537 -0.513826 4.37088 1.92852 1.92852C4.37088 -0.513826 8.28537 -0.653748 10.8959 1.60799C13.5064 3.86973 13.9254 7.76424 11.8558 10.5296ZM6.58834 1.88537C3.9909 1.88537 1.88525 3.99101 1.88525 6.58846C1.88525 9.1859 3.9909 11.2915 6.58834 11.2915C9.18578 11.2915 11.2914 9.1859 11.2914 6.58846C11.2914 3.99101 9.18578 1.88537 6.58834 1.88537Z"
fill="currentColor"
/>
</svg>
</span>
<span class="tel-auto-suggestion__link-text">
<span class="tel-auto-suggestion__search-text-highlight"
>cardio</span
>myopathy
</span>
</a>
</div>
<div class="tel-auto-suggestion__item" data-filter-categories="">
<a href="/search?q=cardiologist" class="tel-auto-suggestion__link">
<span class="tel-auto-suggestion__icon-container" aria-hidden="true">
<svg
width="16"
height="16"
viewBox="0 0 16 16"
fill="none"
xmlns="http://www.w3.org/2000/svg"
aria-hidden="true"
class="tel-auto-suggestion__svg-icon"
>
<path
fill-rule="evenodd"
clip-rule="evenodd"
d="M11.8558 10.5296L15.7218 14.3861C15.8998 14.5627 16 14.8031 16 15.0539C16 15.3047 15.8998 15.5451 15.7218 15.7218C15.5451 15.8998 15.3047 16 15.0539 16C14.8031 16 14.5627 15.8998 14.3861 15.7218L10.5296 11.8558C7.76424 13.9254 3.86973 13.5064 1.60799 10.8959C-0.653748 8.28537 -0.513826 4.37088 1.92852 1.92852C4.37088 -0.513826 8.28537 -0.653748 10.8959 1.60799C13.5064 3.86973 13.9254 7.76424 11.8558 10.5296ZM6.58834 1.88537C3.9909 1.88537 1.88525 3.99101 1.88525 6.58846C1.88525 9.1859 3.9909 11.2915 6.58834 11.2915C9.18578 11.2915 11.2914 9.1859 11.2914 6.58846C11.2914 3.99101 9.18578 1.88537 6.58834 1.88537Z"
fill="currentColor"
/>
</svg>
</span>
<span class="tel-auto-suggestion__link-text">
<span class="tel-auto-suggestion__search-text-highlight"
>cardio</span
>logist
</span>
</a>
</div>
<div class="tel-auto-suggestion__item" data-filter-categories="">
<a href="/search?q=cardiothoracic" class="tel-auto-suggestion__link">
<span class="tel-auto-suggestion__icon-container" aria-hidden="true">
<svg
width="16"
height="16"
viewBox="0 0 16 16"
fill="none"
xmlns="http://www.w3.org/2000/svg"
aria-hidden="true"
class="tel-auto-suggestion__svg-icon"
>
<path
fill-rule="evenodd"
clip-rule="evenodd"
d="M11.8558 10.5296L15.7218 14.3861C15.8998 14.5627 16 14.8031 16 15.0539C16 15.3047 15.8998 15.5451 15.7218 15.7218C15.5451 15.8998 15.3047 16 15.0539 16C14.8031 16 14.5627 15.8998 14.3861 15.7218L10.5296 11.8558C7.76424 13.9254 3.86973 13.5064 1.60799 10.8959C-0.653748 8.28537 -0.513826 4.37088 1.92852 1.92852C4.37088 -0.513826 8.28537 -0.653748 10.8959 1.60799C13.5064 3.86973 13.9254 7.76424 11.8558 10.5296ZM6.58834 1.88537C3.9909 1.88537 1.88525 3.99101 1.88525 6.58846C1.88525 9.1859 3.9909 11.2915 6.58834 11.2915C9.18578 11.2915 11.2914 9.1859 11.2914 6.58846C11.2914 3.99101 9.18578 1.88537 6.58834 1.88537Z"
fill="currentColor"
/>
</svg>
</span>
<span class="tel-auto-suggestion__link-text">
<span class="tel-auto-suggestion__search-text-highlight"
>cardio</span
>thoracic
</span>
</a>
</div>
<div class="tel-auto-suggestion__item" data-filter-categories="resources">
<a
href="/search?q=270-reducing-cardio-vascular-risk-in-mh"
class="tel-auto-suggestion__link"
>
<span class="tel-auto-suggestion__link-text">
270 Reducing
<span class="tel-auto-suggestion__search-text-highlight"
>Cardio</span
>
Vascular Risk in MH
</span>
</a>
<div class="tel-auto-suggestion__subtext">
Type:
<span class="tel-auto-suggestion__subtext-value"
>Learning resource</span
>
</div>
</div>
<div class="tel-auto-suggestion__item" data-filter-categories="resources">
<a
href="/search?q=cardiovascular-diseases-toolkit"
class="tel-auto-suggestion__link"
>
<span class="tel-auto-suggestion__link-text">
<span class="tel-auto-suggestion__search-text-highlight"
>Cardio</span
>vascular diseases toolkit
</span>
</a>
<div class="tel-auto-suggestion__subtext">
Type:
<span class="tel-auto-suggestion__subtext-value"
>Learning resource</span
>
</div>
</div>
<div class="tel-auto-suggestion__item" data-filter-categories="resources">
<a
href="/search?q=imt-teaching-cardiology"
class="tel-auto-suggestion__link"
>
<span class="tel-auto-suggestion__link-text">
IMT Teaching -
<span class="tel-auto-suggestion__search-text-highlight"
>Cardio</span
>logy (06/05/26)
</span>
</a>
<div class="tel-auto-suggestion__subtext">
Type:
<span class="tel-auto-suggestion__subtext-value"
>Learning resource</span
>
</div>
</div>
<div class="tel-auto-suggestion__item" data-filter-categories="resources">
<a
href="/search?q=genomics-in-medical-specialties-cardiology"
class="tel-auto-suggestion__link"
>
<span class="tel-auto-suggestion__link-text">
Genomics in Medical Specialties:
<span class="tel-auto-suggestion__search-text-highlight"
>Cardio</span
>logy
</span>
</a>
<div class="tel-auto-suggestion__subtext">
Type:
<span class="tel-auto-suggestion__subtext-value"
>Learning resource</span
>
</div>
</div>
<div class="tel-auto-suggestion__item" data-filter-categories="resources">
<a
href="/search?q=genomics-in-medical-specialties-cardiology"
class="tel-auto-suggestion__link"
>
<span class="tel-auto-suggestion__link-text">
Genomics in Medical Specialties:
<span class="tel-auto-suggestion__search-text-highlight"
>Cardio</span
>logy
</span>
</a>
<div class="tel-auto-suggestion__subtext">
Type:
<span class="tel-auto-suggestion__subtext-value"
>Learning resource</span
>
</div>
</div>
</div>
</div>
</div>
Nunjucks macro options
Use options to customise the appearance, content and behaviour of a component when using a macro, for example, changing the text.
Some options are required for the macro to work; these are marked as "Required" in the option description.
If you're using Nunjucks macros in production with "html" options, or ones ending with "html", you must sanitise the HTML to protect against cross-site scripting exploits.
{% from 'tel/components/auto-suggestion/macro.njk' import telAutoSuggestion %}
{{ telAutoSuggestion({
id: "page-search-example",
input_name: "search-query",
placeholder: "Search the learning hub",
type: "page",
search_text: "cardio",
show_other: false,
show_search_button: true,
show_filters: true,
filters: {
heading: "Show",
showll: true,
allLabel: "All",
activeTags: ["all"],
tags: [
{ label: "Catalogues", value: "catalogues" },
{ label: "Courses", value: "courses" },
{ label: "Resources", value: "resources" }
]
},
menu_items: [
{
text: "cardiovascular",
href: "/search?q=cardiovascular",
icon: "search"
},
{
text: "cardiology",
href: "/search?q=cardiology",
icon: "search"
},
{
text: "cardiomyopathy",
href: "/search?q=cardiomyopathy",
icon: "search"
},
{
text: "cardiologist",
href: "/search?q=cardiologist",
icon: "search"
},
{
text: "cardiothoracic",
href: "/search?q=cardiothoracic",
icon: "search"
},
{
text: "270 Reducing Cardio Vascular Risk in MH",
href: "/search?q=270-reducing-cardio-vascular-risk-in-mh",
type: "Learning resource",
category: "resources"
},
{
text: "Cardiovascular diseases toolkit",
href: "/search?q=cardiovascular-diseases-toolkit",
type: "Learning resource",
category: "resources"
},
{
text: "IMT Teaching - Cardiology (06/05/26)",
href: "/search?q=imt-teaching-cardiology",
type: "Learning resource",
category: "resources"
},
{
text: "Genomics in Medical Specialties: Cardiology",
href: "/search?q=genomics-in-medical-specialties-cardiology",
type: "Learning resource",
category: "resources"
},
{
text: "Genomics in Medical Specialties: Cardiology",
href: "/search?q=genomics-in-medical-specialties-cardiology",
type: "Learning resource",
category: "resources"
}
]
}) }}
Use this variation for complex search interfaces where users need to narrow down suggestions using specific filters alongside the autosuggest input field.
Radio button patterns
Radio button autosuggest
Nunjucks macro options
Use options to customise the appearance, content and behaviour of a component when using a macro, for example, changing the text.
Some options are required for the macro to work; these are marked as "Required" in the option description.
If you're using Nunjucks macros in production with "html" options, or ones ending with "html", you must sanitise the HTML to protect against cross-site scripting exploits.
Use this variation to implement the autosuggest pattern within a radio button selection flow, allowing users to filter down a list of mutually exclusive choices as radio options.
Radio button with "other" option
Nunjucks macro options
Use options to customise the appearance, content and behaviour of a component when using a macro, for example, changing the text.
Some options are required for the macro to work; these are marked as "Required" in the option description.
If you're using Nunjucks macros in production with "html" options, or ones ending with "html", you must sanitise the HTML to protect against cross-site scripting exploits.
Use this variation when using radio buttons with autosuggest while providing a fallback option for users to enter their own custom response if their choice is not listed in the suggestions.
Radio button with pagination
Nunjucks macro options
Use options to customise the appearance, content and behaviour of a component when using a macro, for example, changing the text.
Some options are required for the macro to work; these are marked as "Required" in the option description.
If you're using Nunjucks macros in production with "html" options, or ones ending with "html", you must sanitise the HTML to protect against cross-site scripting exploits.
Use this variation when autosuggest radio button choices span multiple pages, giving users controls to page through results when a search returns a large number of options.
Radio button with pagination and "other" option
Nunjucks macro options
Use options to customise the appearance, content and behaviour of a component when using a macro, for example, changing the text.
Some options are required for the macro to work; these are marked as "Required" in the option description.
If you're using Nunjucks macros in production with "html" options, or ones ending with "html", you must sanitise the HTML to protect against cross-site scripting exploits.
Use this variation to combine paginated radio button results with an option for users to manually enter their own response if the paginated options do not cover their selection.
Content guidance
Input labels and instructions should be clear and concise.
Use labels that:
- clearly state what the user is searching for (for example, "Search for your GP surgery")
- use hint text to explain how suggestions work if necessary (for example, "Type at least 3 letters to search")
- keep option text concise and easy to scan
- ensure synonym matches are intuitive and accurate
Avoid using technical terms or internal codes in user-facing suggestion results unless users actively search with them.