Skip to content
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

Set up default examples for components #108

Open
andyearnshaw opened this issue Mar 23, 2017 · 0 comments
Open

Set up default examples for components #108

andyearnshaw opened this issue Mar 23, 2017 · 0 comments

Comments

@andyearnshaw
Copy link

andyearnshaw commented Mar 23, 2017

I was thinking of using BlueKit as an interactive documentation tool for an internally-used library of components. However, many components look plain or completely blank until props/children are set, or the description isn't sufficient to describe how the component should work.

To this end, I think it would be useful if I could write examples in the JSDoc comments, with the first example being the default-display for the component within BlueKit. Something along the lines of:

/**
 * Renders a button.
 * 
 * @example Rounded corners
 * <Button style="rounded" onClick={ () => alert('clicked') }>
 *   Press me
 * </Button>
 *
 * @example No background
 * <Button style="ghost" onClick={ () => alert('clicked') }>
 *   Press me
 * </Button>
 */

That's a simple demonstration of what I mean, these examples would allow default children and props to be defined for the initial display of a component. The text after @example would be added to a select box, with the content up until the end or next @ tag being used to pre-populate the props/children.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant