API Reference
Documentation
Complete reference for Secure-UI web components. Security-first form elements with built-in validation, XSS prevention, and audit logging.
npm install secure-ui-components Quick Start
Add Secure-UI components to your project by importing the component library. Components self-register and are immediately available for use.
npm install secure-ui-components// Import all components
import 'secure-ui-components';
// Or import individual components
import 'secure-ui-components/secure-input';
import 'secure-ui-components/secure-form';<!-- All components — single bundle, no build step required -->
<script type="module" src="/components/secure-ui.bundle.js"></script><secure-input
label="Email Address"
name="email"
type="email"
security-tier="sensitive"
required
></secure-input>Security Tiers
Every component supports four security tiers that control validation strictness, visual indicators, and security features. Choose the appropriate tier based on the sensitivity of the data being collected.
<!-- Public tier - for general information -->
<secure-input security-tier="public" label="Name" name="name"></secure-input>
<!-- Sensitive tier - for PII like email, phone -->
<secure-input security-tier="sensitive" label="Email" name="email" type="email"></secure-input>
<!-- Critical tier - for passwords, financial data -->
<secure-input security-tier="critical" label="Password" name="password" type="password"></secure-input>Components
Nine security-first web components. Each ships with XSS prevention, validation, and audit logging enabled by default — security is opt-out, not opt-in.
Form Inputs
Orchestration
Display
Guides
Common Attributes
All Secure-UI components share these common attributes inherited from the base component.
| Attribute | Type | Default | Description |
|---|---|---|---|
security-tier | string | "critical" | Security level: "public", "authenticated", "sensitive", or "critical" |
name | string | - | Form field name for submission |
label | string | - | Accessible label text displayed above the field |
required | boolean | false | Whether the field is required |
disabled | boolean | false | Disables the component |
Built-in Security Features
XSS Prevention
All user input is automatically sanitized before rendering. HTML entities are encoded, script tags are stripped, and event handlers are removed.
CSRF Protection
The <secure-form> component automatically includes and validates CSRF tokens. Tokens are generated server-side and validated on form submission.
Input Validation
Type-specific validation is applied based on input type and security tier. Email formats, URL patterns, and custom regex patterns are validated client-side with server-side validation as the authoritative source.
Audit Logging
All components maintain an audit log of security-relevant events. Access the log via the getAuditLog() method on any component instance.
const input = document.querySelector('secure-input');
const auditLog = input.getAuditLog();
// Log contains entries like:
// { action: 'input_focused', timestamp: '...', data: { name: 'email' } }
// { action: 'validation_failed', timestamp: '...', data: { reason: 'invalid email' } }
console.log(auditLog);Progressive Enhancement
All components are built with progressive enhancement in mind. They work without JavaScript using native HTML form elements, and enhance with additional security features when JavaScript is available.