onefinestay / react-choice

Other
26 stars 8 forks source link

New api #16

Closed jkimbo closed 9 years ago

jkimbo commented 9 years ago

Changed the structure so that it is more semantic. Now you build a select component like this:

<Choice.Select>
  <Choice.Option value="foo">Foo</Choice.Option>
  <Choice.Option value="bar">Bar</Choice.Option>
</Choice.Select>
<Choice.SelectMultiple>
  <Choice.Option value="foo">Foo</Choice.Option>
  <Choice.Option value="bar">Bar</Choice.Option>
</Choice.SelectMultiple>
Pita commented 9 years ago

How do I use my own renderer here? Is it a child of Choice.Option?

jkimbo commented 9 years ago

No you just replace the option with your own react component. Also long as it has the same api (i.e. a value prop and child text) it should work.

AndrewIngram commented 9 years ago

I think Option should make use of an OptionMixin that defines most of the core API for an option.