Section Heading

The <smart-section-heading> component provides a heading region for sections within a page (positioned between <smart-page-heading> and <smart-card-heading> in size and scope), with a title and optional slots for a label, a description, actions, tabs, an input group (search), a badge and, in the preset, an image. It follows the Base + Standard + Wrapper pattern with an InjectionToken-based extension mechanism. The abstract SectionHeadingBaseComponent defines the shared API — optional ISectionHeadingOptions and cssClass (alias class). SectionHeadingStandardComponent is a barebones placeholder concrete implementation. SectionHeadingComponent is the public wrapper that renders SectionHeadingStandardComponent by default and accepts a custom replacement via SECTION_HEADING_STANDARD_COMPONENT_TOKEN.


Usage

<ng-template #actions>
  <smart-button [options]="inviteButton">Invite member</smart-button>
</ng-template>

<smart-section-heading [options]="options()" />
@if (invited()) {
  <p>Invitation sent.</p>
}

The preview renders the code above in an application that registers every preset (provideSmartPresets(), see Installation) and the English translations; without the presets, a component that has one renders its standard implementation instead, for most components unstyled markup.

Components

SectionHeadingComponent (<smart-section-heading>)

Main wrapper component. Renders SectionHeadingStandardComponent by default. When SECTION_HEADING_STANDARD_COMPONENT_TOKEN is provided, renders the injected component via NgComponentOutlet and hands it the options and class inputs.

SectionHeadingStandardComponent (<smart-section-heading-standard>)

Barebones placeholder concrete implementation. Renders a wrapper <div> (with the external cssClass) holding a header row: an <h3> with the title and, inside it, an optional <span class="label"> with the label; a <p class="description">; then the badgeTpl, inputGroupTpl and actionsTpl slots (.badge, .input-group, .actions). A separate .tabs row with tabsTpl sits beneath the header. Each part is rendered only when its option is set; the label is rendered only together with a title. The standard does not read imageTpl or presentation. It does not include Tailwind UI styling — it exists solely as the default structural placeholder until a custom implementation is registered through the token.

SectionHeadingBaseComponent (abstract)

Abstract base directive for extending custom section-heading implementations. Exposes options as an InputSignal<ISectionHeadingOptions | undefined> and cssClass as an InputSignal<string> (with alias class).

API

Inputs

InputTypeDefaultDescription
optionsInputSignal<ISectionHeadingOptions | undefined>-Optional configuration (title, description, slot templates)
classInputSignal<string>''External CSS classes (alias for cssClass)

ISectionHeadingOptions

All properties are optional.

FieldTypeDefaultDescription
titlestring-The heading (<h3> in the standard, <h2> in the preset).
descriptionstring-Text under the heading.
labelstring-Standard: inline <span class="label"> inside the title (needs title). Preset: eyebrow above the title.
actionsTplTemplateRef<unknown>-Action buttons.
badgeTplTemplateRef<unknown>-A badge: in the header row (standard) or next to the eyebrow label (preset).
tabsTplTemplateRef<unknown>-Standard only: tabs under the header. The preset does not render it.
inputGroupTplTemplateRef<unknown>-Standard only: a search or input group in the header row. The preset does not render it.
imageTplTemplateRef<unknown>-Preset only: the image column (the template owns the <img>).
presentation{ layout?: 'half' | 'narrow' | 'wide' | 'vertical' }-Preset only: the layout, half by default (see the preset section).

SECTION_HEADING_STANDARD_COMPONENT_TOKEN

InjectionToken that allows replacing the default SectionHeadingStandardComponent with a custom implementation. Provide a component class extending SectionHeadingBaseComponent under SECTION_HEADING_STANDARD_COMPONENT_TOKEN; every <smart-section-heading> below that injector renders it.

Extending the base class

import { NgTemplateOutlet } from '@angular/common';
import {
  ChangeDetectionStrategy,
  Component,
  computed,
  TemplateRef,
  ViewEncapsulation,
} from '@angular/core';

import {
  ISectionHeadingOptions,
  SECTION_HEADING_STANDARD_COMPONENT_TOKEN,
  SectionHeadingBaseComponent,
  SectionHeadingComponent,
} from '@smartsoft001/angular';

@Component({
  selector: 'docs-custom-section-heading',
  template: `
    <div [class]="containerClasses()">
      <div class="docs-section-heading__text">
        @if (options()?.label) {
          <p class="docs-section-heading__label">{{ options()?.label }}</p>
        }

        @if (options()?.title) {
          <h2 class="docs-section-heading__title">{{ options()?.title }}</h2>
        }

        @if (options()?.description) {
          <p class="docs-section-heading__description">
            {{ options()?.description }}
          </p>
        }
      </div>

      @if (options()?.actionsTpl) {
        <div class="docs-section-heading__actions">
          <ng-container [ngTemplateOutlet]="actionsTpl()" />
        </div>
      }
    </div>
  `,
  imports: [NgTemplateOutlet],
  encapsulation: ViewEncapsulation.None,
  changeDetection: ChangeDetectionStrategy.OnPush,
})
export class CustomSectionHeadingComponent extends SectionHeadingBaseComponent {
  // The slots are TemplateRefs inside `options`; the custom component renders
  // them with ngTemplateOutlet.
  readonly actionsTpl = computed(
    () => this.options()?.actionsTpl as TemplateRef<unknown>,
  );

  readonly containerClasses = computed(() => {
    const classes = ['docs-section-heading'];
    const extra = this.cssClass();
    if (extra) classes.push(extra);
    return classes.join(' ');
  });
}

@Component({
  selector: 'docs-section-heading-custom-example',
  changeDetection: ChangeDetectionStrategy.OnPush,
  imports: [SectionHeadingComponent],
  // The token swaps the standard heading for the custom one everywhere below
  // this component, so consumers keep writing `<smart-section-heading>`.
  providers: [
    {
      provide: SECTION_HEADING_STANDARD_COMPONENT_TOKEN,
      useValue: CustomSectionHeadingComponent,
    },
  ],
  template: `
    <ng-template #actions>
      <a href="#" class="docs-section-heading__cta">Get started</a>
    </ng-template>

    <smart-section-heading [options]="buildOptions(actions)" />
  `,
})
export class SectionHeadingCustomExampleComponent {
  // A factory because an Angular template expression cannot spread the
  // TemplateRef declared above into an object literal.
  buildOptions(actions: TemplateRef<unknown>): ISectionHeadingOptions {
    return {
      label: 'New',
      title: 'Manage your team in one place',
      description: 'Invite people, set their roles and remove access.',
      actionsTpl: actions,
    };
  }
}

HyperUI preset

SectionHeadingPresetComponent (smart-section-heading-preset) is a HyperUI-styled "content with image" variation. It renders an eyebrow row (label + badgeTpl), an <h2> title, a description <p>, actionsTpl below the text, and an optional image column fed by imageTpl. Vanilla Tailwind classes are prefixed with smart: and ship explicit smart:dark:* variants (gray-900 ↔ white for the title, gray-700 ↔ gray-300 for text). Every zone exposes a data-role hook: section, grid, text, image, eyebrow, actions.

The preset adds two options the standard ignores.

  • imageTpl — the image column. The zone is only rendered when this is provided; the template owns the <img> and its classes.
  • presentation.layout — 'half' | 'narrow' | 'wide' | 'vertical' (default half), described in the table below.
LayoutGridNotes
halfmd:grid-cols-2, text | imageDefault. Balanced two-column split.
narrowmd:grid-cols-4, text (1) | image (3)Narrow copy, wide image.
widemd:grid-cols-4, image (3) | text (1)Image rendered first.
verticalspace-y-* stack (no grid)Copy on top, image underneath.

Register the preset

Provide SectionHeadingPresetComponent under SECTION_HEADING_STANDARD_COMPONENT_TOKEN to restyle every <smart-section-heading>, or register every preset of the library at once with provideSmartPresets(). Alternatively use <smart-section-heading-preset> directly; it declares cssClass without the class alias, so bind [cssClass] there (on <smart-section-heading> pass class as usual).

Gaps

tabsTpl and inputGroupTpl are not rendered by this preset (only the standard component renders them). Use the standard component when those slots are needed.

Source

The component lives in packages/shared/angular/src/lib/components/section-heading and is documented for Claude Code by the angular-components-section-heading skill.

SmartSectionHeading titles a section of a page: a title with an optional eyebrow label, a description, and ReactNode slots for actions, tabs, an input group, a badge and an image. The standard rendering is an unstyled <h3> header with the slots and the tabs underneath. SmartSectionHeadingPreset renders a "content with image" block (eyebrow label + badge, <h2> title, description and actions beside imageTpl) laid out by options.presentation.layout.


Usage

import { useState } from 'react';

import { SmartButton, SmartSectionHeading } from '@smartsoft001/react';

export function SectionHeadingUsageExample() {
  const [invited, setInvited] = useState(false);

  return (
    <>
      <SmartSectionHeading
        options={{
          title: 'Team members',
          label: '12 members',
          description: 'People who can access this project.',
          // Slots are plain React nodes passed inside the options.
          actionsTpl: (
            <SmartButton
              options={{ variant: 'primary', click: () => setInvited(true) }}
            >
              Invite member
            </SmartButton>
          ),
        }}
      />
      {invited && <p>Invitation sent.</p>}
    </>
  );
}

The preview renders the code above in an application that registers every preset (SMART_PRESET_COMPONENTS on SmartProvider, see Installation) and the English translations; without the presets, a component that has one renders its standard implementation instead, for most components unstyled markup.

Exports

All from @smartsoft001/react.

ExportKindWhat it is
SmartSectionHeadingcomponentRenders the implementation registered as components['section-heading'] on SmartProvider, SmartSectionHeadingStandard by default.
SmartSectionHeadingPresetcomponentHyperUI-styled "content with image" section heading (preset).
SmartSectionHeadingStandardcomponentThe default section heading rendering: an unstyled <h3> title (with its label), description and the badge / input group / actions slots, and a tabs slot under the header.

The preset's class helpers (getSectionHeadingGridClasses, getSectionHeadingTextClasses, getSectionHeadingImageClasses, SECTION_HEADING_SECTION_CLASSES, SECTION_HEADING_CONTAINER_CLASSES, SECTION_HEADING_EYEBROW_CLASSES, SECTION_HEADING_TITLE_CLASSES, SECTION_HEADING_DESCRIPTION_CLASSES, SECTION_HEADING_ACTIONS_CLASSES) are exported too, with the type SectionHeadingPresetLayout (the layout argument of the helpers), for a custom implementation that wants the preset look.

Props and Types

SmartSectionHeadingProps

PropTypeDefaultDescription
options?ISectionHeadingOptions—Title, texts, slots and presentation.
className?string—Classes on the root element.

ISectionHeadingOptions

FieldTypeDefaultDescription
title?string—The heading (<h3> in the standard, <h2> in the preset).
description?string—Text under the heading.
label?string—Standard: a .label span inside the title (needs title). Preset: eyebrow above the title.
actionsTpl?ReactNode—Action buttons.
tabsTpl?ReactNode—Standard only: tabs under the header; the preset does not render it.
inputGroupTpl?ReactNode—Standard only: a search or input group; the preset does not render it.
badgeTpl?ReactNode—A badge: in the header row (standard) or next to the eyebrow label (preset).
imageTpl?ReactNode—Preset only: the image beside the text.
presentation?{ layout?: 'half' | 'narrow' | 'wide' | 'vertical'; }—layout of the preset: half (default), narrow, wide (image first) or vertical.

Replacing the Implementation

SmartSectionHeading renders the component registered under the 'section-heading' key of SmartProvider's components, and SmartSectionHeadingStandard when nothing is registered there. Every SmartSectionHeading below the provider then renders the registered component, which receives the same props.

SmartSectionHeadingPreset is the styled (preset) implementation: register it under the 'section-heading' key of SmartProvider's components, render it directly in place of SmartSectionHeading, or spread SMART_PRESET_COMPONENTS on the provider to register every preset at once (see the react-provider skill). Pass components as a stable object (a module constant or a memoised value), or the context changes on every render.

import {
  cn,
  ISectionHeadingOptions,
  SmartProvider,
  SmartSectionHeading,
  SmartSectionHeadingProps,
} from '@smartsoft001/react';

// There is no section heading hook: the custom component takes the same props
// as SmartSectionHeading, slots included, and renders them its own way.
export function CustomSectionHeading({
  options,
  className,
}: SmartSectionHeadingProps) {
  return (
    <div className={cn('docs-section-heading', className)}>
      <div className="docs-section-heading__text">
        {options?.label && (
          <p className="docs-section-heading__label">{options.label}</p>
        )}

        {options?.title && (
          <h2 className="docs-section-heading__title">{options.title}</h2>
        )}

        {options?.description && (
          <p className="docs-section-heading__description">
            {options.description}
          </p>
        )}
      </div>

      {options?.actionsTpl && (
        <div className="docs-section-heading__actions">
          {options.actionsTpl}
        </div>
      )}
    </div>
  );
}

// A module constant: a new object on every render would change the context.
const components = { 'section-heading': CustomSectionHeading };

const options: ISectionHeadingOptions = {
  label: 'New',
  title: 'Manage your team in one place',
  description: 'Invite people, set their roles and remove access.',
  actionsTpl: (
    <a href="#" className="docs-section-heading__cta">
      Get started
    </a>
  ),
};

export function SectionHeadingCustomExample() {
  // Every SmartSectionHeading below the provider renders CustomSectionHeading.
  return (
    <SmartProvider components={components}>
      <SmartSectionHeading options={options} />
    </SmartProvider>
  );
}

Styling

  • The standard rendering is unstyled; the preset carries the four layouts with smart:dark: variants.

Source

The component lives in packages/shared/react/src/lib/components/section-heading and is documented for Claude Code by the react-components-section-heading skill.