All utilities accept values and return a StyleRule. Use them with tw (chainable) or cx() (functional). Most accept Tailwind-style string lookups directly.
Numbers map to the spacing scale (4 = 1rem, each unit = 0.25rem). Strings pass through as raw CSS.
Utility CSS Property p(value)paddingpx(value)padding-left, padding-rightpy(value)padding-top, padding-bottompt(value), pr(value), pb(value), pl(value)Individual sides
tw . px ( 6 ) // padding-left: 1.5rem; padding-right: 1.5rem
tw . py ( ' 10px ' ) // padding-top: 10px; padding-bottom: 10px
Utility CSS Property m(value)marginmx(value)margin-left, margin-rightmy(value)margin-top, margin-bottommt(value), mr(value), mb(value), ml(value)Individual sides
tw . mx ( ' auto ' ) // margin-left: auto; margin-right: auto
Utility CSS Property gap(value)gapgapX(value)column-gapgapY(value)row-gap
tw . gapX ( 2 ) // column-gap: 0.5rem
Accept raw CSS color strings or Tailwind-style string lookups like 'blue-500'.
Utility CSS Property bg(color)background-colortextColor(color)colorborderColor(color)border-color
tw . bg ( ' blue-500 ' ) // background-color: #3b82f6
tw . textColor ( ' gray-900 ' ) // color: #111827
tw . borderColor ( ' gray-200 ' ) // border-color: #e5e7eb
tw . bg ( ' transparent ' ) // background-color: transparent
Utility CSS Property Notes text(size)font-size + line-heightRequires TextSize import for preset sizes font(weight)font-weightAccepts 'bold', 'semibold', '700', etc. tracking(value)letter-spacingleading(value)line-heighttextAlign(value)text-align
import { lg, _2xl } from ' typewritingclass/theme/typography '
tw . text (lg) // font-size: 1.125rem; line-height: 1.75rem
tw . font ( ' bold ' ) // font-weight: 700
tw . font ( ' semibold ' ) // font-weight: 600
tw . tracking ( ' -0.025em ' ) // letter-spacing: -0.025em
tw . textAlign ( ' center ' ) // text-align: center
Utility CSS flex()display: flexflexCol()display: flex; flex-direction: columnflexRow()display: flex; flex-direction: rowflexWrap()flex-wrap: wrapinlineFlex()display: inline-flex
tw . flex . items ( ' center ' ) . justify ( ' space-between ' )
Utility CSS grid(cols?)display: grid (optionally with columns)gridCols(n)grid-template-columns: repeat(n, ...)gridRows(n)grid-template-rows: repeat(n, ...)
tw . grid ( 3 ) . gap ( 4 ) // 3-column grid with 1rem gap
Utility CSS Property w(value)widthh(value)heightsize(value)width + heightminW(value), minH(value)min-width, min-heightmaxW(value), maxH(value)max-width, max-height
tw . size ( 10 ) // width: 2.5rem; height: 2.5rem
Utility CSS Property items(value)align-itemsjustify(value)justify-contentself(value)align-self
Utility CSS Property overflow(value)overflowoverflowX(value)overflow-xoverflowY(value)overflow-y
Utility CSS relative()position: relativeabsolute()position: absolutefixed()position: fixedsticky()position: stickytop(value), right(value), bottom(value), left(value)Offsets inset(value)inset shorthandz(value)z-indexdisplay(value)display
tw . fixed . top ( 0 ) . left ( 0 ) . w ( ' full ' )
Utility CSS Property rounded(value?)border-radius (default: 0.25rem)roundedT(value?), roundedB(value?), roundedL(value?), roundedR(value?)Corner-specific border(width?)border-width + border-style: solid (default: 1px)borderT(width?), borderR(width?), borderB(width?), borderL(width?)Side-specific ring(width?, color?)box-shadow as focus ring (default: 3px, #3b82f6)
tw . rounded ( ' lg ' ) // border-radius: 0.5rem
tw . rounded ( ' full ' ) // border-radius: 9999px
tw . border () . borderColor ( ' gray-200 ' )
tw . focusVisible . ring ( ' 2px ' , ' #3b82f6 ' )
Utility CSS Property shadow(value?)box-shadowopacity(value)opacity (0-1)backdrop(value)backdrop-filter
tw . shadow ( ' md ' ) // medium shadow
tw . shadow ( ' lg ' ) . hover . shadow ( ' xl ' )
Shadow accepts string lookups: 'sm', 'md', 'lg', 'xl', '2xl', 'inner', 'none'.
Utility CSS Property cursor(value)cursorselect(value)user-selectpointerEvents(value)pointer-events
All utilities that accept DynamicValue work with dcx():
import { dcx, bg, rounded, p, dynamic } from ' typewritingclass '
const { className , style } = dcx (
rounded ( dynamic (radius)) ,
< div className = {className} style = {style} />
. bg ( ' white ' ) . rounded ( ' xl ' ) . p ( 6 ) . shadow ( ' md ' )
. hover (tw . shadow ( ' lg ' ) . bg ( ' gray-50 ' ))
< div className = {card} > Card content </ div >