This PR improves createHeadlessComponent util behavior: if asChild is set and children is valid react element with empty children props (to not override custom children there) then will be used children from props.
Before change
Right now if you use asChild for passing props to children you won't get a default children value from the defaults.
For example this won't work and will give empty <p class="text-primary"></p>
This PR improves
createHeadlessComponent
util behavior: ifasChild
is set andchildren
is valid react element with emptychildren
props (to not override custom children there) then will be usedchildren
from props.Before change
Right now if you use
asChild
for passing props to children you won't get a default children value from the defaults.For example this won't work and will give empty
<p class="text-primary"></p>
After the change
will give you
<p class="text-primary">By continuing, you agree to Aptos Labs'</p>
and if you specify children in internal element, then
will give you
<p className="text-primary">By continuing, you agree with the policy</p>