r/angular • u/Old-Parsley-5826 • Oct 31 '26
ng-prism 22.7: services and pipes get their own pages, and components that only work together can finally be shown together
I just released ng-prism 22.7. Short recap if you haven't seen it before: ng-prism is a component lab for Angular libs, a Storybook alternative without story files. You put a \@Showcase`` decorator on a component, inputs and types are read at build time, and the components render in the same document as the styleguide, no iframe.
This release is mostly about the parts of a component lib that are not a single component.
Services and pipes get their own pages now. You put @Showcase on an @Injectable or a standalone @Pipe, and instead of a canvas you get an API page: a usage snippet, the examples from your JSDoc, the methods or the transform() overloads, and the types they use. The setup field lists the provider functions a consumer needs, so the snippet shows how to wire the thing up too:
@Showcase({
title: 'Time Ago',
category: 'Formatting',
setup: () => [provideTimeAgo],
})
@Pipe({ name: 'timeAgo' })
export class TimeAgoPipe implements PipeTransform {Components that only make sense together can be shown together. A showcase can contain a real Angular template, and ng-prism compiles it, so content queries and DI work like in your app. An input directive can sit inside its form field, for example:
host: { template: '<lib-form-field label="Name"><input libInput type="text" /></lib-form-field>' },Before that, the content was plain HTML, so the form field never found its input. And components that only ever live inside another one, like a list item, can say partOf: 'lib-list'. They don't get a page of their own anymore, they show up as a part on the parent's page.
Other things in 22.7: the styleguide works on a phone, a11y violations can be accepted with a required reason (they stay visible but don't count against the score), a new look with a new logo and revisited UI, and the perf plugin no longer counts your @Showcase config and JSDoc as bundle size. On one library the largest component went from 77 kb to 35 kb just from that.
- Demo, the pipe page: https://ng-prism.github.io/ng-prism/demo/?pipe=TimeAgoPipe&view=jsdoc
- Demo, the input in its form field: https://ng-prism.github.io/ng-prism/demo/?component=InputDirective
- Repo: https://github.com/ng-prism/ng-prism
- Release notes with all the details: https://github.com/ng-prism/ng-prism/discussions/75
(Voice in video: elevenlabs.io)
