Skip to content

Customize just the padding #2216

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
kocv59 opened this issue Apr 19, 2025 · 6 comments
Closed

Customize just the padding #2216

kocv59 opened this issue Apr 19, 2025 · 6 comments

Comments

@kocv59
Copy link

kocv59 commented Apr 19, 2025

Tailwind V3 docs explain how to customize just the padding or all the spacing in theme.extend.spacing or theme.extend.padding. V4 says how to customize the spacing but not the padding.

@rozsazoltan
Copy link

rozsazoltan commented Apr 20, 2025

If you could link specifically which page you're having an issue with, I think that would help a lot.

The @theme directive in the v4 CSS-first configuration corresponds to the extend parameter in v3.

The @theme directive accepts predefined namespaces - both margin and padding are listed there.

Links pointing to the namespace list can be found in several places, but it's also available directly on the dedicated theme documentation page:

--spacing-*

So essentially, you're customizing that default unit of 1 which is used everywhere spacing is involved; w-, h-, p-, m-; I guess there's no point in listing them all.

Possible duplicated: #2215 (comment)

Spacing and sizing utilities like px-4, max-h-16, and many more

As I realized, in both issues you're referring to a specific line to point out the shortcomings, but that doesn't reflect the entirety of the documentation.

@kocv59
Copy link
Author

kocv59 commented Apr 20, 2025

In V3 you could set a theme.extend.spacing as the default on all utilities then add theme.extend.padding to have different units for padding. In V4 I can't see it because on https://tailwindcss.com/docs/theme#theme-variable-namespaces is only --spacing-*.

The @theme directive accepts predefined namespaces - both margin and padding are listed there.

I don't see --margin-* or --padding-* on that page?

@philipp-spiess
Copy link
Member

@kocv59 these are not documented yet but these namespaces do exist for v3 compatibility and work with v4: https://play.tailwindcss.com/ACF42xLST9?file=css

@kocv59
Copy link
Author

kocv59 commented Apr 24, 2025

Is there a --spacing-margin-* or --spacing-padding-* like --spacing-* to set one number that applies to all margin and padding numbers.

@philipp-spiess
Copy link
Member

@kocv59 No, the spacing multiplier is shared across all spacing utilities.

@kocv59
Copy link
Author

kocv59 commented Apr 25, 2025

All versions before V4 you could have a different spacing for each utility. Would --spacing-margin and --spacing-padding variables be good to add so we can have same customization as before? It would give us flexibility like we have for unocss.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants