blast icon indicating copy to clipboard operation
blast copied to clipboard

Ability to pass args to story as an array?

Open RobertByrnes opened this issue 3 years ago • 2 comments

Hi @mrtimbrook is this supported and I am missing something? I have been so far able to pass an array to the story so it registers in the controls addon effectively but only gets passed to the components blade as a bool?

RobertByrnes avatar Nov 29 '21 22:11 RobertByrnes

Hi. Yep, arrays are supported. Can you send over an example of one that's causing you an issue?

Does this work for you?

@storybook([
    'args' => [
        'testArray' => [
            'item1', 'item2', 'item3'
        ]
    ]
])

@foreach ($testArray as $item)
    <p>{{ $item }}</p>
@endforeach

mrtimbrook avatar Nov 29 '21 22:11 mrtimbrook

Will do...cheers

RobertByrnes avatar Nov 29 '21 22:11 RobertByrnes