Closed robbinjanssen closed 7 years ago
Hey!
Did you try items: P.constant([<Item ... />, <Item ... />])
?
@rpominov thanks! That works 👍 Only rendering of the demo code looks a bit messy:
input:
<Demo
target={PageHeader}
props={{
title: P.string('This is a page header'),
actions: P.constant([
<button className="btn btn-primary">One</button>,
<button className="btn btn-default">Two</button>,
]),
}}
/>
Output:
<PageHeader
title="This is a page header"
actions={[<button
className="btn btn-primary"
>
One
</button>, <button
className="btn btn-default"
>
Two
</button>]}
className={false}
/>
Is there something that I can do to make it look more natural/pretty?
I think codeIndentDepth is responsible for that. Although not sure. Try to do something like this:
<Demo
codeIndentDepth={2}
target={PageHeader}
props={{
title: P.string('This is a page header'),
actions: P.constant([
<button className="btn btn-primary">One</button>,
<button className="btn btn-default">Two</button>,
]),
}}
/>
Try to play with codeIndentDepth
value.
@rpominov thanks I'll give it a go!
Hi,
I'm trying to figure out how to provide an array of components as a property, for example I have a component:
Item.js
Group.js
How would I demo this? I've tried: