Snippets

Edwin Marshall SmartInput Props

Created by Edwin Marshall
// free-form input
var inputProps = {
    // initial value will be grabbed from state.from.bar.baz
    "source": ["from", "bar", "baz"],
    // when the component's value changes, it will be stored in state.to.bar.baz
    "inputKey": ["to", "bar", "baz"]
};

// input with top 10 history
var topTenProps = {
    // initial value is still grabbed from state.from.bar.baz
    "source": ["from", "bar", "baz"],
    // selected suggestion will be stored in state.to.bar.baz
    "inputKey": ["to", "bar", "baz"],
    // when the user types, sugggestions will pop up with values obtained from
    // state.history.bar.baz
    "suggestionsKey": ["history", "bar", "baz"],

};

// input with autosuggest values
var autoSuggestProps = {
    "source": ["from", "bar", "baz"],
    "inputKey": ["to", "bar", "baz"],
    "suggestionsKey": ["autosuggest", "bar", "baz"],
    // only input from suggestions will be stored
    "suggestionsOnly": true
};

Comments (0)

HTTPS SSH

You can clone a snippet to your computer for local editing. Learn more.