npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@eherve/angular-material-section-tabs

v22.4.0

Published

```sh npm install @eherve/angular-material-section-tabs ```

Readme

Angular Material Section Tabs

npm install @eherve/angular-material-section-tabs

Import SectionTabsModule in the host NgModule (or standalone component imports). Configure Angular animations in the host with provideAnimations() or BrowserAnimationsModule; tests can use NoopAnimationsModule. Angular, animations, Material/CDK 22 and RxJS 7.8 are peers. No Router provider is needed.

Declarative display

SectionTabsDisplayComponent (app-section-tabs-display) renders configured sections, cards and fields. Its public configuration interfaces are exported from the package root.

import {
  SectionTabsDisplayOptions,
  SectionTabsModule,
} from '@eherve/angular-material-section-tabs';

const display: SectionTabsDisplayOptions = {
  data: { name: 'Example', count: 0 },
  sections: [{
    id: 'details',
    label: 'Details',
    cards: [{
      id: 'general',
      label: 'General',
      grid: { columns: 2, gap: '12px', minColumnWidth: '220px' },
      fields: [
        { kind: 'text', label: 'Name', path: 'name' },
        { kind: 'number', label: 'Count', path: 'count', decimal: 0 },
      ],
    }],
  }],
};
<app-section-tabs-display
  [options]="display"
  queryParamKey="record-sections"
  [(selectedIndex)]="selectedIndex">
</app-section-tabs-display>

Configuration supports columns, gap, minColumnWidth, card and field spans and breaks, completion counters, label actions, card actions, chips, and custom field or card components. Custom component inputs are filtered to inputs declared by that component. sectionMode: 'single-card' makes cards fill and scroll within the section. Falsy values such as 0 and false count as filled; empty strings are treated as empty and can be revealed with showEmptyFields or its toggle.

HTML labels and values are bound through Angular's innerHTML sanitization. Ordinary strings remain sanitized; hosts may intentionally pass SafeHtml. The library does not bypass Angular sanitization.

Optional selection synchronization

queryParamKey and each section's queryParamValue are group and stable-value identifiers; they do not cause URL navigation. The optional SectionSelectionHandler provider synchronizes state. Without a handler, sections work locally.

import { Injectable } from '@angular/core';
import { BehaviorSubject, Observable } from 'rxjs';
import {
  SECTION_SELECTION_HANDLER,
  SectionSelectionHandler,
} from '@eherve/angular-material-section-tabs';

@Injectable({ providedIn: 'root' })
export class MemorySectionSelectionHandler implements SectionSelectionHandler {
  private readonly groups = new Map<string, BehaviorSubject<string | null>>();
  private group(key: string): BehaviorSubject<string | null> {
    let group = this.groups.get(key);
    if (!group) {
      group = new BehaviorSubject<string | null>(null);
      this.groups.set(key, group);
    }
    return group;
  }
  observe(key: string): Observable<string | null> {
    return this.group(key).asObservable();
  }
  select(key: string, value: string): void {
    this.group(key).next(value);
  }
}

// In application providers:
// { provide: SECTION_SELECTION_HANDLER, useExisting: MemorySectionSelectionHandler }

observe(key) emits the initial state and later changes. A null or unknown external value keeps the current safe local choice. External changes never trigger writes. Values must be unique within a group; duplicates are a configuration error. The component releases subscriptions when its key changes or it is destroyed. Handler errors are sent to Angular's ErrorHandler while local selection stays available. Handlers that persist state asynchronously should serialize their writes.

Styling and translations

Styles retain the source section-tabs-display__* classes and use the app-section-tabs-display host selector. Section tabs provide --ngx-mat-section-tabs-primary, --ngx-mat-section-tabs-background, and --ngx-mat-section-tabs-text defaults. Display chips use --ngx-mat-section-tabs-display-primary and --ngx-mat-section-tabs-display-background.

SectionTabsIntl.messages is a complete typed dictionary for fixed labels. Defaults are sections: 'Sections', emptySections: 'Aucune section à afficher', emptyComponents: 'Aucun composant configuré', emptyFields: 'Aucun champ renseigné', emptyFieldsDescription: "Activez l'affichage des champs vides pour voir les informations attendues.", and showEmptyFields: 'Afficher les champs vides'. Replace messages and emit changes to refresh an existing view; an explicit showEmptyFieldsLabel option remains in effect. sections is the accessible navigation label.

Inherited theme contract

Declare these optional CSS custom properties on an ancestor (including an overlay container when needed). The components do not declare common tokens on their hosts, so changing an ancestor updates existing instances without changing their inputs.

| Token | Standalone default / role | | --- | --- | | --ngx-mat-extended-space-1 | 4px, small spacing | | --ngx-mat-extended-space-2 | 8px, compact surface padding and control spacing | | --ngx-mat-extended-space-3 | 16px, group and default grid gaps | | --ngx-mat-extended-space-4 | 24px, larger separation | | --ngx-mat-extended-space-5 | 32px, reserved larger separation | | --ngx-mat-extended-radius | 8px, surface corners | | --ngx-mat-extended-surface | Surface background and selected empty-fields toggle handle, with existing standalone fallbacks | | --ngx-mat-extended-surface-hover | Hover background | | --ngx-mat-extended-surface-selected | Selected / highlighted background | | --ngx-mat-extended-border | Surface separators and outlines | | --ngx-mat-extended-border-selected | Selected outline | | --ngx-mat-extended-accent | Selected empty-fields toggle track and interaction color; falls back to Material primary | | --ngx-mat-extended-text | Main text | | --ngx-mat-extended-muted | Secondary text and icons |

Existing package-specific public color variables take precedence over the corresponding common role, which takes precedence over the standalone fallback. Action-specific colors keep their priority. Tokens only affect spacing and appearance: functional dimensions, circular controls and pill shapes remain unchanged. Material components inherit their theme; renderer headings use public Material typography roles with standalone fallbacks.

Omitting a section/card grid gap uses var(--ngx-mat-extended-space-3, 16px). An explicit value such as 12px is retained. Responsive grids read the computed column gap when calculating available tracks and item widths.

Readonly field grids use borderless cells with compact padding and an 8px inherited spacing-token inset, preserving configured gaps and responsive spans. The empty-fields toggle uses a compact 40×24px visual track while retaining Material’s 48px touch target. Its selected track and checkmark inherit the accent token; the selected handle uses the surface token in normal, focus, hover and pressed states.

--ngx-mat-section-tabs-background controls the section container. Set --ngx-mat-section-tabs-card-background separately for sidebar and content cards (for example, white cards on a gray container). Cards fall back to the existing section background, then --ngx-mat-extended-surface, then white.

Dialog navigation (22.2.0)

DialogNavigationState is { tab?: string; section?: string }. DialogNavigationOptions accepts initialState, an optional RxJS stateChanges observable for external restoration, and onChange(state) for actual user selection or normalization of an unavailable identifier. Valid restored states do not echo. The library never reads or writes the Router. URL ownership stays in the host.

Both app-section-tabs and app-section-tabs-display accept [navigation]. For sections, use the existing queryParamValue (display configurations default to section.id). Disabled or missing sections select the first enabled section. Navigation takes precedence over the legacy queryParamKey handler. Keep a stable navigation object and unsubscribe the host's state source when the owner closes.

DialogNavigationController is the root-tab adapter used by the edit/display packages. It resolves stable tab ids after visibility filtering, preserves a requested section until embedded content mounts, forwards section-only child adapters, ignores inactive/disposed child callbacks, and releases subscriptions when destroyed. Tab indices and translated labels are never serialized.

Run the Router-free navigation regressions with Node 22.6 or later:

node --experimental-strip-types --test projects/section-tabs/tests/dialog-navigation.test.mjs

Dialog lifecycle

The shared DialogLifecycleConnection contract exposes ready(handle, presentation), presentationChanged(presentation), failed(error), and optional beforeClose(): boolean | Promise<boolean>. Forms and display connections extend it. DialogLifecycleHandle provides navigate(state): Promise<DialogNavigationState> and requestClose(): Promise<boolean>. Presentation contains title, normalized state, and optional tabLabel / sectionLabel from rendered content.

Navigation uses stable tab/section identifiers. Its promise completes after Angular renders the selection and child section adapters normalize it. Replacement, closing, or destruction rejects pending navigation; stale handles cannot control replacements. DialogRenderLifecycle implements this render barrier without timers or polling.

The optional lifecycle connection opened(handle) receives a close-only requestClose(): Promise<boolean> handle before asynchronous loading. It supports cancelling loading or failed content through the existing close guards; it does not signal readiness. ready remains the rendered-content barrier. Handles from previous openings return false.

Standalone counters

Sections and cards accept counter?: number | string | null. Set counter: 0 to show a zero badge or counter: items.length for a list count. A counter is shown as a neutral badge without a denominator, completion color or progress. An explicit non-null counter takes precedence over completion; counted cards do not contribute to their parent section's completion totals. With null or undefined, the existing completion behavior remains unchanged.

The native <app-section-tab [counter]="items.length"> input has the same precedence and display rules.