Starlight components documentation improvements #1938
Replies: 3 comments 1 reply
-
Pointed here from the Discord :) |
Beta Was this translation helpful? Give feedback.
-
Thanks for writing this up @HiDeoo and exploring the different options for structuring these pages. I agree with you that the “Usage and props” approach feels most promising. I think a “props reference” is definitely valuable to have (it’s one of the things I miss most in our current setup), but I think it can stick to the terser reference style we have elsewhere, without large examples etc., i.e. just focused on prop name, type, and a brief description. With then the usage section allowing us to more easily group and describe the common usage patterns. |
Beta Was this translation helpful? Give feedback.
-
The new components documentation is now available. |
Beta Was this translation helpful? Give feedback.
-
This discussion is a proposal to improve Starlight components documentation.
What is the problem?
At the moment, all the Starlight components are documented in a single page and some issues are present:
What is the proposed solution?
Following Chris's suggestion, a potential idea would be to move the components documentation to a dedicated sidebar group with the first page being an overview on how to use built-in components in Starlight and then have a page for each component.
Each component page would have a similar structure at the top of the page:
After that, I did some research on many design systems documentation and I found that multiple approaches could be taken.
Props approach
After the common section described above, this approach list all the props available for the component with a brief description of each one, include the type, default value if any, required or not. Then a code sample is shown for this specific prop with a visual example of the same code.
Usage and props approach
This approach starts with an “Usage” section with sub-sections for each use case of the component in plain English, e.g. “Sync tabs”, “Add icons to tabs”, etc.
Each sub-section would only contain a small description of the use case and a code sample with a visual example.
After that, a “Props” section would list all the props available for the component with a brief description of each one, include the type, default value if any, required or not and link to the sub-section in the “Usage” section where this prop is used.
Usage only approach
This approach is similar to the previous one but does not include a “Props” section. Instead, each sub-section in the “Usage” section would also contain the prop advanced information like type, default value, required or not in addition to the code sample and visual example.
Personal opinion
I am personally leaning towards the “Usage and props” approach as the usage section keeps the documentation friendly for newcomers and the props section provides a reference for more advanced users.
If you're looking for a specific use case, you can find it in the table of contents and if you're looking for a specific prop, you can also find it in the table of contents.
Links between the “Usage” and “Props” sections also make it easier to navigate between them.
Feedback
Any feedback on the proposed organization is welcome, especially if you have a preference for one of the approaches or if you have another idea on how to structure the documentation. Same goes if you have ideas of section that were missed or could be useful.
Note that the text itself in the screenshots is mostly placeholder so far and the structure is the main focus of this discussion.
Same goes for the code block + visual example design, which is mostly something quick I put together to illustrate the idea on how to emphasize that it's an example and not part of the documentation itself.
Participation
Beta Was this translation helpful? Give feedback.
All reactions