-
Notifications
You must be signed in to change notification settings - Fork 4.5k
column-count
support
#540
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
Comments
+1 to this. I just tweeted tailwindcss before coming here asking if it was something planned. I'd be willing to take a stab at it, if it's wanted in core at all. If not I will look at making a plugin. |
I think the css column spec would be a good addition to the framework. Even if it is set to false by default since it is a less commonly used system.
My only thought is it may produce some naming conflicts with grid-column once those get added to core depending on how they are named. But that could be discussed and figured out. Also since these selectors are seldom used the module / modules could be set to false in the default config if need be. |
I submitted a pull requests that is a sort of work in progress brainstorming section for the css column specification, it can be found at #541 . If anyone has some insight in how it should be handled, head over there and leave a comment. |
:) |
@LoganDark take a look at #541 if you look at the file changes you can see the selectors I came up with. I was trying to model most of it after the way borders are handled currently in Tailwind. For instance Column Fill classes are the following.
And Column Rule style classes are
With column rule color and column count following the same convention with
I do like the short hand .col but was concerned with how the grid implementation that I assume is coming to tailwind will be built. |
@codytooker you really should use plain https://tailwindcss.com/docs/flexbox-direction/#class-reference That's the convention these guys use, and I'm pretty sure they'll use a |
Updated classes to use |
Hey there! In my opinion this should not be a part of core yet (not even disabled by default) but that doesn't mean it's something we don't need. I've published a couple of plugins to NPM that would do the exact same thing your PR does plus some extra utilities related to CSS multi-columns (I've actually incorporated some of the naming conventions you discussed to what I already had before publishing). Let me know if there's anything else you're missing here, feel free to open issues to discuss whatever and let's wait on Adam's input on this (guessing he'll pass on the PR since this is what the plugins API was built for). |
I think this would be better as a plugin at least for now, always can revisit later though. |
Can revisit this now as a JIT plugin? |
Yes, this would be great. It cannot be recreated with other classes. |
+1 |
If you're planning to use this in |
For those who need this in Tailwind v4, here's what I came up with while migrating from tailwindcss-multi-column: @import "tailwindcss";
:root{
--tw-column-rule-style: solid;
}
@theme {
--column-rule-style-solid: solid;
--column-rule-style-dashed: dashed;
--column-rule-style-dotted: dotted;
--column-rule-style-double: double;
--column-rule-style-none: none;
--column-fill-auto: auto;
--column-fill-balance: balance;
--column-fill-all: all;
--column-count-span-none: none;
--column-count-span-all: all;
}
@utility col-count-*{
column-count: --value(integer);
}
@utility col-gap-*{
column-gap: --spacing(--value(integer));
}
@utility col-w-*{
column-width: --spacing(--value(integer));
}
@utility col-rule-*{
column-rule-style: var(--tw-column-rule-style);
column-rule-color: --value(--color);
column-rule-width: calc(--value(integer) * 1px);
column-rule-style: --value(--column-rule-style-*);
}
@utility col-fill-*{
column-fill: --value(--column-fill-*);
}
/* Specific name with "col-count" prefix to avoid collision with grid-column utilities */
@utility col-span-*{
column-span: --value(--column-count-span-*);
} The col-gap and col-w utilities are using a soon-to-be-added special function "--spacing()" so it's currently working only on the insiders release of Tailwind, but it's already merged so it's coming soon. You can read more about it here. ** edit: --spacing() function was released already, my bad. The PR is just about displaying the suggestions! |
I'd appreciate Tailwind utilities for working with the
column-count
property.Something like
.col-count-2
, or something similar.It's great for masonry layouts:
(image source)
The text was updated successfully, but these errors were encountered: