supabase-community / auth-ui

Pre-built Auth UI for React
https://supabase.com/docs/guides/auth/auth-helpers/auth-ui
MIT License
478 stars 120 forks source link

Allow the complete selection of custom CSS classes #194

Open Alfred-Mountfield opened 1 year ago

Alfred-Mountfield commented 1 year ago

Bug report

Describe the bug

The library allows the setting of custom class names for components, however the implementation is limited in the properties that they can overwrite. I am using Tailwind CSS similar to https://github.com/supabase/auth-ui/issues/94 (although I am using Svelte) and even with appearance.extend: false I am unable to easily style the buttons to match the rest of my application.

There are still a host of styling properties that are applied which overwrite ones I try and set through appearance.className:

image

This is greatly hurting the ergonomics as I'm having to set an !important modifier on my properties to actually be able to override them (such as removing the border), which in turn makes it hard for me to re-use my button styling from the rest of my application (where I do not want to use !important).

To Reproduce

  1. Insert Auth into a svelte application
  2. Disable the default theme and try and customise the appearance
  3. Try and use className to create a button style that includes things such as padding: 1rem and note that they are not applied (Note: using a theme such as theme: ThemeSupa will apply its own padding due to setting the variables)

Expected behavior

I would expect the CSS properties I set to actually additively apply to the element, but perhaps there should be an option to remove all styling from the elements and only apply the class name

Screenshots

image
    <Auth
        {supabaseClient}
        providers={['google']}
        {redirectTo}
        {view}
        showLinks={false}
        theme="dark"
        appearance={{
            extend: false,
            className: {
                button: 'button-base button-primary',
            }
        }}
        additionalData={{}}
    />

System information

Additional context

N/A

johnmdonich commented 1 year ago

@Alfred-Mountfield, did you ever find a workaround for this? I have the same issue.

Alfred-Mountfield commented 1 year ago

Aside from marking classes as important, I didn't find another easy way around it