npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

sg-json-table

v0.0.6

Published

sg-json-table Component

Readme

title

Sg-Table Component

This package is used to load table from api returning the JSON Array.

You just need to provide the data-url which returns JSON Array, It will load and display table with pagination, search, print options. You can also customize the options and themes based on your needs.

Getting Started

Use the below command to add your package in your application

npm i sg-json-table

you can consume it in your application as shown below:

<sg-table data-url='https://microsoftedge.github.io/Demos/json-dummy-data/128KB.json' ></sg-table>

Options

| Property | Attribute | Type | Description | | ------------- | ---------------- | --------- | :-----------------------------------------------------------------: | | dataUrl | data-url | string | (Required) API url to load the data as an JSON Array | | info | info| boolean | (Optional) It gives the end user information about what is being shown in the table, Default: false | | ordering | ordering | boolean | (Optional) Enable or disable ordering of columns, Default: false | | paging | paging | boolean | (Optional) Enable and disable the pagination button and total entries dropdown. Total number of records shown in the page is 10 as default, Default: false | | print | print | boolean | (Optional) Enable and disable the print options. It will provide options to print the current page. Default: false | | searching | searching | boolean | (Optional) Enable or disable the search filter textbox. Default: false | | theme | theme | string | (Optional) Used to change the background of the table header. You can use 3 themes . "red , green and blue". Default: White

Example:

screenshot-1

Usage

Now we will see how to integrate this libiary in your applications.

Angular

Step 1: Add an import to main.js

import { defineCustomElements} from '../node_modules/sg-json-table/loader';

And somewhere near the bottom we'll call this function.

defineCustomElements();

Step 2: Next, in app.module.ts add the CUSTOM_ELEMENTS_SCHEMA.

import {CUSTOM_ELEMENTS_SCHEMA} from `@angular/core`;

and then

schemas: [
    CUSTOM_ELEMENTS_SCHEMA
]

Your app.module.ts should look like this:

import { NgModule, CUSTOM_ELEMENTS_SCHEMA } from '@angular/core';

@NgModule({
  declarations: [],
  imports: [],
  schemas: [ CUSTOM_ELEMENTS_SCHEMA],
  providers: [],
  bootstrap: [AppComponent]
})

export class AppModule { }

Please Note: schemas: [ CUSTOM_ELEMENTS_SCHEMA ] need to be added to each component where you are using custom HTML tags.

Step 3: Now, in app.component.html you utilize your new custom element.

<sg-table data-url='API_JSON_URL'></sg-table>

React

Step 1: Now we'll add an import to index.js

import { defineCustomElements} from '../node_modules/sg-json-table/loader';

And somewhere near the bottom we'll call this function.

defineCustomElements();

Step 2: Next, in app.js you utilize your new custom element

function App() {
  return (
    <div className="App">
      <header className="App-header">
        <img src={logo} className="App-logo" alt="logo" />
        
        <sg-table data-url='https://microsoftedge.github.io/Demos/json-dummy-data/128KB.json' info='true' paging="true"></sg-table>
        
      </header>
    </div>
  );
}

Vue

Add defineCustomElements to one of our main files. Specifically main.js for Vue.

import { defineCustomElements} from '../node_modules/sg-json-table/loader';

And somewhere near the bottom we'll call this function.

defineCustomElements();

Next, in App.Vue you consume the custom element.

<template>
  <div id="app">
    <img alt="Vue logo" src="./assets/logo.png">
    
      <sg-table data-url='https://microsoftedge.github.io/Demos/json-dummy-data/128KB.json' info='true' paging=true></sg-table>
      
  </div>
</template>

<script>
export default {
  name: 'App',
}
</script>

Please Note: If you are using multiple component then you can define the defineCustomElements as shown below:

import { defineCustomElements as defineCustomElements1} from '../node_modules/sg-copyright/loader';
import { defineCustomElements as defineCustomElements2} from '../node_modules/sg-avatar/loader';
import { defineCustomElements as defineCustomElements3} from '../node_modules/sg-json-table/loader';
.
.
.
defineCustomElements1();
defineCustomElements2();
defineCustomElements3();

Click Here for live demo.