@snatuva/primitives

June 15, 2026 · View on GitHub

Signals-first Angular primitives for building scalable, accessible UI systems.

npm version Angular license


Overview

Most Angular component libraries hand you finished UI. @snatuva/primitives hands you the foundations — unstyled, composable, and accessible building blocks you wire together your way.

No NgModule. No fighting the design system. Just clean primitives built on Angular Signals.


Installation

npm install @snatuva/primitives

Requires Angular 17+.


Why primitives?

Traditional component libraries@snatuva/primitives
Opinionated styles, hard to overrideZero styles — you own the look
Bulky bundles with unused componentsTree-shakable, import only what you use
RxJS-heavy internal stateAngular Signals throughout
NgModule-basedStandalone-first

Primitives

Tabs

A fully accessible tabs implementation following the ARIA tabs pattern.

Directives

DirectiveDescriptionInputs
apTabsRoot scope and state provider
apTabListContainer for tab triggersorientation?: 'horizontal' | 'vertical' (default: 'horizontal')
apTabTriggerInteractive tab buttontabId: string, disabled?: boolean
apTabPanelPanel regionid: string, disabled?: boolean
apTabContentStructural directive — conditionally renders active paneltabId: string

Import

import {
  TabsDirective,
  TabListDirective,
  TabTriggerDirective,
  TabPanelDirective,
  TabContentDirective,
} from '@snatuva/primitives';

Usage

<div apTabs>
  <div apTabList>
    <button apTabTrigger tabId="overview">Overview</button>
    <button apTabTrigger tabId="details">Details</button>
    <button apTabTrigger tabId="settings" [disabled]="true">Settings</button>
  </div>

  <section apTabPanel id="overview">
    <p>Overview content</p>
  </section>
  <section apTabPanel id="details">
    <p>Details content</p>
  </section>
  <section apTabPanel id="settings">
    <p>Settings content</p>
  </section>
</div>

ARIA attributes (role="tab", aria-selected, aria-controls, role="tabpanel", aria-labelledby, aria-hidden) are applied automatically.

Conditional rendering with apTabContent

Use apTabContent to defer rendering panel content until the tab is active:

<section apTabPanel id="analytics">
  <ng-template apTabContent tabId="analytics">
    <!-- Only rendered when this panel is active -->
    <app-analytics-chart />
  </ng-template>
</section>

Accordion

A vertically stacked set of interactive headings that each reveal an associated section of content.

Directives

DirectiveDescriptionInputs
apAccordionRoot scope and state providertype?: 'single' | 'multiple'
collapsible?: boolean
orientation?: 'vertical' | 'horizontal'
disabled?: boolean
defaultValue?: string | string[]
value?: string | string[]
apAccordionItemContainer for a single accordion itemitemId: string, disabled?: boolean
apAccordionTriggerInteractive toggle button
apAccordionContentCollapsible panel region

Import

import {
  AccordionDirective,
  AccordionItemDirective,
  AccordionTriggerDirective,
  AccordionContentDirective,
} from '@snatuva/primitives';

Usage

<div apAccordion type="single" [collapsible]="true">
  <div apAccordionItem itemId="item-1">
    <button apAccordionTrigger>Is it accessible?</button>
    <div apAccordionContent>Yes. It adheres to the WAI-ARIA design pattern.</div>
  </div>

  <div apAccordionItem itemId="item-2">
    <button apAccordionTrigger>Is it unstyled?</button>
    <div apAccordionContent>Yes. It's fully headless and unstyled.</div>
  </div>
</div>

Keyboard navigation (Arrow keys, Home, End) and ARIA attributes (aria-expanded, aria-controls, role="region") are handled internally.


Dialog / Modal

A window overlaid on either the primary window or another dialog window, rendering the content underneath inert.

Directives

DirectiveDescriptionInputs / Outputs
apDialogRoot state provideropen?: boolean
(openChange)
modal?: boolean (default: true)
closeOnBackdropClick?: boolean (default: true)
apDialogTriggerButton to open the dialog
apDialogOverlayBackdrop element
apDialogContentModal content container
apDialogTitleARIA title (aria-labelledby)
apDialogDescriptionARIA description (aria-describedby)
apDialogCloseButton to close the dialog

Import

import {
  DialogDirective,
  DialogTriggerDirective,
  DialogOverlayDirective,
  DialogContentDirective,
  DialogTitleDirective,
  DialogDescriptionDirective,
  DialogCloseDirective,
} from '@snatuva/primitives';

Usage

<div apDialog>
  <button apDialogTrigger>Edit Profile</button>

  <div apDialogOverlay class="overlay-styles">
    <div apDialogContent class="panel-styles">
      <h2 apDialogTitle>Edit Profile</h2>
      <p apDialogDescription>Make changes to your profile here.</p>
      
      <!-- Your form content -->
      
      <button apDialogClose>Save Changes</button>
    </div>
  </div>
</div>

Focus trapping, background scroll locking, and Escape key functionality are built-in.


Tooltip

A popup that displays information related to an element when the element receives keyboard focus or the mouse hovers over it.

Directives

DirectiveDescriptionInputs
apTooltipRoot state provider
apTooltipTriggerElement that triggers the tooltip
apTooltipContentStructural template for tooltip contenttooltipId?: string

Import

import {
  TooltipDirective,
  TooltipTriggerDirective,
  TooltipContentDirective,
} from '@snatuva/primitives';

Usage

<div apTooltip>
  <button apTooltipTrigger>
    Hover or focus me
  </button>

  <ng-template apTooltipContent tooltipId="custom-tooltip-id">
    <div class="tooltip-panel">
      This is a helpful tooltip message!
    </div>
  </ng-template>
</div>

Tooltips automatically map aria-describedby and attach via Angular CDK Overlay dynamically.


Switch

A control that toggles between checked and not checked, built on a native <input type="checkbox">.

Directives

DirectiveDescriptionInputs
apSwitchApplied to input[type=checkbox][(checked)]?: boolean (default: false), disabled?: boolean

Import

import { SwitchDirective } from '@snatuva/primitives';

Usage

<input type="checkbox" apSwitch [(checked)]="airplaneMode" />

role="switch", aria-checked, and data-state="checked|unchecked" are applied automatically. Keyboard activation (Space) and click come for free from the native checkbox.


Checkbox

A control that allows the user to toggle between checked, unchecked, and indeterminate states.

Directives

DirectiveDescriptionInputs
apCheckboxApplied to input[type=checkbox][(checked)]?: boolean (default: false), indeterminate?: boolean, disabled?: boolean

Import

import { CheckboxDirective } from '@snatuva/primitives';

Usage

<input type="checkbox" apCheckbox [(checked)]="agreed" />

<!-- Indeterminate ("select all") -->
<input type="checkbox" apCheckbox
       [checked]="allChecked()"
       [indeterminate]="someChecked()"
       (checkedChange)="toggleAll($event)" />

indeterminate is a DOM-only property (not an attribute), so the directive applies it imperatively and reflects it via data-state="indeterminate".


Radio Group

A set of checkable buttons — known as radio buttons — where no more than one can be checked at a time.

Directives

DirectiveDescriptionInputs
apRadioGroupRoot state provider[(value)]?: string | null, disabled?: boolean, orientation?: 'horizontal' | 'vertical' (default: 'vertical')
apRadioGroupItemApplied to input[type=radio]value: string (required), disabled?: boolean

Import

import { RadioGroupDirective, RadioGroupItemDirective } from '@snatuva/primitives';

Usage

<div apRadioGroup [(value)]="plan">
  <input type="radio" apRadioGroupItem value="free" />
  <input type="radio" apRadioGroupItem value="pro" />
  <input type="radio" apRadioGroupItem value="team" />
</div>

A shared name is generated automatically so the native radios behave as a mutually exclusive set, with role="radiogroup", data-state, and group-level disabled propagation handled for you.


Accessibility

Every primitive is built to satisfy ARIA authoring practices out of the box:

  • Semantic roles applied automatically (role="tab", role="region", role="dialog", role="tooltip", etc.)
  • Keyboard navigation (Arrow keys, Home, End, Tab, Escape)
  • ARIA states (aria-selected, aria-expanded, aria-hidden, etc.) wired up seamlessly
  • Focus management and trapping handled internally for overlays like Dialog
  • Disabled states respected by both keyboard and assistive technology

Core design principles

Signals-first. State is managed with Angular Signals. RxJS is used only where it is the right tool, not the default.

Standalone. No NgModule required. Drop a directive into any standalone component.

Headless. Primitives ship with zero styles. You apply your design system on top — CSS, Tailwind, or anything else.

Composable. Primitives are scoped and self-contained. Nest them, extend them, or combine them without fighting internal abstractions.

Tree-shakable. Only the primitives you import end up in your bundle.


Roadmap

  • Tabs
  • Accordion
  • Dialog / Modal
  • Tooltip
  • Select
  • Switch
  • Checkbox & Radio group
  • Documentation site
  • Popover
  • Combobox / Autocomplete
  • Accessibility utilities
  • CDK integrations

Contributing

Contributions are welcome. If you have ideas for new primitives, accessibility improvements, or API refinements, open an issue or pull request.


Author

Built by Siva Sridhar Natuva.


License

MIT