feat(tailwind): Add css configs to Taliwind component#2926
feat(tailwind): Add css configs to Taliwind component#2926JBezerra wants to merge 4 commits intoresend:canaryfrom
Taliwind component#2926Conversation
|
@JBezerra is attempting to deploy a commit to the resend Team on Vercel. A member of the Team first needs to authorize it. |
|
commit: |
There was a problem hiding this comment.
1 issue found across 6 files
Prompt for AI agents (all issues)
Check if these issues are valid — if so, understand the root cause of each and fix them.
<file name="playground/README.md">
<violation number="1" location="playground/README.md:11">
P3: Documentation path is inconsistent with the example and project structure; users are told to create `/emails` but templates live under `playground/emails`.</violation>
</file>
Since this is your first cubic review, here's how it works:
- cubic automatically reviews your code and comments on bugs and improvements
- Teach cubic by replying to its comments. cubic learns from your replies and gets better over time
- Ask questions if you need clarification on any suggestion
Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review.
| ### 1. Create an email template | ||
|
|
||
| Create a new file at `playground/emails/testing.tsx` | ||
| Create a new file at `/emails` |
There was a problem hiding this comment.
P3: Documentation path is inconsistent with the example and project structure; users are told to create /emails but templates live under playground/emails.
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At playground/README.md, line 11:
<comment>Documentation path is inconsistent with the example and project structure; users are told to create `/emails` but templates live under `playground/emails`.</comment>
<file context>
@@ -8,9 +8,9 @@ It includes all components directly from source with a path alias import of `@re
### 1. Create an email template
-Create a new file at `playground/emails/testing.tsx`
+Create a new file at `/emails`
-```tsx emails/testing.tsx
</file context>
There was a problem hiding this comment.
Well, that's not perfectly right. I'm taking the fair assumption that is it obvious that root is playground given the README lives on it.
Along with this, I've removed testing.tsx because that was simply wrong given the phrase is "Create a new file at [...]"
Not sure of the process here, if this change should immediately bump the version. I leave this answer to @gabrielmfern. |
|
Could you please check whether this fixes compatibility with the Tailwind CSS IntelliSense VS Code plugin. The IntelliSense plugin requires a When using React Email with Tailwind in a monorepo setup, no such For non-monorepo setups, the IntelliSense plugin will resolve the application's |
gabrielmfern
left a comment
There was a problem hiding this comment.
left some comments, for some small changes before we can merge
|
|
||
| ### 1. Create an email template | ||
|
|
||
| Create a new file at `playground/emails/testing.tsx` |
There was a problem hiding this comment.
I believe this is unrelated, can you revert?
| @@ -1,2 +1,3 @@ | |||
| **/*.tsx | |||
| **/* | |||
| # Ignore all files in the emails directory except for the example.tsx file | |||
There was a problem hiding this comment.
This is also unrelated, feel free to open a second PR with these changes, but I'd rather you revert them here
| config?: TailwindConfig; | ||
| cssConfigs?: CSSConfigs; | ||
| } | ||
| export async function setupTailwind({ |
There was a problem hiding this comment.
maybe it should be either a config, or a css config? how does tailwind prioritize between them when they're both present?
|
|
||
| expect(generate(getStyleSheet())).toMatchInlineSnapshot( | ||
| `"/*! tailwindcss v4.1.18 | MIT License | https://tailwindcss.com */@layer theme,base,components,utilities;@layer theme{:root,:host{--color-red-500: oklch(63.7% 0.237 25.331);--color-blue-300: oklch(80.9% 0.105 251.813);--color-slate-900: oklch(20.8% 0.042 265.755)}}@layer utilities{.bg-slate-900{background-color:var(--color-slate-900)}.text-red-500{color:var(--color-red-500)}.sm\\:bg-blue-300{@media (width>=40rem){background-color:var(--color-blue-300)}}}"`, | ||
| `"/*! tailwindcss v4.1.18 | MIT License | https://tailwindcss.com */@layer theme,base,components,utilities;@layer theme{:root,:host{--color-red-500: oklch(63.7% 0.237 25.331);--color-blue-300: oklch(80.9% 0.105 251.813);--color-slate-900: oklch(20.8% 0.042 265.755)}}@layer utilities{.bg-slate-900{background-color:var(--color-slate-900)}.text-red-500{color:var(--color-red-500)}.sm\\:bg-blue-300{@media (width>=40rem){background-color:var(--color-blue-300)}}}@layer theme;@layer utilities;"`, |
| * Stringifies the data to a JSON string that is safe to use. | ||
| * It will replace functions with their string representation. | ||
| */ | ||
| function JSONStringify(data: object) { |
There was a problem hiding this comment.
I don't like having a separate function like this for something only used once
| /** | ||
| * The pixel based preset is the preset recommended to use for emails. | ||
| * It is used to style the email with a pixel based system. | ||
| */ |
There was a problem hiding this comment.
can you revert this comment?
|
|
||
| export interface TailwindProps { | ||
| children: React.ReactNode; | ||
| /** Tailwind config object. Used in Tailwind v3. */ |
There was a problem hiding this comment.
This comment might confuse people, since it works in v4 and we don't support v3 at all anymore. I think it's better without
| import { cloneElementWithInlinedStyles } from './utils/tailwindcss/clone-element-with-inlined-styles'; | ||
| import { setupTailwind } from './utils/tailwindcss/setup-tailwind'; | ||
|
|
||
| export type CSSString = string; |
There was a problem hiding this comment.
can you just inline string where this is used?
| }); | ||
| }); | ||
|
|
||
| describe('with theme', () => { |
There was a problem hiding this comment.
maybe with css configuration instead?
Summary
Adds support for CSS-based configuration to the
<Tailwind>component, aligning with Tailwind CSS v4's CSS-first approach.This addresses the discussion in #2863
Changes
themeandutilityprop toTailwindcomponentsetupTailwindto process custom CSS configurationsExample Usage (Using Vite)
Summary by cubic
Add CSS-first configuration to the Tailwind component with new theme and utility props. This brings Tailwind v4-style CSS configs while keeping support for the existing config prop.
Written for commit 4ab3e8a. Summary will update on new commits.