r/angular • • 23h ago

ng-prism 22.6: hover and focus aren't variants anymore, every variant in every state in one grid

Post image
5 Upvotes

I just released ng-prism 22.6. Short recap if you haven't seen it before: ng-prism is a component lab for Angular libraries, a Storybook alternative without story files. You put a u/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.

The main change this time is that hover, pressed and focus are no longer variants. In 22.5 I added a way to force :hover or :focus-visible on a variant, and pretty quickly the demo button had variants called "Hovered", "Pressed" and "Focus visible". They showed up in the Playground's variant list, kept the button hovered while you changed the controls, and only existed for the one variant somebody had written them for.

Now a component declares its states once and they get combined with every variant:

@Showcase<ButtonComponent>({
  title: 'Button',
  states: [
    { name: 'Hover', pseudo: { hover: '.btn' } },
    { name: 'Pressed', pseudo: { hover: '.btn', active: '.btn' } },
    { name: 'Focus visible', pseudo: { 'focus-visible': '.btn' } },
  ],
  variants: [ /* Filled, Outlined, Elevated, Disabled, … */ ],
})

The Overview then shows every variant in every state as a grid, and clicking a cell opens that combination in the Playground. The styling comes from your own CSS, ng-prism rewrites :hover so it also matches a helper class. A state only gets applied where the browser could actually produce it, so there's no focus ring on a disabled button and no hover on something with pointer-events: none. The cell tells you why it's empty instead.

In the Playground the states are buttons in the tools menu. They stay on when you switch variants and they're part of the URL. For visual regression there's a state= URL parameter, the render marker gets the state index, and a data-prism-excluded attribute tells the runner when a state doesn't fit. Without states nothing changes for existing runners.

Other things in 22.6: a Claude Code plugin (/plugin marketplace add ng-prism/ng-prism) that teaches agents how to write showcases and check them in the running styleguide, watch rebuilds down from about 450 ms to 60 ms, and fixes for aliased inputs and outputs, named content slots and libraries with only a primary entry point.

Question for anyone with their own component library: which states do your components need that a pseudo-class can't express? Drag-over, open, loading? I'd like to base the next step on real components rather than on my own guesses.


r/angular • • 10h ago

Angular 22 + Phaser + NgRx SignalStore = a multiplayer Bomberman in the browser

Post image
7 Upvotes

I've been building websites with Angular for years, but I had never built a game with it. So I tried.

https://detona.online/


r/angular • • 21h ago

Looking for UI library recommendations (headless preferred)

7 Upvotes

Up until last week, our team was building our systems using Java/JSP, Tailwind/SCSS, and plain vanilla JavaScript, taking inspiration from PrelineUI for complex components like modals, drawers, and comboboxes.

We’ve officially decided to make Angular our main frontend framework going forward, but we're at a crossroads regarding how to handle our component and design system architecture.

We are looking for a UI library that fits our workflow. Ideally, a headless library would be perfect since we want to keep full control over our custom Tailwind/SCSS styling, but we're open to other well-structured options.

Here is what we've looked at so far:

  • Spartan.ng: Looks amazing and fits our exact vibe, but management is unlikely to approve it given its current ecosystem/support overhead.
  • PrimeNG: Seems robust and feature-complete, but I've seen mixed reviews and criticism regarding its styling/theming overhead and weight.
  • Angular Material: While it's official, theme and style seems way out of date.

Given that we are coming from a Tailwind + PrelineUI background and moving into Angular, what libraries or setups would you recommend?