📄 drei/abstractions/computed-attribute

File: computed-attribute.md | Updated: 11/15/2025


title: ComputedAttribute sourcecode: src/core/ComputedAttribute.tsx

Create and attach an attribute declaratively.

<sphereGeometry>
  <ComputedAttribute
    // attribute will be added to the geometry with this name
    name="my-attribute-name"
    compute={(geometry) => {
      // ...someLogic;
      return new THREE.BufferAttribute([1, 2, 3], 1)
    }}
    // you can pass any BufferAttribute prop to this component, eg.
    usage={THREE.StaticReadUsage}
  />
</sphereGeometry>