Skip to main content

StaticNumberAttributeController

You get this controller when useAttribute(...) resolves an attribute whose runtime type is a static number. Static attributes display a fixed numeric value and cannot be changed by the user.

import { useAttribute } from "@expivi/product-configurator";

const attribute = useAttribute(configurator, attributeCid);

Read its value through the shared API. There is nothing to set:

// Read the fixed value(s) from the attribute
console.log(attribute.data.identifier);
console.log(attribute.values);

// Static attributes are always static input
console.log(attribute.isStatic); // true

API

This controller adds no consumer-facing members of its own. It only overrides produceSetValue(...) so that any attempt to set a value throws:

attribute.setValue(undefined); // throws: Static Attributes can not set value

Everything else comes from the Common Attribute API — use data, values, subscribe(...), serialize(), and reset() as documented there.