#sb_99
1 messages ยท Page 1 of 1 (latest)
Another idea is to wrap multiple Elements but I'm not sure if this is standard practise or breaks any rules?
CheckoutWrapper.js
return(
for(...) {
{ children }
}
);
<CheckoutWrapper>
<Elements stripe={stripePromise} options={optionsForAddress}>
<PartialCheckoutForm checkoutProductInfo={checkoutProductInfo} CartItems={CartItems}/>
</Elements>
<Elements stripe={stripePromise} options={optionsDefault}>
<PartialCheckoutForm checkoutProductInfo={checkoutProductInfo} CartItems={CartItems}/>
</Elements>
</CheckoutWrapper>
I found the id parameter to be useful for targeting the LinkElement, but the fact that input fields are private classes means they can't be targeted via id
Hi ๐
So you only want to update the styling on the Address Element and not affect the Payment Element?
Exactly!
Hmmm... ๐ค
But you can see they are wrapped in the same Elements tag
Right, because that is basically the React version of instaniating the elements object here: https://stripe.com/docs/js/elements_object/create
Exactly, it seems I need two Elements instances then? But what are the implications of this?
What is the importance of the Elements instance to a group of elements?
That could be a bad situation
Because it would break the connection between the Address Element and the Payment Element
They wouldn't know about each other since they were created by independent Elements wrappers
Ah of course and that would then be reflected in whatever Stripe systems link them together, on the dashboard etc
It would mean we would not be able to bundle together the address info along with the payment info.
So the address wouldn't get appended to the confirmPayment request
I also see on the docs that there is no inline appearance options
seems it has to be through the Elements tag
seems like a tricky one
This may be overkill, but have you tried writing CSS rules that are specific to the ID or name? Looking at my integration I see the first address line has name=addressLine1
hmm let me try, but I just know Stripe treats input classes as private
but let me target the actual name
I'm also curious if there are Address element specific Rules you could put in your appearance object: https://stripe.com/docs/elements/appearance-api?platform=web#rules
But I'm not seeing enough valid selectors there
so targeting by name doesn't work, as for Address element specific I'm not sure, because all the elements use .Input
Unfortunately I don't know that this is supported currently. I can raise it as a feature request internally though.
Yes for sure!!
Stripe needs to get on that
The ability to pass appearance rules to the individual elements
instead of the Elements wrapper
I agree. I think it would be a relatively quick win too
Agreed
and given that people using elements want more flexibility as well
Thank you for the help
btw do you guys do this discord thing like an on-call rotation?
Ah nice, it's really cool from a company. No one else does this. Also is it likely feedback gets implemented and does it take long usually?
There's no guarantee about if/when a feature gets implemented but we take feedback from our users seriously
Awesome, thanks a lot and have a nice day