Closed FoksVHox closed 3 months ago
Wrap it around a <Text />
component. should get it fixed.
Wrap it around a
<Text />
component. should get it fixed.
While it solves some of the issue, it doesn't solve it 100%.
The example table doesn't wrap the text in a <Text />
, but rather it just has the text as it's children.
The above image is produced with the following code
<Table>
<TableHead>
<TableRow>
<TableHeader>Name</TableHeader>
<TableHeader>Email</TableHeader>
<TableHeader>Role</TableHeader>
</TableRow>
</TableHead>
<TableBody>
{users.map((user) => (
<TableRow key={user.handle}>
<TableCell className="font-medium">{user.name}</TableCell>
<TableCell>{user.email}</TableCell>
<TableCell className="text-zinc-500">{user.access}</TableCell>
</TableRow>
))}
</TableBody>
</Table>
And as you can see, the text with the user.name
and user.email
isn't gray, which it will become when you <Text />
.
I do believe that it's a bug, that should be addressed.
Hey! So the reason this is happening is because the Table
component doesn't have a default text color applied to it, so it's falling back to the document's default text color.
It's probably a good idea to give your app a default text color, something like this:
<body class="text-zinc-950 dark:text-white">
However, I think it's also a good idea for the Table
component to have a default color, so I've gone ahead and fixed that. You can either re-download Catalyst from the Tailwind UI website to get this change, or you can update your Table.tsx
with this change:
- <table className="min-w-full text-left text-sm/6">{children}</table>
+ <table className="min-w-full text-left text-sm/6 text-zinc-950 dark:text-white">{children}</table>
Hope that helps! 👍
What component (if applicable)
Describe the bug When you use
media
in yourtailwind.config.js
as the method for dark mode, you will see that everything except the text inTableCells
is affected. Hence you'll have a dark mode, with black/gray text which makes it very hard to read.To Reproduce Steps to reproduce the behaviour:
media
as the method for dark mode in yourtailwind.config.js
Expected behaviour For the text to be affected by the dark mode.
Screenshots
Browser/Device (if applicable)
Additional context I've found that adding
style="color-scheme: dark;"
fixes the text, however, the text will then appear white when you use light mode. This is used in the demo, but it isn't mentioned anywhere in the docs. Also, this isn't a viable solution when you're using themedia
-method instead of theselector
-method.I've used Laravel & Inertia for this, instead of Next.js. However, I do believe the same would happen on Next.js.