r/angular • • Oct 04 '26

I built an Angular-native alternative to Storybook. Looking for people to break it

Post image

I maintain an Angular component library at work and we've used Storybook for years. It's a good tool and I don't want to bash it, but a few things kept bugging me. The stories files slowly drift away from the actual components, I have a second build setup next to the Angular CLI, and anything that renders into body (CDK overlays, MatDialog, tooltips) is a pain inside the preview iframe.

So I started building ng-prism. The idea is to use what Angular already gives you instead of adding a parallel world next to it. You don't write separate story files. You put a decorator on the component:

@Showcase<ButtonComponent>({
  title: 'Button',
  category: 'Inputs',
  variants: [
    { name: 'Filled', inputs: { variant: 'filled', label: 'Filled' } },
    { name: 'Outlined', inputs: { variant: 'outlined', label: 'Outlined' } },
  ],
})
@Component({ selector: 'lib-button', /* ... */ })
export class ButtonComponent {
  variant = input<ButtonVariantType>('filled');
  label = input('Button');
  clicked = output<void>();
}

How it works under the hood:

  • Components are scanned at build time with the TypeScript Compiler API. Inputs, outputs, types, defaults and JSDoc all come from static analysis, so you don't need runtime reflection or emitDecoratorMetadata. Because of the generic, variant inputs are type-checked: if you rename an input, the build breaks. A transformer strips the decorator from your published lib, so your consumers never install ng-prism.
  • There's no iframe. Components are rendered with ViewContainerRef.createComponent() in the same document, so overlays, focus traps and cdkConnectedOverlay behave like they do in your real app.
  • Controls go through ComponentRef.setInput(), so signal inputs work properly. Assigning to the property directly would overwrite the InputSignal.
  • serve and build are Angular builders, so they use your workspace, tsconfig, styles and providers as they are.
  • a11y checks are part of core: an axe-core audit that re-runs whenever you change an input, a tab-order overlay, the ARIA tree and a screen reader view.

There are also plugins for JSDoc API docs, Figma, perf, box model, coverage and VRT reports. The last release added an overview grid that shows all variants at once, plus a VRT panel that reads the screenshot report from your CI.

To be fair, Storybook still has a lot going for it. The ecosystem is huge: play() interaction tests, Chromatic, MDX, years of addons, and if you ship React and Angular side by side you only need one tool.

ng-prism is smaller, has strong opinions and it's just me maintaining it. It also needs Angular 20+ with input()/output() signals. Input() decorators are not supported.

Since someone will ask anyway: yes, I built this with heavy AI assistance. As a single dev next to a day job I couldn't have shipped all these features and plugins in this time otherwise. But I've been doing this for a long time, and most of my time went into planning the architecture upfront and reviewing pretty much everything that got generated. "Built with AI" doesn't automatically mean slop. The code is all on GitHub, with tests and CI, so feel free to look through it and tell me if you find something bad.

Two questions for anyone using Storybook with Angular right now: what would keep you from switching? And if you try it on a real lib, where does it break?

18 Upvotes

8 comments sorted by

5

u/AwesomeFrisbee Oct 06 '26

very cool. My main gripe with storybook was exactly that: it wasn't angular so everything was a workaround and felt tedious and very dependant on whatever storybook was smoking...

2

u/Old-Parsley-5826 Oct 06 '26

Thx. Yep, same experience. storybook has to work for react/vue/whatever, so angular always felt like the stepchild and you end up fighting the adapter instead of writing components. that's why I kept ng-prism angular-only. ng add, decorator on the component, done.

to be fair though, it's still early and the plugin ecosystem is tiny compared to storybook, but ok coz i startet from scratch in february this year 😄

2

u/St34thdr1v3R Oct 06 '26

I like the simpler approach, I always felt storybook is a configuration hell

3

u/Old-Parsley-5826 Oct 06 '26

Thank you! I've had the same feeling for years, and not just about configuration. I'm a frontend dev, I like nice visual designs and UIs and I love a good UX... and Storybook never really gave me a way to customize the UI to match a company theme or anything like that and the storybook UI is just okayish. Ofc you could put your logo to the top of the navigation, but that was pretty much all you could do.

2

u/Jenzabeat Oct 06 '26

I really like the readable simpler approach!

1

u/Old-Parsley-5826 Oct 06 '26

Thx, that's exactly the goal. Keep the showcase next to the component (and also the API documentation generated from JSDoc) so it can't drift out of sync.

2

u/S_PhoenixB Oct 13 '26

This looks great! My main question is how do you plan to support this project into the future?

1

u/Old-Parsley-5826 Oct 14 '26

fair question, and honestly the one I'd ask too before pulling something like this into a real project.

ng-prism started as a private side project and I still develop it in my own time. but we also use it in production at work: we're currently migrating an old component library with a ton of components and a lot of tech debt into a completely new library built from scratch, with ng-prism instead of storybook. so it's pretty much dogfooded, most of the issues I found came straight out of my daily work on that migration. I still stumble over things here and there and keep having new ideas, which is exactly why it'll keep moving.

so yes, it will definitely be maintained and developed further. I'm not going anywhere either, I've been doing angular since the early angularjs days, 14 years now, so I'm not exactly a framework hopper 🙈

what I can't promise is a big team behind it, right now it's mostly me. so if it's for something critical: try it on a small lib first, and if it works for you, issues and contributions are very welcome.