What is in a folder?

An LWC is a set of files:

  1. HTML file (optional)
  2. Javascript file (must-have)
  3. XML file (must-have)
  4. CSS file (optional)
  5. SVG file (optional)
  6. Tests Folder (optional)

The folder and its files must follow these rules:

  1. Must begin with a lowercase letter
  2. Must contain only alphanumeric or underscore characters even though not recommended
  3. Must be unique in the namespace
  4. Can’t include whitespace, a hyphen or two consecutive underscores
  5. Can’t end with an underscore

HTML file

HTML file is only required for user interface. So-called Service Components that don’t need UI, don’t need an HTML file.

Minimal HTML file: