Trying to write a file upload component

Hi all,

I am trying to create a live component in Phoenix Storybook that show previews of files uploads.
I did read this: Uploads — Phoenix LiveView v0.18.16

Is there a way to call allow_uploads/3 from my story file?

Thank you

1 Like

You can’t do it from a regular component story, but it’s possible from an example story.

https://hexdocs.pm/phoenix_storybook/PhoenixStorybook.Story.html#module-example

Here is our own uploader’s story: Phenix Storybook - File Upload (you will notice it’s not accepting upload)

And an example with a functional uploader: Phenix Storybook - Form

1 Like

Thanks a lot, that explains well!

Kudos for the project

1 Like

BTW If I name the example story file my_example.exs (as noted in the docs), the page is not showing up.
If I rename it to my_example.story.exs it shows up.

I don’t know if that is intended, or I am making any mistake.

Also here, the file is named forms.story.exs:

This is a typo in the doc! I’ll get it fixed

1 Like