HelixOverviewComponentsMapsGraphIntroductionInstallationDeriving a themeSandboxTheme builderVisual testingCortexDocsEngramBuildingTraceBuildingRecallDeclaredServicesInsightsGet in touchSource on GitHub
Getting started
AngularAngular does not compile a template that contains a tag it does not recognize.
To use Helix components, add CUSTOM_ELEMENTS_SCHEMA to the components that
render them.import{CUSTOM_ELEMENTS_SCHEMA,Component}from'@angular/core'@Component({schemas:[CUSTOM_ELEMENTS_SCHEMA],standalone:true,template:`<helix-button>Save</helix-button>`,})exportclassSaveButton{}If you can, declare the schema only on the components that use Helix.
CUSTOM_ELEMENTS_SCHEMA turns off unknown-element checking for the whole
template it is on. A narrow scope keeps that check, which catches your own
typos, in your other components.Bind properties and events<helix-input#field(change)="name = field.value"[value]="name"/>[prop] sets a property, which a value that is not a string needs. (event)
binds with addEventListener, so use the event's own name.#field gives the template a reference to the element, typed as its class once
you import its family. Under strictTemplates, $event.target is an
EventTarget | null, which has no value.Do not use attr. for a stateful property.[attr.value]="name" writes the
attribute. The attribute seeds the control and is out of date as soon as someone
types in it. The property holds the current value.No typings ship for AngularThe package has no angular.d.ts. CUSTOM_ELEMENTS_SCHEMA turns off the
checking that typings would feed, so Angular would not enforce a generated file.
We publish the manifest as @fusion.dev/helix/custom-elements.json, so you can
generate your own files from it.As a result, a misspelled property fails without an error in Angular. Check
property names in code review.The other frameworks check a misspelled name to different degrees:In React, TypeScript reports a misspelled prop unless its name has a hyphen.
See React.In Vue, vue-tsc reports one only when checkUnknownProps is on. See
Vue.In Svelte, svelte-check reports an attribute that the Helix tag does not
declare.Refuse a changevalue, open, checked, and active are seeds. The element starts with the
value you set and then applies its own changes. To refuse a change, listen for
the helix-before-* event and call preventDefault(). See
State and control.To write your own value into a field you type into, set your signal and then
call detectChanges() on the component's ChangeDetectorRef:private readonly view=inject(ChangeDetectorRef)protected takeHandle(event: Event):void{event.preventDefault()const{value}=(eventasCustomEvent<{value:string}>).detailthis.handle.set(clean(value))this.view.detectChanges()}Without zone.js, Angular renders a signal change in a later task. A key that
arrives before that task lands in the text from before your value, and the keys
typed in between are lost. A barcode scanner, a password manager, and a test
send keys that fast. detectChanges() renders the change before your handler
returns.