Skip to content

The HTML List Builder is an npm package that allows you to easily create ordered and unordered lists in HTML with class and id attributes as options.

License

Notifications You must be signed in to change notification settings

brandonhimpfen/html-list-builder

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

html-list-builder

npm version

The HTML List Builder is an npm package that allows you to easily create ordered and unordered lists in HTML with class and id attributes as options. It provides a simple and convenient way to generate lists programmatically.

Installation

You can install the HTML List Builder package using npm. Run the following command:

npm install html-list-builder

Usage

To use the HTML List Builder in your project, require it and call the provided functions:

const { createOrderedList, createUnorderedList } = require('html-list-builder');

const items = ['Apple', 'Banana', 'Orange'];
const options = { class: 'fruits', id: 'fruits-list' };

const orderedList = createOrderedList(items, options);
console.log(orderedList);

const unorderedList = createUnorderedList(items, options);
console.log(unorderedList);

The createOrderedList and createUnorderedList functions take an array of items as the first parameter and an options object as the second parameter. The options object can contain class and idattributes to customize the list element.

API

createOrderedList(items, options)

This function generates an ordered list in HTML.

  • items (Array): An array of strings representing the list items.
  • options (Object): An optional object with the following properties:
    • class (String): The class attribute for the <ol> element.
    • id (String): The id attribute for the <ol> element.

Returns: A string containing the generated ordered list HTML.

createUnorderedList(items, options)

This function generates an unordered list in HTML.

  • items (Array): An array of strings representing the list items.
  • options (Object): An optional object with the following properties:
    • class (String): The class attribute for the <ul> element.
    • id (String): The id attribute for the <ul> element.

Returns: A string containing the generated unordered list HTML.

About

The HTML List Builder is an npm package that allows you to easily create ordered and unordered lists in HTML with class and id attributes as options.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published