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-drip-form-material-ui

v0.0.1

Published

Material-UI component set for react-drip-form.

Downloads

26

Readme

react-drip-form-material-ui

Build Status Codecov npm version

Material-UI component set for react-drip-form.

https://tsuyoshiwada.github.io/react-drip-form-material-ui/

Table Of Contents

DEMO

Screenshot

See Live Demo.

Getting Started

Installation

react-drip-form must also be installed.

$ npm install --save react-drip-form
$ npm install --save react-drip-form-material-ui

Usage

import React from 'react';
import { dripForm } from 'react-drip-form';
import MenuItem from 'material-ui/MenuItem';
import RaisedButton from 'material-ui/RaisedButton';
import {
  AutoComplete,
  Checkbox,
  DatePicker,
  FieldGroup,
  RadioButton,
  SelectField,
  Slider,
  TextField,
  TimePicker,
  Toggle,
} from 'react-drip-material-ui';


export default dripForm({/* form options */})(({ handlers }) => (
  <form onSubmit={handlers.onSubmit}>
    {/* TextField */}
    <TextField
      name="title"
      label="Title"
      floatingLabelText="Title"
      hintText="Enter title"
    />

    {/* TextField (multi line) */}
    <TextField
      name="description"
      label="Description"
      multiLine
      rows={4}
      rowsMax={10}
      floatingLabelText="Description"
      hintText="Enter a description"
    />

    {/* Select field */}
    <SelectField
      name="library"
      label="Library"
      floatingLabelText="Library"
    >
      <MenuItem value="react" primaryText="React" />
      <MenuItem value="angular" primaryText="Angular" />
      <MenuItem value="vue" primaryText="Vue" />
    </SelectField>

    {/* Checkbox with FieldGroup field */}
    <FieldGroup
      multiple
      name="category"
      label="Category"
    >
      <Checkbox value="cat1" labelText="Category 1" />
      <Checkbox value="cat2" labelText="Category 2" />
      <Checkbox value="cat3" labelText="Category 3" />
    </FieldGroup>

    {/* Radio with FieldGroup field (default value = 'private') */}
    <FieldGroup
      name="status"
      label="Status"
      value="private"
    >
      <RadioButton value="private" labelText="Private" />
      <RadioButton value="public" labelText="Public" />
      <RadioButton value="draft" labelText="Draft" />
    </FieldGroup>

    {/* Date Picker */}
    <DatePicker
      name="releaseDate"
      label="Release Date"
      floatingLabelText="Release Date"
      hintText="Select release date"
    />

    {/* Time Picker */}
    <TimePicker
      name="releaseTime"
      label="Release Time"
      floatingLabelText="Release Time"
      hintText="Select release time"
    />

    {/* Slider */}
    <Slider
      name="rating"
      label="Rating"
      min={0}
      max={100}
      step={1}
    />

    {/* Toggle */}
    <Toggle
      name="confirm"
      value="yes"
      label="Confirm"
      labelText="I agree to the Terms of Use"
      labelPosition="right"
    />

    <RaisedButton
      primary
      label="Submit"
      onClick={handlers.onSubmit}
    />
  </form>
));

For actual use, demo/components/SampleForm.js source code may be helpful!

API

Almost the Material-UI API can be used as it is except that name prop is mandatory.
I will explain the differences from the Material-UI API here.

shouldDisplayError

This function accepts the properties of the field and makes a decision whether to display an error.
If you want to display an error you need to return true.

By default the following code is used.

({ meta }) => !!(meta.error && meta.dirty && meta.touched)

Change label to labelText

In react-drip-form, label is a property with special meaning.
Therefore, rename the label attribute that can be specified with <Toggle /> etc. to labelText.

<Toggle
  name="confirm"
  value="yes"
  label="Confirm"
  labelText="I agree to the Terms of Use"
  labelPosition="right"
/>

errorLabelStyle

The following components control error labels by react-drip-form-material-ui.
You must use errorLabelStyle to customize the style of error labels.

  • <Checkbox />
  • <DatePicker />
  • <FieldGroup />
  • <RadioButton />
  • <Slider />
  • <TimePicker />
  • <Toggle />
<DatePicker
  name="releaseDate"
  errorLabelStyle={{
    // your custom style
    color: 'hotpink',
  }}
/>

Related projects

Contribute

  1. Fork it!
  2. Create your feature branch: git checkout -b my-new-feature
  3. Commit your changes: git commit -am 'Add some feature'
  4. Push to the branch: git push origin my-new-feature
  5. Submit a pull request :D

Bugs, feature requests and comments are more than welcome in the issues.

License

MIT © tsuyoshiwada