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

material-ui-expandable-text-field

v0.0.2

Published

Material-UI Expandable TextField is a React-Redux component that uses Material-UI to create a Expandable TextField

Downloads

18

Readme

Material-UI Expandable TextField

Table of Contents

Description

Material-UI Expandable TextField is a React-Redux component that uses Material-UI to create a Expandable TextField.

The main reason to use only containers and not prepared TextFields with this behavior is that you can now change the style of the TextField and the IconButtons as you like. You can also use other components to hide and display them on click events.

You can also place the Button and the TextField in seperate places. They bound only by the same id you give them.

You can try it out the DEMO.

Installation

This project can be istalled as npm module using following command:

npm i -S material-ui-expandable-text-field

Usage

Preparation

Material-UI

For this project components to work in your application after the npm installetion you have to be shure that everithing is correctly setup for Material-UI to work. You can find more about that here.

Reducers

No mather where you store your reducers the project components need access to a specific reducer and its state. For that we add to our reducers index.js file where we compine all our reducers the following two reduces:


import { combineReducers } from 'redux';
import {expandableTextFields} from 'material-ui-expandable-text-field';

const reducers = combineReducers({
  expandableTextFields
})

export default reducers;

That are the points we have to do before using this module in our application.

Examples

The module contains of two main parts:

  • ExpandableTextFieldContainer the container in witch we set our TextField
  • ETFIconButtonContainer the container in witch we set our IconButtons witch triggeractions

All can be imported like this:


import {
  ExpandableTextFieldContainer,
  ETFIconButtonContainer
} from 'material-ui-expandable-text-field'

All of them are just containers in witch you can put all your other application components:


<div>
<ETFIconButtonContainer
  value={true}
  hideOnOpen={true}
  id={'1'}>
  <ActionSearch/>
</ETFIconButtonContainer>
<ETFIconButtonContainer
  value={false}
  hideOnClose={true}
  id={'1'}>
  <NavigationClose/>
</ETFIconButtonContainer>
<ExpandableTextFieldContainer id={'1'}>
  <TextField
    floatingLabelText={'Text field with autofocus'}
    ref={(ref) => {if(ref!=null){ref.focus()}}}
    id={'1'}
  />
</ExpandableTextFieldContainer>
</div>

NOTICE: - both of those components need the propertie id to colaborate corectly. Each TextField witch is in a ExpandableTextFieldContainer should have a diferent id.

You can also import the Actions from the module to trigger them when you want and without the prepared containers.

The actions available in this module are: setIsETFOpen, toggleETF.

We can import them from the module like this:


import {
  ExpandableTextFieldContainer,
  ETFIconButtonContainer,
  setIsETFOpen,
  toggleETF
} from 'material-ui-expandable-text-field'

An complete example with all the actions called can be found in the App.js of the demo part of this project.

Properties

ExpandableTextFieldContainer:

  • id - (string) required - the id with witch we identify witch containers act together

ETFIconButtonContainer:

  • id - (string) required - the id with witch we identify witch containers act together
  • value - (boolean) optional - if you set it to true the button will only make the TextField visible. If it is false it can only hide the TextField and if you don't set a value the ETFIconButtonContainer will act as a toggler for the TextField visibility.
  • hideOnOpen - (boolean) opetion - if true the botton will hide when the TextField is open
  • hideOnClose - (boolean) opetion - if true the botton will hide when the TextField is closed
  • closeOthers - (boolean) opetion - if true by clicking the button all other open ExpandabldeTextFields will closeOthese
  • onETFChange - (function) opetion - a callback function that will be triggered on TextField visibility change

Contributing

Every help no mather if it is a kritik, suggestion or pull request is welkome :)