[Announcement] Tailwind CSS v1.3 is out! #1617
Replies: 8 comments
-
Awesome! Just the other day I wrote an |
Beta Was this translation helpful? Give feedback.
-
Great! The new |
Beta Was this translation helpful? Give feedback.
-
I've always avoided |
Beta Was this translation helpful? Give feedback.
-
Woo hoo! Very stoked about the new space and divide utilities |
Beta Was this translation helpful? Give feedback.
-
I wasn't aware of the PR and discussions of These are the only utilities that are doing direction specific action without stating it in their names. This is the reason It breaks the built-in support for RTL tailwind had. my suggestion is to substitute the x with specific direction r and l |
Beta Was this translation helpful? Give feedback.
-
@20lives Would it solve the problem if I patched them to use CSS logical properties instead? Like |
Beta Was this translation helpful? Give feedback.
-
@adamwathan thank you for your response, |
Beta Was this translation helpful? Give feedback.
-
Just stopping by to say thanks! |
Beta Was this translation helpful? Give feedback.
-
Holy crap a new Tailwind CSS release! We've got a few new goodies in this one, and I've made sure to put the most exciting ones at the top 🚀
There's no breaking changes, so to upgrade all you need to do is run:
New Features
space
anddivide
layout utilitiestransition-delay
utilitiesgroup-focus
variantcontainer
classcurrent
to the default color paletteinline-grid
utilityflow-root
display utilityclear-none
utilityNew
space
anddivide
layout utilities (#1584, #1594)Prior to Tailwind v1.3, if you wanted to add some space or a border between elements, you had to manually add the necessary margin/border to all but one of the children:
Tailwind v1.3 introduces new
space-{x/y}-{n}
,divide-{x/y}-{n}
, anddivide-{color}
utilities for controlling this at the parent level instead, simplifying this common pattern into something concise and declarative that doesn't require all of that annoying duplication:The
space-x-{n}
utilities add a left margin to all but the first element, and thespace-y-{n}
utilities add a top margin to all but the first element:The
space
utilities inherit their configuration from the globalspacing
configuration by default, and include negative variations like-space-x-2
to create overlapping effects.The
divide-x-{n}
utilities add a left border to all but the first element, and thedivide-y-{n}
utilities add a top border to all but the first element:The
divide
utilities inherit their configuration from theborderWidth
configuration, and support thedefault
keyword (set to 1px out of the box, like withborderWidth
) so you can usedivide-y
instead ofdivide-y-1
.The
divide-{color}
utilities are used to set the color of the dividing borders:We've also included
space-{x/y}-reverse
anddivide-{x/y}-reverse
utilities which can be useful if you are reversing the direction of items in a container using eitherflex-row-reverse
orflex-col-reverse
. These utilities swap left margins for right margins, top margins for bottom margins, left borders for right borders, and top borders for bottom borders to account for the items being in reverse order:There are a couple limitations of our implementation that are worth pointing out:
order
propertyDespite these limitations, I think you'll still find these incredibly useful. Eventually
gap
will have universal support in flexbox layouts and we can all rejoice.All of these utilities include
responsive
variants by default, and their values and variants can be customized using thespace
,divideWidth
, anddivideColor
configuration keys respectively.New
transition-delay
utilities (#1462)Tailwind v1.3 introduces new
delay-{amount}
utilities for thetransition-delay
property:We include the same values we do for the
duration-{amount}
utilities and generateresponsive
variants by default:New
group-focus
variant (#1577)We've added a new
group-focus
variant that works just like the existinggroup-hover
variant, but for focus states.This is useful when you want to add custom focus style to a button or link that has some nested child you want to style in a specific way, for example, changing the color of an icon inside of a button when the button is focused:
This variant not enabled for any utilities by default, but can be enabled in the
variants
section of your config file.Support for specifying a default line-height for each font-size utility (#1532)
A common pattern we've run into in our own Tailwind projects is repeatedly pairing a font-size utility with a particular line-height utility, for example always using
text-sm
withleading-5
.Tailwind v1.3 now lets you specify a default line-height for each font-size utility in your config file, using a tuple of the form
[fontSize, lineHeight]
:The font-size utilities are generated before the line-height utilities in the final CSS, so you can still override the line-height for a particular font-size by simply adding a
leading-{size}
utility:We haven't changed the default config to include default line-heights as that would be a breaking change, but this is a feature we will likely take advantage of in Tailwind 2.0 sometime in the future.
Support for breakpoint-specific padding for
container
class (#1398)Prior to v1.3, you could configure the
container
class to have built-in horizontal padding like so:Tailwind v1.3 enhances this functionality to allow you to specify a different amount of padding for each breakpoint:
Added
current
to the default color palette (#1438)The default color palette now includes
current
forcurrentColor
, which simplifies some situations like creating buttons where the border color should match the text color:Since this color has been added to the default color palette, it is available for
textColor
,borderColor
,backgroundColor
, andplaceholderColor
utilities automatically.New
inline-grid
utility (#1375)We've added an
inline-grid
utility for settingdisplay: inline-grid
. This probably should've been included in v1.2 and somehow got missed, but it's here now baby.Will you ever use this? I never have, but it should still be there dammit.
New
flow-root
display utility (#1247)We've added a new
flow-root
utility fordisplay: flow-root
. Never heard of it? Me neither until it was PR'd.It behaves exactly like
display: block
with one magical difference: it prevents collapsing margins!You'll start to find all sorts of useful use-cases for this if you pay attention, like completely obsoleting clearfix hacks.
New
clear-none
utility (#1413)This has been in the documentation for months but didn't actually exist in the framework — whoops.
It sets
clear: none
, which is mostly useful for resetting theclear
property at different breakpoints.Only two people noticed it was documented but missing, so odds are you don't even care that we added this.
Beta Was this translation helpful? Give feedback.
All reactions