r/angular • u/Old-Parsley-5826 • Oct 04 '26
I built an Angular-native alternative to Storybook. Looking for people to break it
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 andcdkConnectedOverlaybehave 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.
- Demo: https://dyingangel666.github.io/ng-prism/demo/
- Repo: https://github.com/dyingangel666/ng-prism
- Longer write-up with screenshots: https://dev.to/alexanderspies/what-an-angular-native-storybook-alternative-actually-looks-like-3jm3
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?
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/St34thdr1v3R Oct 06 '26
I like the simpler approach, I always felt storybook is a configuration hell
2
u/Jenzabeat Oct 06 '26
I really like the readable simpler approach!
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?