Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Select should have a value prop #1286

Open
photz opened this issue Feb 23, 2019 · 4 comments
Open

Select should have a value prop #1286

photz opened this issue Feb 23, 2019 · 4 comments
Milestone

Comments

@photz
Copy link

photz commented Feb 23, 2019

In plain Preact you can choose which option of a select element should be selected like this:

<select value="2">
  <option value="1">Foo</option>
  <option value="2">Bar</option>
</select>

Unless I've missed something, then the Select component in this package only lets you set the selected option by either setting the selectedIndex prop of Select itself or using the selected prop of Select.Item.

I think it would make sense to let Select behave like a regular select in this regard, what do you think?

@cromefire
Copy link
Collaborator

If I'm correct, this is a current limitation by mdc or does this work with plain html?

@prateekbh
Copy link
Owner

Currently selectedIndex prop is an equivalent to value prop

@cromefire
Copy link
Collaborator

Well selectedIndex takes an index not a value

@prateekbh
Copy link
Owner

ah gotcha... sorry was attention was divided back then

Lets keep this for 2.0?

@cromefire cromefire added this to the 2.0 milestone Feb 25, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants