-
-
Notifications
You must be signed in to change notification settings - Fork 32.3k
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
Deprecate usage of JSON in favor of composability. #2456
Comments
The one concern I would have is that, particularly for components such as selectField, TypeAhead etc, the data is often generated programmatically (from database, API etc), so having to compose with children would require extra code in every app that is currently handled by the components. The reason for requiring objects is that the items often require other attributes than just a label (some kind of reference for example). I would propose:
(In fact, standardising API naming in general across components would be a good long-term objective to add to the roadmap. ) |
@mbrookes The extra code would only be a but isn't this prettier: <SelectField value={...} onChange={(value, payload) => {/**/}}>
{data.map(d =>
<SelectItem key={d.id} value={d.id} payload={d.name /*or d itself*/} label={d.fullname} style={...} />
)}
</SelectField> You can even nest children inside the If we also support JSON objects then how will they be ordered? how will they look like? With typeahead I haven't come up with a solution yet. That might better work with templates or something. But that component is still new, it's better to leave it as is and have the community field test it and provide feed back. then we'll decide :D |
Okay, I"m sold. :D |
Dupe of / resolves #27 |
Many components (
Dialog
,SelectField
,DropDownMenu
,LeftNav
) still have props likemenuItems
,items
,actions
, etc... that a a JSON object. these should either take an array (or single) component or be removed in favor of children.TODO:
Dialog
: deprecate actionJSON - Addressed in [Doc] Convert Dialog to use the new standard. #2483SelectField
: see [SelectField] Composeable Items. #2380 Addressed in [Docs] migrate select-field to the new standard #2694DropDownMenu
: same asSelectField
Addressed in [Docs] [DropDownMenu] [Composable] Migrate to new standard #2565LeftNav
: deprecatemenuItems
- Addressed in [Doc] Convert LeftNav to use the new standard. #2507@oliviertassinari and @shaurya947 please give me your feedback on this.
The text was updated successfully, but these errors were encountered: