json-bootstrap v1.0.2
json-bootstrap
Converts your JSON data into Bootstrap.
Install
Install with npm:
$ npm install json-bootstrap
Install with yarn:
$ yarn add json-bootstrap
Usage
const jsonBootstrap = require('json-bootstrap');
Methods
alert()
Exposes a single dimension JSON array as Bootstrap Alerts.
Usage
alert(items, type, encoded, dismiss, title, className)
Parameters
Parameter | Description |
---|---|
items | Array of strings. |
type | Possible values (primary, secondary, success, danger, warning, info, light, dark). |
encoded | The items will be html encoded. |
dismiss | Close button in the alert. |
title | Title of the alert. |
className | Class name to be added on each item. |
Example
const jsonBootstrap = require('json-bootstrap');
const errors = [
'Your username must start with a letter',
'Your username must have at least 2 characters.'
]
console.log(jsonBootstrap.alert(errors, 'danger', true, true, false, 'errors'))
card()
Generates a Bootstrap Card.
form()
Build a Bootstrap Form from a JSON object with properties.
table()
Creates a Bootstrap Table from a JSON array of objects.
About
Contributing
Pull requests and stars are always welcome. For bugs and feature requests, please create an issue.
Please read the contributing guide for advice on opening issues, pull requests, and coding standards.
Running tests
Running and reviewing unit tests is a great way to get familiarized with a library and its API. You can install dependencies and run tests with the following command:
$ npm install && npm test
Author
Guilherme Cruz
License
Copyright © 2020, Guilherme Cruz. Released under the MIT License.