elements icon indicating copy to clipboard operation
elements copied to clipboard

Add a way to reorder Social login & Password login

Open thongxuan opened this issue 9 months ago • 2 comments

Preflight checklist

Ory Network Project

No response

Describe your problem

Currently packages/elements-react/src/components/card/two-step/state-provide-identifier.tsx is implement like this

<OryCard>
      <OryCardHeader />
      <OryCardContent>
        <OryCardValidationMessages />
        <OryFormSocialButtonsForm />
        <OryForm
          data-testid={`ory/form/methods/local`}
          onAfterSubmit={handleAfterFormSubmit(dispatchFormState)}
        >
          <Form.Group>
            {showSsoDivider && <Card.Divider />}
            {nonSsoNodes.map((node, k) => (
              <Node node={node} key={k} />
            ))}
          </Form.Group>
        </OryForm>
      </OryCardContent>
      <OryCardFooter />
    </OryCard>

which cause OryFormSocialButtonsForm to show on top of OryForm (non-SSO)

In my custom UI I would like to show social login below, and this could not be achieve.

Ideally I would restyle the <OryCardContent> to display: flex; flex-direction: column-reverse, but there is also OryCardValidationMessages there and this would cause it to also move to the bottom, which is not desired.

Describe your ideal solution

I think we could wrap the <OryFormSocialButtonsForm />, OryForm(and any other possible groups) in one moredivor something, so it would be separated from theOryCardValidationMessages`, then it's up to consumer to style the form as they want.

Workarounds or alternatives

no workaround

Version

@ory/elements-react: ^1.0.0-rc.5

Additional Context

No response

thongxuan avatar Jun 03 '25 11:06 thongxuan

Thanks for the report. At the moment, the SSO buttons being in their own form is a bit of technical limitation, that we'd like to rework at some point. Wrapping the elements in more divs might also be problematic, because we then have to provide another overridable component, as well.

Looking at the code, I think we need to make it easier to implement the components yourself, reusing the built-in components. That would allow you to define your own order.

jonas-jonas avatar Jun 10 '25 19:06 jonas-jonas

I think the UI respects the order in the OIDC/SAML config array, not sure if this works with this version of Ory Elements but it would probably be an easy fix for you if it respects the order in the API (which it should, I think)

aeneasr avatar Jun 24 '25 13:06 aeneasr