A flight search and results screen built as an HTML mobile template with Bootstrap 5: a flight booking form with a from/to swap, dates and a travellers sheet, then a flight results list with Best, Cheapest and Fastest sort tabs. Use it in an airline or travel app UI, a booking PWA or a mobile travel site, and package it with Capacitor for the app stores.
How it works
The root .fsr-app is a 430 px app column with two views marked by data-fsr-view. In the search view, .fsr-form has a round trip / one way switch, the .fsr-route box with two inputs linked to the #fsr-airports datalist and the .fsr-swap button, two date fields and the .fsr-pax-btn row. Dates are set relative to today, so the screen never shows a past date. On submit the script checks that the airports differ, departure is not in the past and return is not before departure; invalid fields get is-invalid and focus moves to the first one.
The travellers row opens #fsr-pax-sheet, a Bootstrap offcanvas styled as a bottom sheet with steppers for adults, children and infants (nine travellers at most, one infant per adult) and a cabin choice.
A valid search shows the results view: .fsr-day chips with a price for nearby dates, the .fsr-sort tabs and one .fsr-flight button per entry in the FLIGHTS array with times, duration, stops and a price that follows cabin and travellers. Tapping a flight shows the sticky .fsr-select-bar with a Continue button.
Customization
--fsr-accent,--fsr-accent-darkand--fsr-accent-softon.fsr-app: change the sky blue of buttons, icons and the selected flight.FLIGHTSinscript.js: edit times,dur(minutes),stops,viaandfare, or fill it from your flight API.AIRLINESinscript.js: carrier names and logo colours.CURRENCYandCABIN_FACTORinscript.js: currency symbol and price step per cabin.- The options of
#fsr-airports: the airports your service covers. - The
submithandler of.fsr-form: add yourfetch()search call beforeshowResults(). - The deal photos come from Unsplash; replace them with your own images.
Use cases
- Airline apps: customers search a route and compare flights by price or duration.
- Online travel agencies: a compact mobile search form with results.
- Holiday package apps: the flight step before hotels or extras.
Accessibility
Every field has a visible label, and errors are linked with aria-describedby. Swap, stepper and icon buttons have aria-label values. The sort options use role="tablist" with arrow key, Home and End support. Flight and date buttons use aria-pressed, and each flight has a full spoken summary. The sheet traps focus, closes with Escape or the backdrop and returns focus to the travellers row. The toast is a role="status" live region, and touch targets are at least 44 px.
Usage notes
Needs Bootstrap 5 with its bundle, Bootstrap Icons and Plus Jakarta Sans. Flights and prices are sample data.