Description
Describe the Bug
When I wanted to add a custom field component to one of my fields in a collection, I want to use Tailwind to style that component. In fact, the component I want to use as a custom Field component is a component that is already used in the user-facing (frontend).
I was mostly successful in integrating the component, but noticed that adding Tailwind as per https://payloadcms.com/posts/blog/how-to-setup-tailwindcss-and-shadcn-ui-in-payload (I know it's outdated) messes up the table widths in the collection views:
With @tailwind utilities;
in app/(payload)/custom.scss

With @tailwind utilities;
in app/(payload)/custom.scss

Notice how with @tailwind utilities;
, the table width does not span the full width of the parent container.
I'm wondering if the way outlined in above blog post is still the way to integrate Tailwind into custom components. If not, then I certainly have not found a way to do it in the docs and the example at https://github.com/payloadcms/payload/tree/main/examples/tailwind-shadcn-ui still proposes to do it in the same way.
This is easily reproducible by checking out the website
template of create-payload-app
and adding the Tailwind directives, which is what I did in my reproduction link below.
Link to the code that reproduces this issue
https://github.com/HappyEmu/payload-custom-tailwind-component-reprod
Reproduction Steps
- Clone Repo
- Start dev server
- Login into Admin Panel
- Add any entry to one of the collections, for example Redirects
- Notice how the table width changes depending on whether
@tailwind utilities;
is declared or not.
Which area(s) are affected? (Select all that apply)
area: ui, area: templates, area: docs
Environment Info
Binaries:
Node: 22.12.0
npm: 10.9.0
Yarn: N/A
pnpm: 10.3.0
Relevant Packages:
payload: 3.28.1
next: 15.2.2
@payloadcms/db-mongodb: 3.28.1
@payloadcms/email-nodemailer: 3.28.1
@payloadcms/graphql: 3.28.1
@payloadcms/live-preview: 3.28.1
@payloadcms/live-preview-react: 3.28.1
@payloadcms/next/utilities: 3.28.1
@payloadcms/payload-cloud: 3.28.1
@payloadcms/plugin-form-builder: 3.28.1
@payloadcms/plugin-nested-docs: 3.28.1
@payloadcms/plugin-redirects: 3.28.1
@payloadcms/plugin-search: 3.28.1
@payloadcms/plugin-seo: 3.28.1
@payloadcms/richtext-lexical: 3.28.1
@payloadcms/translations: 3.28.1
@payloadcms/ui/shared: 3.28.1
react: 19.0.0
react-dom: 19.0.0
Operating System:
Platform: darwin
Arch: arm64
Version: Darwin Kernel Version 23.5.0: Wed May 1 20:12:58 PDT 2024;
Available memory (MB): 32768
Available CPU cores: 10