question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Input field examples

See original GitHub issue
  • downshift version: 1.23.2
  • node version:
  • npm (or yarn) version:

Are there any examples where we need to have some more control over the input field or where the control functions like react-select.

A few things that I’m trying to achieve that I’m not able to figure out from the examples/documentation.

The input field should already be populated with a value when the control is first shown. When the user clicks in the input field, I would like the menu to open, the existing text/value should be removed and the cursor placed at the beginning of the input for the user to filter the full list. If the user cancels after typing some text, the existing value still stays, if the user types then the list filters.

I am able to get the list to open when the user clicks the input field, however when I try to pre-populate a value using the inputValue prop, I can no longer do anything in the input field.

Any ideas/examples on how to achieve something like this?

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:9 (4 by maintainers)

github_iconTop GitHub Comments

6reactions
JofArnoldcommented, Jan 14, 2018

Opinionated side-note: if you’re going controlled I recommend you only use onStateChange and completely take control of Downshift’s internal state. I’ve saved myself a lot of headaches this way. For instance, if you want to clear a selection you’ll need to clear all of selectedItem, inputValue, highlightedIndex or the next time you type Downshift may end up reverting to internal state for selectedItem and the result will be confusing.

1reaction
mshaw-nmcommented, Jan 10, 2018

Sure, I would have to clean up the example that I have since it was for a work project.

Read more comments on GitHub >

github_iconTop Results From Across the Web

HTML Input Types - W3Schools
This chapter describes the different types for the HTML <input> element. HTML Input Types. Here are the different input types you can use...
Read more >
101 Input Field Design Inspiration - HTML & CSS Snippets Ξ ...
101 input-field UI Design Examples​​ From the humble text field to radio buttons these input fields are the building blocks of any forms...
Read more >
HTML Form Input Types - Javatpoint
In HTML <input type=" "> is an important element of HTML form. The "type" attribute of input element can be various types, which...
Read more >
Text fields - Material Design
Icon signifiers can describe the type of input a text field requires, and be touch targets for nested components. For example, a calendar...
Read more >
<input>: The Input (Form Input) element - HTML
There is an example in the next column, but it's hidden! ... in the same input field, but more complex forms of autocomplete...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found