An open API service indexing awesome lists of open source software.

https://github.com/bclehmann/dashboard-widgets

An npm package providing several react components to help create a clean dashboard easily and quickly.
https://github.com/bclehmann/dashboard-widgets

dashboard javascript mit-license npm open-source react typescript

Last synced: 2 months ago
JSON representation

An npm package providing several react components to help create a clean dashboard easily and quickly.

Awesome Lists containing this project

README

          

[![npm version](https://badge.fury.io/js/dashboard-widgets.svg)](https://badge.fury.io/js/dashboard-widgets)
![npm bundle size](https://img.shields.io/bundlephobia/min/dashboard-widgets)
![npm total downloads](https://img.shields.io/npm/dt/dashboard-widgets)
![npm weekly downloads](https://img.shields.io/npm/dw/dashboard-widgets)
![platform react](https://img.shields.io/badge/platform-react-blue)
![mit license](https://img.shields.io/npm/l/dashboard-widgets)

# Installation
```
$ npm i dashboard-widgets
```

Then simply import the modules you want:

```ts
import {Badge} from dashboard-widgets
```

The details of how to use each module are below

# Features
- Auto-apply formatting to tables
- Badges
- Phone Element
- Dark Mode Detect

## Tables

Use `import { FormatTableRows } from "dashboard-widgets"`

Pass in data and a function to act as a formatRule. The `formatRule` prop takes in a cell and returns a classname as a string. `formatRuleRow` does the same thing but for a table row (represented as an array of cells).

```tsx


Column 1
Column 2
Column 3

typeof cell == "number" ? "displayRed" : ""}
formatRuleRow={(row)=> typeof row[0] == "number" ? "displayGreen" : ""}
/>

```

With the following CSS classes:

```css
.displayRed {
color: red;
}

.displayGreen {
color: green;
}
```

Produces this output:
Table1

Note that the `.table` class is from bootstrap. This example uses bootstrap styling but it is not required, nor is it a dependency of this project. Bootstrap is available here: https://getbootstrap.com/

## Badges
Badge1

This can be done with:
```tsx
import {Badge} from "dashboard-widgets"

```
Similarly, you can have a filled badge like the following:

Badge2

```tsx
import {Badge} from "dashboard-widgets"

```
## Phone Element

You can add elements within a phone screen like this:

Phone1

The code here is simple:
```tsx
import {Phone} from 'dashboard-widgets'

//Your content here

```
You can create a smaller and more minimalist phone by passing a truthy value to the `small` prop:

Phone2

```tsx
import {Phone} from 'dashboard-widgets'

//Your content here

```

## Dark Mode Detect

It is quite easy to detect that the client prefers dark/night mode from CSS. It can be cumbersome to do the same from Javascript. With this package, its as easy as pie:
```tsx
import { isDarkMode } from "dashboard-widgets"
if(isDarkMode){
//Code
}
```
# Links
- NPM Page: https://www.npmjs.com/package/dashboard-widgets
- Github Repo: https://github.com/Benny121221/dashboard-widgets

# Contribution
If you're feeling generous, feel free to put in a PR. This is all under the MIT License.

---
![Logo](https://raw.githubusercontent.com/Benny121221/images/master/logo_full.png)

# Made by Where 1