# validate-element-name

> Validate the name of a custom element

Latest version **3.0.0** (published 2021-06-10) · MIT license · 0 weekly downloads

## Install

```sh
npm install validate-element-name
pnpm add validate-element-name
yarn add validate-element-name
bun add validate-element-name
```

Provides the command `validate-element-name`.

## Health

**Score 20/100 (F)** — status: abandoned.

Positive: esm support; no vulnerabilities.

Warnings: low downloads; no types.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 3.0.0 |
| Published | 2021-06-10 |
| First published | 2014-03-25 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | ESM |
| Node | >=12.20 |
| Dependencies | 3 |
| Unpacked size | 6.3 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 44 |
| Author | Sindre Sorhus |
| Maintainers | sindresorhus |
| Keywords | cli-app, cli, validate, validator, check, custom, element, elements, html, tag, name, wc, web, components |

## Links

- npm: https://www.npmjs.com/package/validate-element-name
- Repository: https://github.com/sindresorhus/validate-element-name
- Homepage: https://github.com/sindresorhus/validate-element-name#readme
- Issues: https://github.com/sindresorhus/validate-element-name/issues
- Funding: https://github.com/sponsors/sindresorhus
- npm.io page: https://npm.io/package/validate-element-name

## Dependencies (3)

- [meow](https://npm.io/package/meow.md) ^10.0.1
- [log-symbols](https://npm.io/package/log-symbols.md) ^5.0.0
- [is-potential-custom-element-name](https://npm.io/package/is-potential-custom-element-name.md) ^1.0.1

## Alternatives

- [@tsparticles/shape-image](https://npm.io/package/@tsparticles/shape-image.md) — 303.7K weekly downloads
- [@tsparticles/shape-line](https://npm.io/package/@tsparticles/shape-line.md) — 233.7K weekly downloads
- [stringify-attributes](https://npm.io/package/stringify-attributes.md) — 58.6K weekly downloads
- [mobile-drag-drop](https://npm.io/package/mobile-drag-drop.md) — 46.3K weekly downloads
- [@comunica/actor-rdf-parse-html](https://npm.io/package/@comunica/actor-rdf-parse-html.md) — 29.2K weekly downloads

## Recent versions

- 3.0.0 (latest) — 2021-06-10
- 2.1.1 — 2016-06-24
- 2.1.0 — 2016-06-24
- 2.0.0 — 2016-06-21
- 1.0.0 — 2014-08-13
- 0.7.1 — 2014-05-13
- 0.7.0 — 2014-05-13
- 0.6.0 — 2014-04-22
- 0.5.0 — 2014-04-09
- 0.4.0 — 2014-04-07
- 0.3.1 — 2014-04-07
- 0.3.0 — 2014-04-06
- 0.2.0 — 2014-04-06
- 0.1.1 — 2014-03-27
- 0.1.0 — 2014-03-25

## README

# validate-element-name

> Validate the name of a [custom element](http://www.html5rocks.com/en/tutorials/webcomponents/customelements/)

Custom element names should start with `a-z` and contain `a-z` and at least one `-` with optionally `0-9`.

You should not use the [`x-`, `polymer-`](http://webcomponents.github.io/articles/how-should-i-name-my-element/), [`ng-`](http://docs.angularjs.org/guide/directive#creating-directives) prefixes.

## Install

```
$ npm install validate-element-name
```

## Usage

```js
import validateElementName from 'validate-element-name';

validate('unicorn');
//=> {isValid: false, message: 'Custom element names must contain a hyphen. Example: unicorn-cake'}
```

See [cli.js](cli.js) for real-world usage.

## CLI

```
$ npm install --global validate-element-name
```

```
$ validate-element-name --help

  Usage
    $ validate-element-name <element-name>

  Example
    $ validate-element-name s-slider
    ✔︎ Valid element name.
```

---
_Source: https://npm.io/package/validate-element-name · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
