Helm form and navigation components
Helm is Spartan's styled layer for forms, menus, navigation, overlays, sidebars, and user feedback. It gives Brain's accessible behavior a shared visual language while keeping composite interactions usable in Angular templates. See Helm components for the wider component family and Brain primitives for the headless behavior layer.
Helm layer
Helm turns a Brain primitive into a ready-to-use styled control or interaction pattern. The Helm package is copied into an application by the CLI, so the application owns the visual layer and can change its classes without changing Brain's behavior contract. References: skills/…/brain-vs-helm.md• L3-20, libs/…/package.json• L1-21
Styled behavior
Each Helm feature combines visual rules with a matching Brain directive or component. Brain supplies state, keyboard paths, focus handling, ARIA links, and form contracts. Helm reads that state through host attributes and adds the visual response, such as an active tab, invalid field, disabled button, open menu, or visible overlay. References: skills/…/brain-vs-helm.md• L7-20, libs/…/hlm-button.ts• L40-57, libs/…/hlm-field.ts• L29-43, libs/…/hlm-tabs.ts• L5-23
Feature entry points
Helm exposes features through focused paths such as @spartan-ng/helm/input, @spartan-ng/helm/select, and @spartan-ng/helm/dialog. Most features also expose an *Imports bundle that groups the pieces needed by a standalone Angular component. The package root is not the component API, so an application selects the feature entry point that matches its interaction. References: libs/…/index.ts• L1-2, libs/…/index.ts• L1-6, libs/…/index.ts• L1-34, libs/…/index.ts• L1-35
Form controls
Helm form controls cover direct value entry, binary state, grouped choices, range input, and date selection. They are intended to sit inside a field pattern so a user sees consistent labels, help text, error text, focus state, and disabled state across different control types. See Helm layout and data display for the surrounding layout and display components.
Field composition
The field pattern is the link between a control and its human-readable context. A field provides a label, optional description, and validation error around one or more controls. The Brain field service tracks the description and active error IDs, while Helm renders those messages and makes the field layout vertical, horizontal, or responsive. References: libs/…/hlm-field.ts• L29-43, libs/…/hlm-field-description.ts• L5-43, libs/…/hlm-field-error.ts• L16-89, libs/…/README.md• L5-12
Value controls
Text inputs and text areas provide the base value-entry surface. Input groups extend that surface with attached text, buttons, or other controls. OTP inputs split one value into visible slots. These controls keep native form use and Brain's value and touch contracts aligned while Helm supplies size, spacing, and state styles. References: libs/…/hlm-input.ts• L6-17, libs/…/index.ts• L1-5, libs/…/index.ts• L1-22, libs/…/index.ts• L1-19
Choice controls
Checkboxes, radios, switches, toggles, and toggle groups express boolean or small-set choices. Selects, comboboxes, and autocomplete controls extend the same idea to a list of values that may be grouped, searched, or selected more than once. The Brain parent owns selection and keyboard behavior. Helm supplies the trigger, item, indicator, and list treatment that makes each state clear. References: libs/…/index.ts• L1-5, libs/…/index.ts• L1-9, libs/…/index.ts• L1-8, libs/…/index.ts• L1-52, libs/…/index.ts• L1-64
Range and date controls
Sliders represent a value or range along a scale. Calendars and date pickers turn that value into a single date, a set of dates, a date range, or a month and year. These controls combine a visual input with Brain's form and keyboard behavior, which lets applications use them in the same field and validation flow as text controls. References: libs/…/index.ts• L1-4, libs/…/index.ts• L1-11, libs/…/index.ts• L1-38
Questionnaire flows
A questionnaire is a styled multi-step form that presents enabled items, tracks progress, and lets the user move through or submit the flow. Helm wraps Brain's questionnaire behavior on the form and item boundaries, so the application keeps Brain's item selection, validation, keyboard shortcuts, and form state while Helm supplies the visual structure.
The questionnaire composition separates the question from its choices and actions. Items can expose a title, description, choices, free-form input, and error state. Progress reports the current step and total. The action area groups previous, skip, next, and submit controls into a shared responsive layout. See Brain form and selection controls for the behavior layer behind this form pattern.
References: libs/…/hlm-questionnaire.ts• L5-22 libs/…/hlm-questionnaire-item.ts• L5-22 libs/…/hlm-questionnaire-progress.ts• L5-40 libs/…/hlm-questionnaire-actions.ts• L4-14 libs/…/index.ts• L17-49
Menus and navigation
Helm navigation components help users move through an application or choose an action without making every interaction a custom pattern. They cover persistent routes, hierarchical navigation, tabs, disclosure, command search, and action menus. Each pattern keeps its own focus and selection model in Brain while Helm makes the current, open, and disabled states visible.
Route navigation
Breadcrumbs show the user's place in a hierarchy. Navigation menus expose related routes in a structured, often expandable group. Pagination moves through a larger result set and can express the current page through links and query parameters. These components connect visual navigation state to application routing or data loading rather than acting as isolated decoration. References: libs/…/index.ts• L1-25, libs/…/index.ts• L1-25, libs/…/index.ts• L1-31
Local navigation
Tabs switch between related views under one context. Paginated tab lists add styled previous and next controls when the tab headers do not fit, while keeping the tab triggers in the Brain-managed tab list. Manual activation still lets Enter and Space activate the focused tab through the native trigger. Accordion controls reveal and hide related content. Their triggers and content stay in one parent pattern so Brain can keep active state, keyboard movement, and content relationships aligned. Helm adds the line, panel, spacing, and orientation styles around that behavior. References: libs/…/index.ts• L1-22, libs/…/hlm-tabs.ts• L5-23, libs/…/hlm-tabs-paginated-list.ts• L21-101, libs/…/hlm-tabs-paginated-list.spec.ts• L34-80, libs/…/index.ts• L1-11
Action menus
Dropdown menus, context menus, menubars, and command surfaces present actions in a focused list. Dropdown menus can group actions and include check, radio, and nested submenu states. Context menus start from a contextual trigger, while command surfaces support search and can open as a dialog. These patterns rely on managed focus instead of treating each action as an unrelated button. References: libs/…/index.ts• L1-49, libs/…/index.ts• L1-6, libs/…/index.ts• L1-8, libs/…/index.ts• L1-37
Overlays and transient content
Overlays move content above the page and connect it to a trigger. Helm provides dialogs for focused tasks, alert dialogs for decisions that need confirmation, popovers for attached content, sheets for side panels, and tooltips for short hover help. The Angular CDK overlay supplies the common placement and attachment layer, while Brain owns the interaction life cycle and Helm supplies the panel treatment.
Dialog patterns
Dialogs and alert dialogs separate content from the page behind a modal surface. A dialog can contain a task or form. An alert dialog frames an action that may have a serious or hard-to-reverse result with explicit cancel and action paths. Both patterns provide structured title, description, content, footer, close, and overlay roles so the user can understand the task and return to the prior focus. Dialog content keeps an accessible close button by default, supports a custom close label, and stays sized to the viewport when it renders in an overlay pane. References: libs/…/index.ts• L1-35, libs/…/hlm-dialog.ts• L5-24, libs/…/hlm-dialog-content.ts• L20-64, libs/…/hlm-dialog-content.spec.ts• L45-75, libs/…/index.ts• L1-40
Attached content
Popovers and tooltips stay tied to a host control. A popover can hold interactive content such as a date picker or a small form. Its Brain-backed root passes placement, focus, close, and overlay options through the Helm boundary, while the content exposes its open or closed state for visual treatment. Nested popovers close their own content without closing the parent popover. A tooltip gives brief, non-interactive help and follows hover-oriented behavior, so it is not a replacement for a popover when touch users need to discover or use the content. References: libs/…/hlm-popover.ts• L1-26, libs/…/hlm-popover-content.ts• L5-19, libs/…/hlm-popover-nested.spec.ts• L55-75, libs/…/index.ts• L1-25, libs/…/hlm-tooltip.ts• L24-40, libs/…/hlm-tooltip-default-options.spec.ts• L35-58, skills/…/brain-vs-helm.md• L58-59, .greptile-internal/…/brain-primitives.md• L107-109
Sheet panels
Sheets expose a panel from an edge of the viewport. They support a task or a set of controls that should remain near the current page while the rest of the page is temporarily covered. The sidebar uses the same sheet pattern on mobile, which keeps a navigation surface usable when a persistent desktop rail cannot fit. References: libs/…/index.ts• L1-34, libs/…/hlm-sidebar.ts• L21-59, skills/…/brain-vs-helm.md• L58-59
Sidebar layouts
The sidebar is a navigation shell that changes shape with the viewport. On a wide screen it can remain in the page layout and be expanded, collapsed to an icon rail, or hidden off canvas. On a small screen it opens as a sheet. A shared service keeps the open state, mobile state, variant, keyboard shortcut, and saved preference aligned across the shell and its trigger. References: libs/…/hlm-sidebar.ts• L26-59, libs/…/hlm-sidebar.ts• L62-137, libs/…/hlm-sidebar.service.ts• L16-111
Sidebar navigation
Sidebar groups provide labeled sections for menus, nested menu items, badges, actions, separators, and loading skeletons. Menu buttons can show a tooltip when the desktop sidebar is collapsed, while menu and sub-menu links can close the mobile sheet after selection. An input, header, footer, content area, inset main area, and rail complete the shell without changing its route model. References: libs/…/hlm-sidebar-group.ts• L4-15, libs/…/hlm-sidebar-menu-button.ts• L35-89, libs/…/hlm-sidebar-menu-sub-button.ts• L7-41, libs/…/hlm-sidebar-menu-skeleton.ts• L6-33, libs/…/hlm-sidebar-input.ts• L5-17, libs/…/hlm-sidebar-rail.ts• L5-34
User feedback
Helm feedback components tell users about status, progress, absence of data, and background results. They give the application a shared visual response for events that do not need a new route or a full task dialog.
Inline feedback
Alerts provide visible status messages in the current page. Empty states explain that a view has no useful content yet and can offer a next action. Spinners show ongoing work when the page needs a compact busy signal. These surfaces stay in the normal document flow, so they support the surrounding layout instead of taking control away from it. References: libs/…/index.ts• L1-11, libs/…/hlm-alert.ts• L19-31, libs/…/index.ts• L1-22, libs/…/hlm-empty.ts• L4-13, libs/…/index.ts• L1-5
Toast feedback
The toaster presents short-lived results outside the current content flow. It maps Brain's toast state to styled loading, success, error, information, and warning messages. The application can control placement, duration, visible count, expansion, and close behavior without rebuilding the message life cycle. References: libs/…/hlm-toaster.ts• L9-45, libs/…/hlm-toaster.ts• L48-95
Composition model
Helm components are assembled from directives and projected content rather than from a single wrapper with a large option set. A trigger stays on the application's own element, while content that must move into an overlay is projected through a portal directive. This keeps the relationship between a control and its action visible in the template and lets the application combine Helm controls, such as a styled button used as a dialog trigger.
The common interaction flow is:
- The application places a Helm root around the interaction.
- It applies a Helm trigger directive to the element that starts the interaction.
- It projects the matching content, items, or panels into the root.
- Brain updates state, focus, keyboard behavior, and ARIA relationships.
- Helm styles the resulting state and the application handles the business action.
This diagram shows how an application combines a styled host with Brain behavior and then receives the resulting interaction state.
flowchart LR
A[Application template] --> B[Helm root and host directives]
B --> C[Brain state and accessibility]
C --> D[Keyboard focus and value events]
C --> E[State attributes and ARIA links]
D --> F[Application action or form state]
E --> G[Helm visual state]
Triggers and content must remain in the owning composition. For example, a select trigger belongs to its select, a menu item belongs to its menu, and dialog content uses the matching portal when it must render above the page. References: skills/…/brain-vs-helm.md• L22-32, libs/…/hlm-select-trigger.ts• L10-28, libs/…/hlm-select-content.ts• L8-25, libs/…/index.ts• L1-35
Overlay setup
Overlay-based Helm components share Angular CDK behavior. provideSpartanHlm() applies the default overlay setting that keeps sheets, dialogs, tooltips, and related content in the expected stacking relationship with fixed page surfaces such as the toaster. Applications should use that shared setup instead of adding per-component z-index workarounds. References: libs/…/provide-spartan-hlm.ts• L4-33, skills/…/brain-vs-helm.md• L58-59
Field accessibility
A custom or new Helm control must preserve the field connection when it is used inside hlm-field. The focusable control needs Brain's described-by bridge so the field can add its description and active error IDs without losing an application-supplied aria-describedby. References: libs/…/README.md• L5-12, libs/…/hlm-input.ts• L6-10, libs/…/hlm-select-trigger.ts• L15-24
Change checklist
When these files or sections are changed, remember to consider these:
- When a Helm control changes its host or state attributes, check the matching Brain primitive and every style selector that uses active, open, disabled, invalid, or focus state.
- When a composite entry point adds or removes a trigger, item, content, or portal, keep its
*Importsbundle and the required template hierarchy aligned. - When a questionnaire changes its item or action structure, keep the Brain questionnaire inputs and outputs, progress state, and action placement aligned with the styled composition.
- When field descriptions or errors change, check the described-by bridge for input-like controls and the visibility rules for both forced and validation-driven errors.
- When an overlay changes its position, close, focus, or stacking behavior, review dialogs, sheets, popovers, selects, tooltips, and the shared
provideSpartanHlm()setup. - When dialog content changes its close control or overlay sizing, keep the accessible close name, description link, and viewport-safe width contract aligned with the Brain dialog.
- When nested popover behavior changes, preserve separate parent and child close state and keep the content state available to Helm styles.
- When tooltip defaults change, keep parent and application-level Brain options effective while retaining Helm tooltip styling.
- When sidebar state or responsive behavior changes, keep desktop state, mobile sheet state, cookie restoration, keyboard toggling, and menu-button mobile close behavior consistent.
- When sidebar menu states change, keep active state, collapsed tooltips, nested menu visibility, badges, actions, and loading placeholders aligned with the sidebar data attributes.
- When a feedback surface changes its Brain contract, check the Helm message or toaster mapping so status types keep their intended visual and user meaning.
Important failure modes
| Trigger | Consequence | Guard |
|---|---|---|
Importing from @spartan-ng/helm instead of a feature entry point | The application cannot access the intended component bundle | Import from @spartan-ng/helm/<name> and use the matching *Imports export |
| Placing a Helm trigger or content piece outside its owning root | Brain cannot complete the state, focus, or ARIA relationship | Keep the trigger, root, items, and content in the required composition |
| Omitting the field described-by bridge from an input-like control | Help and active error text are not announced through the control | Apply the field control bridge to the focusable element or host directive |
| Using a tooltip for interactive or touch-needed content | Users cannot reliably discover or operate the content | Use a popover for interactive content and reserve tooltips for brief hover help |
| Closing a nested popover through the parent state | A child action hides unrelated parent content | Keep each popover in its own Brain root and use its own content state |
| Overriding tooltip defaults without preserving the Brain provider chain | Parent or application position settings do not reach the tooltip | Provide Brain tooltip defaults at the intended scope and keep the Helm tooltip directive on the trigger |
| Skipping shared Helm overlay setup while using fixed feedback surfaces | Overlay content can stack above the toaster or other fixed surfaces | Add provideSpartanHlm() to the application providers |
| Treating a mobile sidebar as the desktop sidebar state | Opening or closing one viewport mode does not update the other correctly | Use the sidebar service and its mobile sheet path for responsive state |
| Leaving mobile close behavior off for a sidebar menu link when the shell expects auto-close | A selected route leaves the mobile navigation sheet open | Use the menu-button or sub-button close input with the shared sidebar config |
| Rendering a sidebar menu action or badge in an icon-only state without its visibility contract | The compact sidebar shows controls that have no usable label or context | Keep action, badge, and tooltip behavior aligned with the collapsed state |
| Rendering a toast without a mounted toaster | Toast calls have no visible destination | Mount one hlm-toaster in the application shell |
| Preventing the native activation of a focused tab in manual mode | Enter or Space changes focus but does not activate the selected tab | Preserve native button activation for the paginated tab list |
| Separating questionnaire actions or items from their questionnaire root | Step state, validation, or navigation controls do not use the active questionnaire | Keep questionnaire items, progress, and action controls inside the hlmQuestionnaire form composition |
Key files
| File | Why to read it |
|---|---|
| skills/…/brain-vs-helm.md | Defines the Brain and Helm boundary and the directive-based composition model. |
| libs/…/index.ts | Shows that Helm consumers use feature entry points rather than the package root. |
| libs/…/hlm-field.ts | Shows the styled field boundary that connects controls to validation context. |
| libs/…/hlm-field-error.ts | Shows how visible validation feedback becomes part of field accessibility. |
| libs/…/hlm-input.ts | Illustrates a basic styled control with Brain form and field behavior. |
| libs/…/hlm-select.ts | Illustrates a composite choice control that joins selection and overlay behavior. |
| libs/…/hlm-select-trigger.ts | Shows how a styled trigger keeps its field and select relationships. |
| libs/…/hlm-questionnaire.ts | Shows the styled root for Brain-backed multi-step form flow. |
| libs/…/hlm-questionnaire-actions.ts | Shows the shared action layout for questionnaire navigation and submission. |
| libs/…/hlm-questionnaire-progress.ts | Shows how Brain progress state becomes a styled step indicator. |
| libs/…/index.ts | Shows the complete questionnaire composition and its grouped imports. |
| libs/…/hlm-tabs.ts | Illustrates Helm styling around grouped Brain navigation behavior. |
| libs/…/hlm-tabs-paginated-list.ts | Shows the styled overflow controls for tab headers and their connection to Brain tab activation. |
| libs/…/hlm-navigation-menu.ts | Shows the styled boundary for hierarchical route navigation. |
| libs/…/index.ts | Shows the action-menu family, including nested and stateful menu pieces. |
| libs/…/index.ts | Shows the complete dialog composition surface. |
| libs/…/hlm-dialog-content.ts | Shows dialog description linking, close labeling, and overlay-safe content sizing. |
| libs/…/hlm-popover.ts | Shows the Brain popover contract exposed through the Helm root. |
| libs/…/hlm-popover-content.ts | Shows the styled popover content state used for visual open and close behavior. |
| libs/…/hlm-popover-nested.spec.ts | Demonstrates independent close behavior for nested popovers. |
| libs/…/hlm-sidebar.ts | Shows the desktop, collapsed, and mobile sidebar presentation paths. |
| libs/…/hlm-sidebar-menu-button.ts | Shows active menu state, collapsed tooltips, and mobile sheet close behavior. |
| libs/…/hlm-sidebar-menu-skeleton.ts | Shows the loading state used inside sidebar navigation. |
| libs/…/hlm-sidebar.service.ts | Shows the shared responsive and persisted sidebar state. |
| libs/…/provide-spartan-hlm.ts | Defines the application-level overlay setup for Helm surfaces. |
| libs/…/hlm-tooltip-default-options.spec.ts | Shows that Brain tooltip position defaults can be supplied at parent or application scope without removing Helm classes. |
| libs/…/hlm-toaster.ts | Shows how Brain toast state becomes styled user feedback. |