← All Exercises

Wire an Input to a Datalist Suggestion List

basichtml~15min

Background

Datalist provides native, accessible suggestions that work without JavaScript and degrade to a plain text input.

Problem

Build a framework search field that offers suggestions from a datalist, keeps a visible label and hint, and still accepts a framework name that is not in the list.

Input

Four framework names and one search field.

Output

A labelled input bound to a datalist of option values.

Sample tests

Sample 1

Input: User types Ast into the field
Expected: the browser filters the datalist options and offers Astro and Angular while the typed text stays editable

Sample 2

Input: User enters SvelteKit, which is not listed
Expected: the input accepts the free-text value because datalist suggestions are not a constraint

Your solution

Learning objective

Use label, datalist, and list attributes to deliver native autocomplete without giving up free-text input.