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 🙏

© 2024 – Pkg Stats / Ryan Hefner

react-settings-panel

v1.0.8

Published

A customizable settings panel built with React.

Downloads

5

Readme

React Settings Panel

React Settings Pannel is a customizable React component that allows you to create your own settings panel.

Features

  • Switches
  • Dropdown
  • Input
  • Text Area
  • Radio Buttons
  • Checkboxes

Installation

React-Settings-Panel needs React and Mobx dependensies

Install the package and include it to your project

$ npm install react-settings-panel |or| $ yarn add react-settings-panel
import { SettingsPanel } from 'react-settings-panel'

Usage

  • Basic usage
    import React, { Component } from 'react'
    import {
        Toolbar, Group, SettingsPanel, Switch, Checkbox, CheckboxGroup,
        Radio, RadioGroup, Option, Selection, Input, TextArea
    } from 'react-settings-panel'
    class Settings extends Component {
        handleSubmit = (data) => console.log
        render() {
            return(
                <SettingsPanel color={'#728ad8'} onSubmit={this.handleSubmit}>
                    <Toolbar />
                    <Group>
                      <Switch name='mySwitch' title='Switch One'/>
                      <Input name='myTextField' title='InputField'/>
                      <TextArea name='myTextArea' title='Text Area One'/>
                      <CheckboxGroup name='myCheckbox' title='Checkbox One'>
                        <Checkbox value='A' />
                        <Checkbox value='B' />
                        <Checkbox value='C' />
                      </CheckboxGroup>
                    </Group>
                    <Group>
                        <Selection title="Selection" name='mySelection' >
                            <Option value='a' />
                            <Option value='b' />
                            <Option value='c' />
                        </Selection>
                        <RadioGroup title="Radio Group" name='myRadio'>
                            <Radio value='A' />
                            <Radio value='B' />
                            <Radio value='C' />
                        </RadioGroup>
                    </Group>
                </SettingsPanel>
            )
        }
    }
    Output:

    screenshot

  • Components
    • Input

      Input component adds a text field to your panel. It doesn't require a parent and can be a solo component

          <Input name='myTextField' title='InputField'/>

      props: [name, title]

    • TextArea

      TextArea component adds a Text Area box to your panel. It doesn't require a parent and can be a solo component

          <TextArea name='myTextArea' title='Text Area One'/>

      props: [name, title]

    • Group

      Group component acts as a parent to other settings components to seperate each group of settings to its own column. The colums are responsive as well.

          <Group>
            <Switch name='mySwitch' title='Switch One'/>
            <Input name='myTextField' title='Input Field1'/>
            <TextArea name='myTextArea' title='Text Area One'/>
          </Group>
          <Group>
              <Input name='myTextField' title='Input Field2'/>
              <Selection title="Selection" name='mySelection' >
                  <Option value='a' />
                  <Option value='b' />
                  <Option value='c' />
              </Selection>
          </Group>

      Output: screenshot2 props: [none]

    • Switch

      Switch component adds a clickable and mobile-touch enabled switch to your settings. It doesn't require a parent and can be a solo component.

          <Switch name='mySwitch' title='Switch One'/>

      props: [name, title]

    • Checkbox

      Checkbox component adds a checkbox button to your settings. Checkbox requires to be wrapped in the parent for it to work. Value prop is both used for display name and key value name in data.

          <CheckboxGroup name='myCheckbox' title='Checkbox One'>
              <Checkbox value='A' />
              <Checkbox value='B' />
              <Checkbox value='C' />
           </CheckboxGroup>

      props: [name, title, value]

    • Selection

      Selection is a parent component that acts as a dropdown. Dropdown requires Option components for values to select from. This is similar to Checkbox and Radio groups.

          <Selection title="Selection" name='mySelection' >
              <Option value='a' />
              <Option value='b' />
              <Option value='c' />
          </Selection>

      props: [name, title, value]

    • Radio

      Radio component adds a radio button to your settings. Radio requires to be wrapped in the parent for it to work. Value prop is both used for display name and key value name in data.

          <RadioGroup title="Radio Group" name='myRadio'>
              <Radio value='A' />
              <Radio value='B' />
              <Radio value='C' />
          </RadioGroup>

      props: [name, title, value]

    • SettingsPanel

      SettingsPanel component is the main parent layout component to handle all the settings. You have unique props to change the color and handle the data you will get fromt he settings. onSubmit is a function call that passes data from settings when the submit button is clicked.

          handleSubmit = (data) => console.log(data)
          ...
          <SettingsPanel
              color={'#728ad8'}
              onSubmit={this.handleSubmit}>
          >
              ...
          </SettingsPanel>

      props: [color, onSubmit]

    • Toolbar

      Toolbar is a component in working development. As of right now it displays a navbar on top with the title settings. In the future this will be customizable with added props, buttons and other functionalities. Output: screenshot3


Note

All components must be child of parent component All components have an 'onChange' prop name prop acts as a unique key for your data. You should keep your names unique.


Tech

  • React - A JavaScript library for building user interfaces
  • UIKit - A lightweight and modular front-end framework.
  • node.js - evented I/O for the backend
  • webpack - A bundler for javascript and friends.
  • MobX - Simple, scalable state management.

React-Settings-Panel is open source with a React-Settings-Panel on GitHub. @yamoshotto

Development

Run:

$ npm start |or| $ yarn start

Todos

  • Write MORE Tests
  • Add Night Mode

License

MIT