weaveworks / ui-components

A collection of UI components that are shared across Weaveworks projects
http://weaveworks-ui-components.s3-website-us-west-2.amazonaws.com/
Apache License 2.0
30 stars 26 forks source link

Allow more complex data structures in dropdown `item.value` #398

Open guyfedwards opened 5 years ago

guyfedwards commented 5 years ago

Currently trying to set an items value as an object doesn't really work, keys become [Object object] among other things.

It would be great to be able to pass an items array such as:

items: Array<{
  value: {
    [string]: any
  } | string | number,  
  label: React.Node,
  id: string
}>

For clarity I think it would benefit from an additional property of id rather than trying to be clever with value/label as both of those should be able to be nodes

foot commented 5 years ago

Linked PR solves a different problem.