Docs / Components
SenseKeyFilterDirective
Keyboard and paste filter from @artificialsenselabs/ui that restricts input to characters matching a preset pattern or custom RegExp.
Live demo: run nx serve showcase and open /components/key-filter (port 4202).
Overview
Category: Form controls. Selector: [senseKeyFilter]. Import: import { SenseKeyFilterDirective } from '@artificialsenselabs/ui';
<input senseKeyFilter="int" type="text" aria-label="Quantity" />
<input [senseKeyFilter]="uppercaseOnly" type="text" aria-label="Initial" />Inputs
| Input | Type | Default | Description |
|---|---|---|---|
senseKeyFilter | SenseKeyFilterPreset | RegExp | 'alphanum' | Preset (pint, int, pnum, num, hex, alpha, alphanum, money, email) or custom pattern. |
keyFilterBypass | boolean | false | Temporarily disables filtering on the host control. |
Accessibility
- Navigation keys (arrows, Backspace, Tab, etc.) are always allowed.
- Modified shortcuts (Ctrl/Cmd/Alt) bypass filtering for copy/paste/select-all.
- Paste is validated character-by-character against the active pattern.