Partial previewer

It would be super handy to be able to preview view templates/partials with multiple scenarios in one page.

It would help design reviews, harmonize components, enable a style guide.

3 Likes

Super interesting!

This is like your i18n feature idea, it seems like a lot of other folks might find it valuable but like trying to get it added to Rails core would take enough consensus process that it might be worth making as a standalone Rails Engine first.

Do you have the bandwidth to implement what you want, or even just to wireframe it?

ViewComponents has previews in the Rails conductor:

2 Likes

I’d love to see ViewComponent merged into Rails one day. Since I’ve started using it I’ve been using partials less and less, improving the whole reusability of my views. Not that it’s not possible with partials, but it just feels way more organized and easier to build following a component structure

2 Likes

They are part of rails 6.1

Just adding to what everyone has already said, although not exactly for partials, the ViewComponents coming in 6.1 will have a way to preview the components, in the same way we have for Mailers.

See this video from Rails Couch Edition for an example:

1 Like

As far as I know ViewComponent will not be available in rails 6.1: Renaming to ViewComponent, Syntax Changes · Issue #206 · github/view_component · GitHub

What will be available in 6.1 is the ability of using external component libraries like ViewComponent: Introduce support for 3rd-party component frameworks by joelhawksley · Pull Request #36388 · rails/rails · GitHub

:cry:

3 Likes

Cool idea! I’d love to have something like Storybook for developing a ViewComponent or partial. Would be great for iterating on UI designs.

There is some work in progress to integrate view_component with Storybook :slightly_smiling_face: GitHub - jonspalmer/view_component_storybook: ViewComponent previews and testing in Storybook

2 Likes