or run

npx @tessl/cli init
Log in

Version

Tile

Overview

Evals

Files

docs

index.md
tile.json

index.mddocs/

HTML Tags

HTML Tags provides comprehensive lists of standard HTML tags as JSON data structures, including both regular HTML tags and void (self-closing) tags. It serves as a foundational data source for HTML parsing, validation, linting tools, and web development utilities that need to work with the complete set of valid HTML elements.

Package Information

  • Package Name: html-tags
  • Package Type: npm
  • Language: TypeScript
  • Installation:
    npm install html-tags

Core Imports

ES modules:

import htmlTags from 'html-tags';
import { voidHtmlTags } from 'html-tags';

Combined import:

import htmlTags, { voidHtmlTags } from 'html-tags';

CommonJS:

const htmlTags = require('html-tags');
const { voidHtmlTags } = require('html-tags');

TypeScript type imports:

import type { HtmlTags, VoidHtmlTags } from 'html-tags';

Basic Usage

import htmlTags, { voidHtmlTags } from 'html-tags';

// Get all standard HTML tags
console.log(htmlTags);
//=> ['a', 'abbr', 'address', 'area', 'article', 'aside', 'audio', 'b', 'base', ...]

// Check if a tag is valid
const isValidTag = htmlTags.includes('div'); // true
const isInvalidTag = htmlTags.includes('center'); // false (obsolete tag)

// Get void (self-closing) tags
console.log(voidHtmlTags);
//=> ['area', 'base', 'br', 'col', 'embed', 'hr', 'img', 'input', 'link', 'meta', 'source', 'track', 'wbr']

// Check if a tag is void
const isVoidTag = voidHtmlTags.includes('br'); // true
const isNotVoidTag = voidHtmlTags.includes('div'); // false

Capabilities

Standard HTML Tags

Complete list of all standard HTML tags as a readonly array.

/**
 * List of standard HTML tags (default export).
 * Contains 115 HTML tag names as strings.
 * Excludes obsolete HTML tags to maintain compliance with modern HTML specifications.
 */
declare const htmlTags: readonly HtmlTags[];
export default htmlTags;

Void HTML Tags

List of void (self-closing) HTML tags as a readonly array.

/**
 * List of standard, self-closing HTML tags.
 * Contains 13 void HTML tag names as strings.
 */
export const voidHtmlTags: readonly VoidHtmlTags[];

Types

/**
 * Union type of all standard HTML tag names as string literals.
 * Includes all 115 standard HTML tags.
 */
export type HtmlTags =
  | 'a'
  | 'abbr'
  | 'address'
  | 'area'
  | 'article'
  | 'aside'
  | 'audio'
  | 'b'
  | 'base'
  | 'bdi'
  | 'bdo'
  | 'blockquote'
  | 'body'
  | 'br'
  | 'button'
  | 'canvas'
  | 'caption'
  | 'cite'
  | 'code'
  | 'col'
  | 'colgroup'
  | 'data'
  | 'datalist'
  | 'dd'
  | 'del'
  | 'details'
  | 'dfn'
  | 'dialog'
  | 'div'
  | 'dl'
  | 'dt'
  | 'em'
  | 'embed'
  | 'fieldset'
  | 'figcaption'
  | 'figure'
  | 'footer'
  | 'form'
  | 'h1'
  | 'h2'
  | 'h3'
  | 'h4'
  | 'h5'
  | 'h6'
  | 'head'
  | 'header'
  | 'hgroup'
  | 'hr'
  | 'html'
  | 'i'
  | 'iframe'
  | 'img'
  | 'input'
  | 'ins'
  | 'kbd'
  | 'label'
  | 'legend'
  | 'li'
  | 'link'
  | 'main'
  | 'map'
  | 'mark'
  | 'math'
  | 'menu'
  | 'meta'
  | 'meter'
  | 'nav'
  | 'noscript'
  | 'object'
  | 'ol'
  | 'optgroup'
  | 'option'
  | 'output'
  | 'p'
  | 'picture'
  | 'pre'
  | 'progress'
  | 'q'
  | 'rp'
  | 'rt'
  | 'ruby'
  | 's'
  | 'samp'
  | 'script'
  | 'search'
  | 'section'
  | 'select'
  | 'selectedcontent'
  | 'slot'
  | 'small'
  | 'source'
  | 'span'
  | 'strong'
  | 'style'
  | 'sub'
  | 'summary'
  | 'sup'
  | 'svg'
  | 'table'
  | 'tbody'
  | 'td'
  | 'template'
  | 'textarea'
  | 'tfoot'
  | 'th'
  | 'thead'
  | 'time'
  | 'title'
  | 'tr'
  | 'track'
  | 'u'
  | 'ul'
  | 'var'
  | 'video'
  | 'wbr';

/**
 * Union type of all void HTML tag names as string literals.
 * Includes all 13 void HTML tags.
 */
export type VoidHtmlTags =
  | 'area'
  | 'base'
  | 'br'
  | 'col'
  | 'embed'
  | 'hr'
  | 'img'
  | 'input'
  | 'link'
  | 'meta'
  | 'source'
  | 'track'
  | 'wbr';