API Reference > @next-core/brick-kit > PropertyDeclaration
PropertyDeclaration interface
Defines options for a property accessor.
Signature:
export interface PropertyDeclaration<Type = unknown>
Properties
| Property | Type | Description |
|---|---|---|
| attribute | boolean | string | Indicates how and whether the property becomes an observed attribute. If the value is false, the property is not added to observedAttributes. If true or absent, the lowercased property name is observed (e.g. fooBar becomes foobar). If a string, the string value is observed (e.g attribute: 'foo-bar'). |
| converter | ComplexAttributeConverter<Type> | Indicates how to convert the attribute to/from a property. If this value is a function, it is used to convert the attribute value a the property value. If it's an object, it can have keys for fromAttribute and toAttribute. If no toAttribute function is provided and reflect is set to true, the property value is set directly to the attribute. A default converter is used if none is provided; it supports Boolean, String, Number, Object, and Array. Note, when a property changes and the converter is used to update the attribute, the property is never updated again as a result of the attribute changing, and vice versa. |
| noAccessor | boolean | Indicates whether an accessor will be created for this property. By default, an accessor will be generated for this property that requests an update when set. If this flag is true, no accessor will be created, and it will be the user's responsibility to call this.requestUpdate(propertyName, oldValue) to request an update when the property changes. |
| reflect | boolean | Indicates if the property should reflect to an attribute. If true, when the property is set, the attribute is set using the attribute name determined according to the rules for the attribute property option and the value of the property converted using the rules from the converter property option. |
| type | TypeHint | Indicates the type of the property. This is used only as a hint for the converter to determine how to convert the attribute to/from a property. |
Methods
| Method | Description |
|---|---|
| hasChanged(value, oldValue) | A function that indicates if a property should be considered changed when it is set. The function should take the newValue and oldValue and return true if an update should be requested. |