Pricing

How to

Utility Classes

The Draft Pro plugin uses ALMOST all of the default TailwindCSS utility classes ( we say almost b/c we didn’t include all of the color utilities, but don’t worry you can add custom colors ) plus a few WordPress specific utilities.

The Free Draft plugin gives you access to all the responsive Margin, Padding, Display, and Flex-Basis utilities.

Prefixed for your protection. We’ve prefixed all utility classes with ‘tw-‘ to prevent styling collisions with plugins or themes that may also use similarly named utility classes.

For more information on any utility class we highly recommend checking out the official TailwindCSS documentation.

Utilities Not Found in TailwindCSS

There are several utilities that aren’t found in the default TailwindCSS configuration and are unique to Draft.

color

Color utilities are found in TailwindCSS, however we didn’t include any of the default color packages ( we do recommend referencing their curated palettes for color ideas! ). We did this b/c we couldn’t pick just one ( or even a couple ) and we tried including all of them but the plugin just got too big.

Instead we’ve defined a handful contextual and sequential color utility classes that you can configure yourself. These come in handy when you’re working from a brand or business defined color palette and they really speed up your website building workflow.

The hard part is choosing the right color slot for your colors.

The color configuration is an incredibly powerful tool that also drives a handful of utility classes including:

  • Background Color ( bg-primary, bg-secondary… )
  • Text Color ( text-primary, text-secondary… )
  • Border Color ( border-primary, border-secondary… )
  • Placeholder Color ( placeholder-primary, placeholder-secondary… )
  • Divide Color ( divide-primary, divide-secondary… )
  • Ring Color ( ring-primary, ring-secondary… )
  • Background Gradient Colors ( from-primary, to-secondary… )

Setting the color defaults is a bit of an art. We’ve given you a handful of context driven color utility names, such as Background, Foreground, Primary, Secondary, Light & Dark.

We’ve also added 8 additional custom color utility slots that sequentially follow the naming pattern of Primary 1st and Secondary 2nd ( tertiary 3rd, quaternary 4th, quinary 5th, senary 6th, septenary 7th, octonary 8th, nonary 9th, denary 10th ).

Here are all the color utility slots:

  • Background ( bg-background, bg-background… )
  • Foreground ( bg-foreground, text-foreground… )
  • Primary ( bg-primary, text-primary… )
  • Secondary ( bg-secodary, text-secondary… )
  • Tertiary ( bg-tertiary, text-tertiary… )
  • Quaternary ( bg-quaternary, text-quaternary… )
  • Quinary ( bg-quinary, text-quinary… )
  • Senary ( bg-senary, text-senary… )
  • Septenary ( bg-septenary, text-septenary… )
  • Octonary ( bg-octonary, text-octonary… )
  • Nonary ( bg-nonary, text-nonary… )
  • Denary ( bg-denary, text-denary… )
  • Light ( bg-light, text-light… )
  • Dark ( bg-dark, text-dark… )
Class NameProperty Value
bg-background, bg-foreground, bg-primary, bg-secondary, bg-tertiary, bg-quaternary, bg-quinary, bg-senary, bg-septenary, bg-octonary, bg-nonary, bg-denary, bg-dark, bg-lightbackground-color: var(--tw-color-primary);
background-color: var(--tw-color-secondary);
etc.
text-background, text-foreground, text-primary, text-secondary, text-tertiary, text-quaternary, text-quinary, text-senary, text-septenary, text-octonary, text-nonary, text-denary, text-dark, text-lightcolor: var(--tw-color-primary);
color: var(--tw-color-secondary);
etc.
border-background, border-foreground, border-primary, border-secondary, border-tertiary, border-quaternary, border-quinary, border-senary, border-septenary, border-octonary, border-nonary, border-denary, border-dark, border-lightborder-color: var(--tw-color-primary);
border-color: var(--tw-color-secondary);
etc.
placeholder-background, placeholder-foreground, placeholder-primary, placeholder-secondary, placeholder-tertiary, placeholder-quaternary, placeholder-quinary, placeholder-senary, placeholder-septenary, placeholder-octonary, placeholder-nonary, placeholder-denary, placeholder-dark, placeholder-lightplacholder-primary::placeholder {
color: var(--tw-color-primary);
}
placholder-secondary::placeholder {
color: var(--tw-color-secondary);
}
etc.
divide-background, divide-foreground, divide-primary, divide-secondary, divide-tertiary, divide-quaternary, divide-quinary, divide-senary, divide-septenary, divide-octonary, divide-nonary, divide-denary, divide-dark, divide-lightborder-color: var(--tw-color-primary);
border-color: var(--tw-color-secondary);
etc.
ring-background, ring-foreground, ring-primary, ring-secondary, ring-tertiary, ring-quaternary, ring-quinary, ring-senary, ring-septenary, ring-octonary, ring-nonary, ring-denary, ring-dark, ring-light--tw-ring-color: var(--tw-color-primary);
--tw-ring-color: var(--tw-color-secondary);
etc.
from-background, from-foreground, from-primary, from-secondary, from-tertiary, from-quaternary, from-quinary, from-senary, from-septenary, from-octonary, from-nonary, from-denary, from-dark, from-light--tw-gradient-from: var(--tw-color-primary);
--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to, rgba(255,255,255,0));
to-background, to-foreground, to-primary, to-secondary, to-tertiary, to-quaternary, to-quinary, to-senary, to-septenary, to-octonary, to-nonary, to-denary, to-dark, to-light--tw-gradient-to: var(--tw-color-primary);
via-background, via-foreground, via-primary, via-secondary, via-tertiary, via-quaternary, via-quinary, via-senary, via-septenary, via-ocvianary, via-nonary, via-denary, via-dark, via-light--tw-gradient-stops: var(--tw-gradient-from), var(--tw-color-primary), var(--tw-gradient-to, rgba(255,255,255,0) );

font

Font family utilities are also found in TailwindCSS and we’ve included all of the default font family utilities ( font-sans, font-serif, font-mono ).

We’ve also included 2 contextual font-family utilities (heading & body) and 3 custom font-family slots that follow a similar naming pattern as the colors, sequentially following the naming pattern of primary (1st), secondary (2nd), and tertiary (3rd).

There is a caveat to the font configuration settings. The font-family that you use needs to be available on your site, such as through a plugin or theme. We’ve included ALL the google fonts so you should have lots of options 🙂

Class NameProperty Value
font-headingvar(–tw-font-heading)
font-bodyvar(–tw-font-body)
font-primaryvar(--tw-font-primary);
font-secondaryvar(--tw-font-secondary);
font-tertiaryvar(--tw-font-tertiary);

WordPress Specific Utilities

We’ve baked in one WordPress specific utility classes that you won’t find in the TailwindCSS documentation.

flex-basis

The flex-basis utility classes are for using with core column blocks. Core column blocks use flex-basis for their sizing, so we added flex-basis so you can easily add responsive styling to columns.

IMPORTANT – This has since been added to TailwindCSS v3+. I’m leaving it here b/c it’s an important utility for responsively styling gutenberg column blocks.

Class NameProperty Value
basis-1/2flex-basis:50%;
basis-1/3flex-basis:33.333333%;
basis-2/3flex-basis:66.666667%;
basis-1/4flex-basis:25%;
basis-2/4flex-basis:50%;
basis-3/4flex-basis:75%;
basis-1/5flex-basis:20%;
basis-2/5flex-basis:40%;
basis-3/5flex-basis:60%;
basis-4/5flex-basis:80%;
basis-1/6flex-basis:16.666667%;
basis-2/6flex-basis:33.333333%;
basis-3/6flex-basis:50%;
basis-4/6flex-basis:66.666667%;
basis-5/6flex-basis:83.333333%;
basis-1/12flex-basis:8.333333%;
basis-2/12flex-basis:16.666667%;
basis-3/12flex-basis:25%;
basis-4/12flex-basis:33.333333%;
basis-5/12flex-basis:41.666667%;
basis-6/12flex-basis:50%;
basis-7/12flex-basis:58.333333%;
basis-8/12flex-basis:67.666667%;
basis-9/12flex-basis:75%;
basis-10/12flex-basis:83.333333%;
basis-11/12flex-basis:91.666667%;
basis-fullflex-basis:100%;

Variants

Each utility class in both the Free & Pro Draft plugins comes with additional styling properties, which are called variants.

Essentially, you tack on a variant name to any utility class to apply that variants styling.

sm: & md:

Responsive Variants

In the Responsive Design section below we walk through the mobile ( sm: ), tablet ( md: ), and desktop variants and how to use them.

For example, if you wanted to apply different font sizes on mobile, tablet, and desktop you would simply apply the font size utility class you want for desktop as well as the mobile and tablet variants you want, like this:

<h1 class="tw-text-5xl md:tw-text-3xl sm:tw-text-2xl">Variants</h1>

Every utility class comes with the default utility class that applies to all device sizes and then md: variants for tablet and sm: variants for mobile.

hover: & focus: & group-hover:

State Variants

A handful of utility classes also come equipped with hover:, focus: and group-hover: variants for doing things such as adding alternate background colors for buttons on hover.

An example of using these variants could be:

<button class="tw-bg-primary hover:tw-bg-secondary">Hover Variants</button>

You can also use each of these variants in combination with any of the device breakpoint variants:

<button class="tw-bg-primary hover:tw-bg-secondary sm:hover:tw-bg-accent">Hover Variants</button>

child: & logged-in:

WordPress Specific Variants

There are two custom variants that we added called :child & :logged-in.

The :child variant gives you the ability to apply certain utilities to the children of a parent element. We added this mainly for styling the padding & display properties of the core button block in WordPress.

This would look something like this and would apply padding to the button’s child element:

<button class="child:tw-px-12 md:child:tw-py-8 sm:child:tw-px-8 sm:child:tw-py-4"><a>Hover Variants</a></button>

The :logged-in variant gives you the ability to apply certain utilities when a user is logged in. We added this for displaying certain page elements when someone is logged in/out or for accounting for the admin bar.

Here’s an example we use to apply specific styling to a header when someone is logged in:

<!-- wp:template-part {"className":"tw-fixed tw-w-full logged-in:tw-top-8 md:logged-in:tw-top-11.5 tw-z-20 tw-bg-gradient-to-b tw-from-neutral","slug":"header","tagName":"header"} /-->

sm: & md: & hover: & focus: & group-hover: & logged-in: & child:

All the Variants

Below are all the utility classes and their variants:

accessibilityresponsive
alignContentresponsive
alignItemsresponsive
alignSelfresponsive
animationresponsive
appearanceresponsive
backdropBlurresponsive
backdropBrightnessresponsive
backdropContrastresponsive
backdropFilterresponsive
backdropGrayscaleresponsive
backdropHueRotateresponsive
backdropInvertresponsive
backdropSaturateresponsive
backdropSepiaresponsive
backgroundAttachmentresponsive
backgroundBlendModeresponsive
backgroundClipresponsive
backgroundColorresponsive, hover, focus, group-hover
backgroundImageresponsive
backgroundOpacityresponsive, hover, focus, group-hover
backgroundPositionresponsive
backgroundRepeatresponsive
backgroundSizeresponsive
backgroundOriginresponsive
blurresponsive
borderCollapseresponsive
borderColorresponsive, hover, focus, group-hover
borderOpacityresponsive, hover, focus, group-hover
borderRadiusresponsive
borderStyleresponsive
borderWidthresponsive
boxDecorationBreakresponsive
boxShadowresponsive, hover, focus, group-hover
boxSizingresponsive
brightnessresponsive
clearresponsive
containerresponsive
contrastresponsive
cursorresponsive
displayresponsive, child
divideColorresponsive
divideOpacityresponsive
divideStyleresponsive
divideWidthresponsive
dropShadowresponsive
fillresponsive
filterresponsive
flexresponsive
flexDirectionresponsive
flexGrowresponsive, child
flexShrinkresponsive
flexWrapresponsive
floatresponsive
fontFamilyresponsive
fontSizeresponsive
fontSmoothingresponsive
fontStyleresponsive
fontVariantNumericresponsive
fontWeightresponsive
gapresponsive
gradientColorStopsresponsive, hover, focus
grayscaleresponsive
gridAutoColumnsresponsive
gridAutoFlowresponsive
gridAutoRowsresponsive
gridColumnresponsive
gridColumnEndresponsive
gridColumnStartresponsive
gridRowresponsive
gridRowEndresponsive
gridRowStartresponsive
gridTemplateColumnsresponsive
gridTemplateRowsresponsive
heightresponsive
hueRotateresponsive
insetresponsive
invertresponsive
isolationresponsive
justifyContentresponsive
justifyItemsresponsive
justifySelfresponsive
letterSpacingresponsive
lineHeightresponsive
listStylePositionresponsive
listStyleTyperesponsive
marginresponsive
maxHeightresponsive
maxWidthresponsive
minHeightresponsive
minWidthresponsive
mixBlendModeresponsive
objectFitresponsive
objectPositionresponsive
opacityresponsive, hover, focus, group-hover
orderresponsive
outlineresponsive, focus
overflowresponsive
overscrollBehaviorresponsive
paddingresponsive, child
placeContentresponsive
placeItemsresponsive
placeSelfresponsive
placeholderColorresponsive, focus
placeholderOpacityresponsive, focus
pointerEventsresponsive
positionresponsive
resizeresponsive
ringColorresponsive, focus
ringOffsetColorresponsive, focus
ringOffsetWidthresponsive, focus
ringOpacityresponsive, focus
ringWidthresponsive, focus
rotateresponsive, hover
saturateresponsive
scaleresponsive, hover
sepiaresponsive
skewresponsive, hover
spaceresponsive
strokeresponsive
strokeWidthresponsive
tableLayoutresponsive
textAlignresponsive
textColorresponsive, hover, focus, group-hover
textDecorationresponsive, hover, focus, group-hover
textOpacityresponsive, hover, focus, group-hover
textOverflowresponsive
textTransformresponsive
transformOriginresponsive
transitionDelayresponsive
transitionDurationresponsive
transitionPropertyresponsive
transitionTimingFunctionresponsive
translateresponsive, hover
userSelectresponsive
verticalAlignresponsive
visibilityresponsive
whitespaceresponsive
widthresponsive
wordBreakresponsive
zIndexresponsive, hover

Responsive Design

You can easily apply different utility classes depending on what device the website is being viewed on.

To apply a different utility class depending on the device, simply select Mobile, Tablet, or Desktop:

Any utility classes added for Desktop devices apply to ALL device sizes. You can then override the Desktop utility class on Tablet or Mobile by choosing a utility from either of these categories.

The device breakpoints are:

  • Mobile ( sm: ) 767px
  • Tablet ( md: ) 1023px
  • Desktop All Screen Sizes

If you’re familiar with responsive website design/development, the Draft plugin uses a max-width ( desktop 1st ) break-point strategy, as opposed to a min-width ( mobile 1st ) breakpoint strategy. We’re assuming most WordPress website editing happens from a desktop computer.