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 🙏

© 2025 – Pkg Stats / Ryan Hefner

material-ui-address-input

v0.4.0

Published

A customisable address input component for Material-UI.

Readme

material-ui-address-input

Build Status NpmVersion JavaScript Style Guide

This component is an address picker component for Material-UI.

Demo

Installation

npm install --save material-ui-address-input

Note: material-ui-address-input only supports Material-UI 1.0.0 or later. There is not planned support for Material-UI 0.x. If you are using an earlier version of Material-UI, you should consider upgrading to v1.

Usage

The component only supports controlled input at the moment.

import React, {Component} from 'react'
import AddressInput from 'material-ui-address-input'

class ControlledAddressInput extends Component {
    constructor (props) {
        super(props)
        this.state = {
            address: '',
            addresses: []
        }
    }

    handleAddAddress = address => {
        this.setState({
            addresses: [...this.state.addresses, address]
        })
    }

    handleChangeAddress = addressIndex => {
        this.setState({
            address: addressIndex
        })
    }

    render () {
        return (
            <AddressInput
                onAdd={this.handleAddAddress}
                onChange={this.handleChangeAddress}
                value={this.state.address}
                allAddresses={this.state.addresses}
            />
        )
    }
}

export default ControlledAddressInput

Props

| Name | Type | Default | Description | | --- | --- | --- | --- | | addressLabels | shape | { houseNameNumber: 'House Name/Number', addressLine1: 'Address Line 1', addressLine2: 'Address Line 2', city: 'City', region: 'State/Province/Region', zip: 'ZIP/Postal Code', country: 'Country' } | Custom labels to display when the user creates a new address. Note that if you wish to use custom labels you must specify each of the labels. | | addressResolver | func | | If specified, the component will offer the user a choice to find their address automatically given their house name/number and zip/postal code (and their country if displayCountry is set to true). When the user types in this information and clicks 'Find Address', this function will be called. This function should add the resolved address and change the value of this component to correctly input the new address. Signature: function(houseNameNumber: string, zip: string, country: string) => void | | allAddresses* | array | | Array containing all of the address objects that the user can choose from. Addresses should be of the form {addressLine1: string, addressLine2: string, city: string, region: string, zip: string, country: string} | | disabled | bool | false | If true, the label, input and helper text should be displayed in a disabled state. | | displayCountry | bool | true | Whether the address selector should allow users to choose their country. Often disabled if your application typically has users from a single country. | | error | bool | | If true the address dropdown will be in an error state and appear red. | | helperText | node | | The helper text content | | id | string | 'address' | The id to be passed to the select element. | | label | string | 'Address' | The label to be shown on the address picker component. | | margin | enum: 'none' | 'dense' | 'normal' | 'none' | If dense or normal, will adjust vertical spacing of this component. | | name | string | 'address' | The name to be passed to the select element. | | native | bool | false | If true, a native <select> element will be rendered. | | onAdd* | func | | Callback that is fired when the user adds a new address. This function should add the new address to the allAddresses prop. The function is called with a single parameter address with the following shape: address: {addressLine1: string, addressLine2: string, city: string, region: string, zip: string, country: string} | | onChange* | func | | Callback that is fired when the user changes the active address using the dropdown box. There is a single parameter addressIndex which represents the index in the array of all addresses that the selected address represents. | | required | bool | false | If true, the label will indicate that the user must select an address from this component. Note that HTML5 validations for this feature only work with native set to true. | | value*| union: string | number | | The index of the selected address in the array of all addresses. If you desire 'no address selected', then value should be the empty string ''. |

Contributing

PRs are welcome! :tada: