# generate-element

> Create a new HTML element and specify class, text content and attributes in a single function

Latest version **1.0.6** (published 2022-07-03) · MIT license · 0 weekly downloads

## Install

```sh
npm install generate-element
pnpm add generate-element
yarn add generate-element
bun add generate-element
```

## Health

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

Positive: has types; no vulnerabilities; high quality score.

Warnings: low downloads; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.6 |
| Published | 2022-07-03 |
| First published | 2022-06-13 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 3.9 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | Daniel Sanchez |
| Maintainers | danxschz |
| Keywords | helper, HTML, HTML Element, DOM, DOM Manipulation |

## Links

- npm: https://www.npmjs.com/package/generate-element
- Repository: https://github.com/danxschz/generate-element
- Issues: https://github.com/danxschz/generate-element/issues
- npm.io page: https://npm.io/package/generate-element

## 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

- 1.0.6 (latest) — 2022-07-03
- 1.0.5 — 2022-07-02
- 1.0.4 — 2022-07-01
- 1.0.3 — 2022-06-13
- 1.0.2 — 2022-06-13
- 1.0.1 — 2022-06-13
- 1.0.0 — 2022-06-13

## README

<div align="center">
  <img src="https://raw.githubusercontent.com/danxschz/danxschz/main/img/danxschz-logo.png" alt="logo" width="200" height="auto">
  <h1>Generate Element</h1>

  <p>
  Create a new HTML element and specify class, text content and attributes in a single function
  </p>

  <p>
    <a href="https://github.com/danxschz/generate-element/graphs/contributors">
      <img src="https://img.shields.io/github/contributors/danxschz/generate-element" alt="contributors">
    </a>
    <a href="https://github.com/danxschz/generate-element/commits/main">
      <img src="https://img.shields.io/github/last-commit/danxschz/generate-element" alt="last update">
    </a>
    <a href="https://github.com/danxschz/generate-element/blob/master/LICENSE">
      <img src="https://img.shields.io/github/license/danxschz/generate-element.svg" alt="license">
    </a>
  </p>

  <h4>
    <a href="https://github.com/danxschz/generate-element">GitHub</a>
    <span> · </span>
    <a href="https://www.npmjs.com/package/generate-element">npm</a>
  </h4>
</div>

<br/>

## Getting Started

### Install

In order to setup and use this package, you will need to:

Install dependency

```bash
  npm install --save-dev generate-element
```

Import the module in your JavaScript file

```bash
  import generateElement from 'generate-element'
```

### Usage

Run the function

```bash
  generateElement(type, class, textContent, { attributes })
```

Example

```bash
  const anchorElement = generateElement('a', 'example', 'Click me', { href: '#', title: 'This is an example' })
```

To skip any parameter, pass false as the argument

## License

Distributed under the MIT License. See LICENSE for more information.

## Contact

Daniel Sanchez (@danxschz) - danxschz@gmail.com

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