Utilities

Autofill

Detect autofill events on input elements. This can be useful for styling or behavior changes when the browser autofills an input. Floating labels are a common use case for this directive.

Import

Import the Autofill primitives from ng-primitives/autofill.

import { NgpAutofill } from 'ng-primitives/autofill';

Usage

Assemble the autofill directives in your template.

<input ngpAutofill />

API Reference

The following directives are available to import from the ng-primitives/autofill package:

NgpAutofill

Data Attributes

The following data attributes are applied to the ngpAutofill directive:

Attribute Description
data-autofill Applied when the element is autofilled.

Copyright © 2026 Angular Primitives

This site is powered by Netlify