You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Feb 19, 2025. It is now read-only.
Copy file name to clipboardExpand all lines: README.md
+14-25
Original file line number
Diff line number
Diff line change
@@ -31,33 +31,30 @@ npm install @supabase/ui
31
31
You will need to update tailwind.config.js in the root of your project.
32
32
33
33
#### Default tailwind.config.js tailwind setup
34
+
34
35
This is what a regular tailwind config file looks like
35
36
36
37
```js
37
-
38
38
// tailwind.config.js
39
39
40
40
module.exports= {
41
41
content: [
42
-
"./pages/**/*.{js,ts,jsx,tsx}",
43
-
"./components/**/*.{js,ts,jsx,tsx}",
42
+
'./pages/**/*.{js,ts,jsx,tsx}',
43
+
'./components/**/*.{js,ts,jsx,tsx}',
44
44
],
45
45
theme: {
46
46
extend: {},
47
47
},
48
48
plugins: [],
49
49
}
50
-
51
50
```
52
51
53
-
54
52
#### Update tailwind.config.js to the following
55
53
56
54
You will need to wrap the SupabaseUI config around your own tailwind config like below.
57
55
Also add the new purge rules
58
56
59
57
```js
60
-
61
58
// using Supabase UI
62
59
63
60
// tailwind.config.js
@@ -69,14 +66,13 @@ module.exports = ui({
69
66
'./components/**/*.{js,ts,jsx,tsx}',
70
67
'./node_modules/@supabase/ui/dist/config/default-theme.js', // add this
71
68
],
72
-
theme: {
69
+
theme: {
73
70
extend: {},
74
71
},
75
72
plugins: [],
76
73
})
77
74
```
78
75
79
-
80
76
## Using Supabase UI
81
77
82
78
### Colors
@@ -85,7 +81,7 @@ Supabase UI uses Radix Colors for everything, and all the colors are already set
85
81
86
82
#### Scale
87
83
88
-
In addition to accessing all colors from Radix, we have also assigned a new color pallete called `scale`. This is the designated grayscale color we use throughout all the component.
84
+
In addition to accessing all colors from Radix, we have also assigned a new color pallete called `scale`. This is the designated grayscale color we use throughout all the component.
89
85
90
86
`scale`, as a default, is actually just the radix `gray` in dark mode, and radix `slate` in light mode. The colors are stored as CSS variables, so they can be swapped out for other color scales. These serve as the backbone of the components theme. It is advised you use `scale` wherever possible so that, if the scale theme is changed, everything will follow suite.
91
87
@@ -95,14 +91,14 @@ As an example, and for aneyone interested, the CSS variables look a bit like thi
95
91
96
92
```css
97
93
:root {
98
-
--colors-scale1: var(--colors-gray1)`;
99
-
--colors-scale2: var(--colors-gray2)`;
94
+
--colors-scale1: var(--colors-gray1)`;
95
+
--colors-scale2: var(--colors-gray2)`;
100
96
/* and so on */
101
97
}
102
98
103
99
.dark {
104
-
--colors-scale1: var(--colors-slate1)`;
105
-
--colors-scale2: var(--colors-slate2)`;
100
+
--colors-scale1: var(--colors-slate1)`;
101
+
--colors-scale2: var(--colors-slate2)`;
106
102
/* and so on */
107
103
}
108
104
```
@@ -113,10 +109,9 @@ We have then populated tailwind with the relevant colors based on CSS variables,
113
109
114
110
A drawback to this is that [bg opacity classes eg: (bg-scale-100/25)](https://tailwindcss.com/docs/background-color#changing-the-opacity) don't work, although maybe a workaround can be figured out in the future.
115
111
116
-
Another, and possibly larger drawback, is that by relying on a 'color scale' as a theme, we are effectively making it quite hard to have element level theming. For example, custom themeing by a user to, perhaps, pick the 'app background color', or maybe the 'border color'. This is rather hard with this current solution but it's also a bit of a drawback with Tailwind its self as we declare the color and index of the color directly in jsx usually.
117
-
118
-
A possible workaround could be to create tailwind classes for various things, and then they reference a tailwind class themselves. Although that could be convoluted as we then have a custom tailwind class, referencing another tailwind class, which in turn references a CSS variable (pheww!).
112
+
Another, and possibly larger drawback, is that by relying on a 'color scale' as a theme, we are effectively making it quite hard to have element level theming. For example, custom themeing by a user to, perhaps, pick the 'app background color', or maybe the 'border color'. This is rather hard with this current solution but it's also a bit of a drawback with Tailwind its self as we declare the color and index of the color directly in jsx usually.
119
113
114
+
A possible workaround could be to create tailwind classes for various things, and then they reference a tailwind class themselves. Although that could be convoluted as we then have a custom tailwind class, referencing another tailwind class, which in turn references a CSS variable (pheww!).
120
115
121
116
#### Dark mode
122
117
@@ -133,19 +128,13 @@ For example, you may want to have a app background the same shade across light a
133
128
You can just use tailwind dark mode classes as normal to achieve that:
134
129
135
130
```jsx
136
-
137
-
constindex= () => {
131
+
constindex= () => (
138
132
<body className="bg-scale-200">
139
-
<div className="bg-scale-100 dark:bg-scale-300">
140
-
This is a panel
141
-
/* content in here */
142
-
</div>
133
+
<div className="bg-scale-100 dark:bg-scale-300">I am content</div>
143
134
</body>
144
-
}
135
+
)
145
136
```
146
137
147
-
148
-
149
138
### Typography
150
139
151
140
Use tailwind classes as normal for typography, but use `text-scale-*` classes for the text color.
0 commit comments