Skip to content

[docs] Move "TextField" section higher in the "Selects" page#17643

Merged
oliviertassinari merged 3 commits into
mui:masterfrom
croraf:docs-selects
Oct 29, 2019
Merged

[docs] Move "TextField" section higher in the "Selects" page#17643
oliviertassinari merged 3 commits into
mui:masterfrom
croraf:docs-selects

Conversation

@croraf

@croraf croraf commented Sep 30, 2019

Copy link
Copy Markdown
Contributor

Motivation: Using MUI a lot, but didn't even know TextField can be used for Selects. Always used the set of components (InputLabel, Select, helpercomponent). The small section in the bottom is not noticeable.

  • I moved to top along with "Simple Select" examples
  • reworded it a bit
  • added a comparison example (JS only)

@mui-pr-bot

mui-pr-bot commented Sep 30, 2019

Copy link
Copy Markdown

No bundle size changes comparing 05c533b...7be2f56

Generated by 🚫 dangerJS against 7be2f56

@croraf croraf changed the title [docs] Move TextField section in Selects and add comparison example [docs] Move "TextField" section within "Selects" page and add comparison example Oct 1, 2019
@oliviertassinari

Copy link
Copy Markdown
Member

What do you think of positioning the demo after the customization one? I strongly think that native should be before, promoting the customization before might be interesting too, we tend to keep these customization demos high in the order, they are frequently used and strategical for us.

},
}));

export default function ControlledOpenSelect() {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Component name doesn't match the file name.

</Select>
<FormHelperText>Select implementation</FormHelperText>
</FormControl>

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

blank line

@croraf croraf Oct 1, 2019

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I ran prettier and lint and got no errors. This blank line improves readability, although can be removed.

id="age-text-field"
label="Age"
helperText="TextField implementation"
SelectProps={

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would propose the removal of all the blank props from the example. A mention of SelectProps in the demo description could help.

@croraf croraf Oct 1, 2019

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think they are very nice and useful to have in the demo.

But prettier made it look like a mess. They were one per line as in the original commit and it looked so pretty :). Perhaps we can improve prettier as in codesandbox, where it contracts into single line where possible.
image

@oliviertassinari oliviertassinari added the docs Improvements or additions to the documentation. label Oct 1, 2019
@croraf

croraf commented Oct 1, 2019

Copy link
Copy Markdown
Contributor Author

What do you think of positioning the demo after the customization one? I strongly think that native should be before, promoting the customization before might be interesting too, we tend to keep these customization demos high in the order, they are frequently used and strategical for us.

I would keep the TextField stuff in the "Simple Select" chapter. If "Simple Select" is of lower priority than "Native" or "Custom" then move it bottom, but keep TextField in it. To me personally "TextField" api is the nicest, and I will use it the most. Native select element behaves strange in some cases.

@oliviertassinari

Copy link
Copy Markdown
Member

I believe we document the select mode in the dedicated text-field documentation page. Maybe we should avoid the duplication and only link a demo from select to text-field? cc @joshwooding

@joshwooding

Copy link
Copy Markdown
Collaborator

@oliviertassinari I agree - it doesn't seem like we need two demos for the same thing. We should probably keep them in the TextField section and make them more prominent like we are doing with the other demos under #17483

@croraf

croraf commented Oct 2, 2019

Copy link
Copy Markdown
Contributor Author

It is a bit messy that select is part of the TextField at all (especially because it says all over the TextField that it is for accepting user text input), and I think @joshwooding agrees from what I read in comment #17483 (comment).

I think the confusion comes from the material design specs, because in "Components" they don't have Select but only TextField https://material.io/components/text-fields which includes some select showcases.

But in develop they do have the Select component: https://material.io/develop/web/components/input-controls/select-menus/, https://material-components.github.io/material-components-web-catalog/#/component/select.

@oliviertassinari

Copy link
Copy Markdown
Member

Given the direction that #17483 is taking, I think that we will be able to update this pull request to something like this:

diff --git a/docs/src/pages/components/selects/selects.md b/docs/src/pages/components/selects/selects.md
index 59dc2b8ab..f7a636001 100644
--- a/docs/src/pages/components/selects/selects.md
+++ b/docs/src/pages/components/selects/selects.md
@@ -30,6 +30,10 @@ Once it's styled, you can either use it directly as a text field or provide it t

 {{"demo": "pages/components/selects/CustomizedSelects.js"}}

+## Text Fields
+
+The `TextField` wrapper component is a complete form control including a label, input and help text. You can find an example with the select mode [in this section](/components/text-fields/#select).
+
 ## Multiple Select

 The `Select` component can handle multiple selections.
@@ -48,7 +52,3 @@ Like with the single selection, you can pull out the new value by accessing `eve
 While it's discouraged by the Material Design specification, you can use a select inside a dialog.

 {{"demo": "pages/components/selects/DialogSelect.js"}}
-
-## Text Fields
-
-The `TextField` wrapper component is a complete form control including a label, input and help text. You can find an example with the select mode [in this section](/components/text-fields/#textfield).

Would it work for you guys?

@oliviertassinari

oliviertassinari commented Oct 13, 2019

Copy link
Copy Markdown
Member

@croraf I also have mixed feelings about the TextField importing the Select. It could have been better to have a SelectField component that bundles the other field components, à la TextField for the input type text.

@croraf

croraf commented Oct 13, 2019

Copy link
Copy Markdown
Contributor Author

@oliviertassinari If you are talking about removing <TextFied select/> and use new component SelectField instead, this was suggested in the original Issue #8270. This is a breaking change. Unfortunate is also that material-design TextField includes a select https://material.io/components/text-fields/#anatomy section Icons. Although they also have this section https://material.io/develop/web/components/input-controls/select-menus/

@oliviertassinari

Copy link
Copy Markdown
Member

Yes, it would be a breaking change. If the idea get tractions, it could make sense to explore it in the future, during the preparation of v5.

@oliviertassinari oliviertassinari changed the title [docs] Move "TextField" section within "Selects" page and add comparison example [docs] Move "TextField" section higher in the "Selects" page Oct 29, 2019
@oliviertassinari

oliviertassinari commented Oct 29, 2019

Copy link
Copy Markdown
Member

@croraf I have merged #17483, we could move forward with the changes. The key design decisions are 1. the text field support needs to be more visible; 2. we can link the text field demo, the fewer demos we have to maintain, the better. Thank you for raising our attention to this problem!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

docs Improvements or additions to the documentation.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants