tailwindlabs/tailwindcss

`column-count` support

LoganDark opened this issue ยท 13 comments

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

(image source)

+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.

column-count:
column-gap:
column-span:
column-rule:
column-width:

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.

column-count:
column-gap:
column-span:
column-rule:
column-width:

@codytooker

.col-count
.col-gap
.col-span
.col-rule
.col-w

:)

@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.

.column-fill
.column-balance
.column-balance-all

And Column Rule style classes are

.column-solid
.column-dashed
.column-dotted
.column-none

With column rule color and column count following the same convention with

.column-{color}
.column-{number}

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 col.

https://tailwindcss.com/docs/flexbox-direction/#class-reference

That's the convention these guys use, and col is much more convenient and easy to type than column.

I'm pretty sure they'll use a grid prefix for CSS grid.

Updated classes to use .col- instead of .column- in agreement with @LoganDark 's input.
changes can be seen at #541

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.

"Rule #1 of open-source: no is temporary, yes is forever."

Can revisit this now as a JIT plugin?

Yes, this would be great. It cannot be recreated with other classes.

bw-jm commented

+1

If you're planning to use this in ul element, Columns work just fine.