Spunk Autos

Websites and web tools

Web Components: Red Flags and Green Flags

Web components are reusable custom HTML elements, such as a booking calendar, a vehicle photo gallery or a tire-size picker, built on browser standards rather than one framework. That portability makes them attractive for small business sites. It also means quality varies widely, so it pays to know what good and bad ones look like.

The building blocks in brief

  • Custom elements: you define a new tag, whose name must contain a hyphen, such as service-menu.
  • Shadow DOM: an isolated subtree whose styles do not leak out and page styles do not leak in, except through chosen hooks.
  • Templates and slots: placeholders that let you pass your own content into the component.

Green flags

Green flagWhy it matters
Works with plain HTML attributes and documented propertiesYou can configure it without a build step
Keyboard support and correct ARIA rolesCustomers using keyboards or screen readers can book
Styling hooks through CSS custom properties or ::partYou can match your brand without forking the code
Fires standard events, such as changeYour own scripts can react to user choices
Renders something useful before JavaScript loadsThe page is not blank on a slow connection
Clear licence and changelogYou know you can use it and what changed

Red flags

Red flagRisk
Pulls in a large framework for a small widgetSlower pages and more code to update
Loads scripts or fonts from a third-party server at runtimePrivacy concerns and an outage you cannot control
Hard-coded colours and sizes with no styling hooksIt will never quite match your site
Click handlers on plain div elements instead of buttonsBroken for keyboard and assistive technology users
No tests and no recent releasesBugs stay unfixed when browsers change
Asks you to paste its code inline without a version numberNo way to track or roll back changes

A ten-minute evaluation

  1. Read the documentation for attributes, properties, events and styling hooks.
  2. Load the demo and use it with only the keyboard: Tab, Enter, Space and the arrow keys.
  3. Turn on a screen reader briefly and listen to how controls are announced.
  4. Open the browser's network panel and note every file the component loads.
  5. Resize to phone width and check touch targets.
  6. Check the repository for the date of the last release and open issues.

Example: a booking date picker

Suppose you are choosing a date picker for a detailing booking page. A good one lets you disable Sundays and past dates through attributes, announces the selected date to screen readers, accepts typed dates as well as clicks, and fires a change event with an ISO date string such as 2026-05-14. A poor one only works with a mouse, stores dates in an ambiguous local format and pulls in a large library for one popup.

When to skip web components

If the native HTML element already does the job, such as a select for a short list of services or an input type="date" for simple forms, use it. Native elements come with keyboard support and mobile-friendly behaviour that a custom component has to rebuild.