or run

npx @tessl/cli init
Log in

Version

Tile

Overview

Evals

Files

tessl/npm-html-tags

List of standard HTML tags

Workspace
tessl
Visibility
Public
Created
Last updated
Describes
npmpkg:npm/html-tags@5.1.x

To install, run

npx @tessl/cli install tessl/npm-html-tags@5.1.0

0

# HTML Tags

1

2

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.

3

4

## Package Information

5

6

- **Package Name**: html-tags

7

- **Package Type**: npm

8

- **Language**: TypeScript

9

- **Installation**: `npm install html-tags`

10

11

## Core Imports

12

13

ES modules:

14

```javascript

15

import htmlTags from 'html-tags';

16

import { voidHtmlTags } from 'html-tags';

17

```

18

19

Combined import:

20

```javascript

21

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

22

```

23

24

CommonJS:

25

```javascript

26

const htmlTags = require('html-tags');

27

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

28

```

29

30

TypeScript type imports:

31

```typescript

32

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

33

```

34

35

## Basic Usage

36

37

```javascript

38

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

39

40

// Get all standard HTML tags

41

console.log(htmlTags);

42

//=> ['a', 'abbr', 'address', 'area', 'article', 'aside', 'audio', 'b', 'base', ...]

43

44

// Check if a tag is valid

45

const isValidTag = htmlTags.includes('div'); // true

46

const isInvalidTag = htmlTags.includes('center'); // false (obsolete tag)

47

48

// Get void (self-closing) tags

49

console.log(voidHtmlTags);

50

//=> ['area', 'base', 'br', 'col', 'embed', 'hr', 'img', 'input', 'link', 'meta', 'source', 'track', 'wbr']

51

52

// Check if a tag is void

53

const isVoidTag = voidHtmlTags.includes('br'); // true

54

const isNotVoidTag = voidHtmlTags.includes('div'); // false

55

```

56

57

## Capabilities

58

59

### Standard HTML Tags

60

61

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

62

63

```typescript { .api }

64

/**

65

* List of standard HTML tags (default export).

66

* Contains 115 HTML tag names as strings.

67

* Excludes obsolete HTML tags to maintain compliance with modern HTML specifications.

68

*/

69

declare const htmlTags: readonly HtmlTags[];

70

export default htmlTags;

71

```

72

73

### Void HTML Tags

74

75

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

76

77

```typescript { .api }

78

/**

79

* List of standard, self-closing HTML tags.

80

* Contains 13 void HTML tag names as strings.

81

*/

82

export const voidHtmlTags: readonly VoidHtmlTags[];

83

```

84

85

## Types

86

87

```typescript { .api }

88

/**

89

* Union type of all standard HTML tag names as string literals.

90

* Includes all 115 standard HTML tags.

91

*/

92

export type HtmlTags =

93

| 'a'

94

| 'abbr'

95

| 'address'

96

| 'area'

97

| 'article'

98

| 'aside'

99

| 'audio'

100

| 'b'

101

| 'base'

102

| 'bdi'

103

| 'bdo'

104

| 'blockquote'

105

| 'body'

106

| 'br'

107

| 'button'

108

| 'canvas'

109

| 'caption'

110

| 'cite'

111

| 'code'

112

| 'col'

113

| 'colgroup'

114

| 'data'

115

| 'datalist'

116

| 'dd'

117

| 'del'

118

| 'details'

119

| 'dfn'

120

| 'dialog'

121

| 'div'

122

| 'dl'

123

| 'dt'

124

| 'em'

125

| 'embed'

126

| 'fieldset'

127

| 'figcaption'

128

| 'figure'

129

| 'footer'

130

| 'form'

131

| 'h1'

132

| 'h2'

133

| 'h3'

134

| 'h4'

135

| 'h5'

136

| 'h6'

137

| 'head'

138

| 'header'

139

| 'hgroup'

140

| 'hr'

141

| 'html'

142

| 'i'

143

| 'iframe'

144

| 'img'

145

| 'input'

146

| 'ins'

147

| 'kbd'

148

| 'label'

149

| 'legend'

150

| 'li'

151

| 'link'

152

| 'main'

153

| 'map'

154

| 'mark'

155

| 'math'

156

| 'menu'

157

| 'meta'

158

| 'meter'

159

| 'nav'

160

| 'noscript'

161

| 'object'

162

| 'ol'

163

| 'optgroup'

164

| 'option'

165

| 'output'

166

| 'p'

167

| 'picture'

168

| 'pre'

169

| 'progress'

170

| 'q'

171

| 'rp'

172

| 'rt'

173

| 'ruby'

174

| 's'

175

| 'samp'

176

| 'script'

177

| 'search'

178

| 'section'

179

| 'select'

180

| 'selectedcontent'

181

| 'slot'

182

| 'small'

183

| 'source'

184

| 'span'

185

| 'strong'

186

| 'style'

187

| 'sub'

188

| 'summary'

189

| 'sup'

190

| 'svg'

191

| 'table'

192

| 'tbody'

193

| 'td'

194

| 'template'

195

| 'textarea'

196

| 'tfoot'

197

| 'th'

198

| 'thead'

199

| 'time'

200

| 'title'

201

| 'tr'

202

| 'track'

203

| 'u'

204

| 'ul'

205

| 'var'

206

| 'video'

207

| 'wbr';

208

209

/**

210

* Union type of all void HTML tag names as string literals.

211

* Includes all 13 void HTML tags.

212

*/

213

export type VoidHtmlTags =

214

| 'area'

215

| 'base'

216

| 'br'

217

| 'col'

218

| 'embed'

219

| 'hr'

220

| 'img'

221

| 'input'

222

| 'link'

223

| 'meta'

224

| 'source'

225

| 'track'

226

| 'wbr';

227

```