-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
Suggestion: a configuration option to render props below examples #687
Comments
I’d rather change the default view than add one more option. But I’d like to hear other opinions. /cc @okonet @SaraVieira |
@sapegin I think the issue here is you will always have people that want them in specific order. Like, for example, I prefer the way you have it today than this. I would not like this change as the default personally. Maybe you could just make it a config array so you could put them in any order in a custom array and it would output in that order you specify. Something like |
You can already do this by overriding a component. Maybe it would be better to make this simpler. |
This makes sense but I think what makes even more sense is to make those props interactive somehow. Probably this is something that should be evaluated after the plugin API is done? |
It's an interesting feature, but putting the props table after the examples can have a downside: if there are many examples, it makes it easier to completely miss it. In my usage of RSG, I often show a very simple use case of the component, add a bit of text, and then add several examples displaying roughly all possible combinations of props. If the props table was at the end, some people might not see it. But I do hear your point on showing what it looks like before giving the full spec. Having a way to simply configure the order in which these sections appear is interesting. Slightly unrelated question, is there a way to show the props table by default (currently hidden by default)? |
Looks like we shouldn’t change default order. So I’d suggest to make |
Came here to start exactly this discussion 😄
|
I'm going to close this for now, but may revisit in the future. |
Today, prop definitions are rendered above usage examples, and I think this arrangement makes it slightly more difficult for a new reader to understand how the component is supposed to be used, because it is difficult to put props and their values into proper context without seeing the final result (the live example) and seeing what it does. If you don't know a component well and it uses some special terminology to describe itself (like "top bar", "bottom bar") then it won't make much sense to you until you see the live component. Therefore, I think that reversing this order (optionally?) so that the examples are put above props would be a UX improvement.
I'd like to use this repo's own README file as a demonstration of my point: the gif is placed above documentation links because a picture is worth a thousand words, and it conveys the concept of what react-styleguidist is and what it does is in a very compact and efficient way. I think the same idea could be applied to components as well.
Another demonstration would be a typical MDN page: an example of what Array.slice() does is put above its syntax.
Before:
After:
The text was updated successfully, but these errors were encountered: