Coder Social home page Coder Social logo

badoet / react-mdl-extra Goto Github PK

View Code? Open in Web Editor NEW

This project forked from hribb/react-mdl-extra

0.0 2.0 0.0 843 KB

React MDL Extra components

Home Page: https://hribb.github.io/react-mdl-extra/?down=0

License: MIT License

JavaScript 79.56% CSS 18.83% Shell 1.61%

react-mdl-extra's Introduction

React-MDL SelectField

This project is not maintained anymore. If someone wishes to take over, let me know ;)

Extra components for React Material Design Lite.

All components use a custom Dropdown, that uses react-portal to render itself to document body, and Tether for positioning.

Installation

npm install --save react-mdl-extra

Examples

https://hribb.github.io/react-mdl-extra/?down=0

git clone https://github.com/HriBB/react-mdl-extra
cd react-mdl-extra
npm install
npm run storybook
open http://localhost:9002/

Usage

Dropdown

import { Dropdown } from 'react-mdl-extra';

<Dropdown target={<Button>Open</Button>} align={'tl bl'} offset={'0 10px'}>
  <div className={'custom-menu'}>
    ...
  </div>
</Dropdown>

SelectField

import { SelectField, Option } from 'react-mdl-extra';

<SelectField label={'Select me'} value={3}>
  <Option value={1}>One</Option>
  <Option value={2}>Two</Option>
  <Option value={3}>Three</Option>
  <Option value={4}>Four</Option>
  <Option value={5}>Five</Option>
</SelectField>

MultiSelectField

import { MultiSelectField, Option } from 'react-mdl-extra';

<MultiSelectField label={'Select me many times'} value={[1,3]}>
  <Option value={1}>One</Option>
  <Option value={2}>Two</Option>
  <Option value={3}>Three</Option>
  <Option value={4}>Four</Option>
  <Option value={5}>Five</Option>
</MultiSelectField>

Menu

import { Menu, MenuItem } from 'react-mdl-extra';

<Menu target={<Button raised>Open menu</Button>}>
  <MenuItem>One</MenuItem>
  <MenuItem>Two</MenuItem>
  <MenuItem>Three</MenuItem>
</Menu>

AutoComplete

import { AutoComplete } from 'react-mdl-extra';

const items = [
  { id: 1, name: 'Darth Vader' },
  { id: 2, name: 'Luke Skywalker' },
  { id: 3, name: 'Obi Wan Kenobi' },
]

<AutoComplete
  label={'I will complete you'}
  items={items}
  valueIndex={'id'}
  dataIndex={'name'}
/>

Positioning Dropdown

See tether. Uses shorthand declaration. First two letter are the attachment property, followed by a space and second two letters, which are the targetAttachment property.

Examples:

align="tl bl"

Attach top left edge of the dropdown to the bottom left edge of the target.

align="br tr"

Attach bottom right edge of the dropdown to the top right edge of the target.

TODO

  • Split Dropdown into a separate component
  • Use native controls on mobile
  • Improve AutoComplete on mobile
  • Improve styles and remove sass
  • Improve position declaration
  • Create MultiSelectField
  • Create AutoCompleteField
  • Create DatePickerField
  • Key and focus handling
  • Add tests

react-mdl-extra's People

Contributors

aredhelrim avatar hribb avatar shanehughes3 avatar wyattjoh avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.