style

package
v1.0.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 3, 2026 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrUnknownClass = errors.New("emission: class is not part of tw's enumerable universe")

ErrUnknownClass reports a class outside the enumerable universe.

View Source
var ErrUnsupportedState = errors.New("emission: state prefix has no CSS mapping")

ErrUnsupportedState reports a state prefix with no defined CSS mapping yet.

Functions

func For

func For(lists ...ClassList) (*css.Sheet, error)

For emits the rules for exactly the classes the given lists compile to, prefixed variants included. This is the deterministic, Go-native alternative to source scanning: components declare their ClassLists, and the stylesheet is derived from those declarations.

func RoleVars

func RoleVars() *css.Sheet

RoleVars emits the :root block mapping every tw color role to the design system's token variables, plus the keyframes the animate-* utilities reference. Serve it after the theme's token block and before the utilities.

func Rules

func Rules(classes ...string) (*css.Sheet, error)

Rules emits the CSS rules for the given compiled class strings, prefixed forms included ("md:hover:bg-surface-brand"). Unknown classes and unsupported state prefixes fail closed with an error naming the class.

Types

type BorderStyle

type BorderStyle string

BorderStyle is a typed border-style utility (dashed / solid / dotted). The Border() method sets width + base "border"; BorderStyle() layers the style on top.

const (
	BorderSolid  BorderStyle = "solid"
	BorderDashed BorderStyle = "dashed"
	BorderDotted BorderStyle = "dotted"
	BorderDouble BorderStyle = "double"
	BorderHidden BorderStyle = "hidden"
	BorderNone   BorderStyle = "none"
)

func AllBorderStyles

func AllBorderStyles() []BorderStyle

AllBorderStyles returns every BorderStyle const in stable order.

type BorderWidth

type BorderWidth string

BorderWidth is a typed border thickness step.

const (
	Border0 BorderWidth = "0"
	Border1 BorderWidth = ""  // base `border` class, no suffix
	Border2 BorderWidth = "2" // border-2
	Border4 BorderWidth = "4"
	Border8 BorderWidth = "8"
)

func AllBorderWidths

func AllBorderWidths() []BorderWidth

AllBorderWidths returns every BorderWidth in stable order.

type Breakpoint

type Breakpoint string

Breakpoint is a typed responsive breakpoint (Tailwind defaults).

const (
	BreakpointSM Breakpoint = "sm" // >= 640px
	BreakpointLG Breakpoint = "lg" // >= 1024px
)

The two breakpoints this application lays out at. Three more were declared and nothing ever named one; a component that needs md:, xl: or 2xl: adds it back where it uses it.

func (Breakpoint) Prefix

func (b Breakpoint) Prefix() string

Prefix returns the Tailwind breakpoint prefix including the trailing colon, e.g. "sm:". Zero value returns empty string (no prefix).

type ClassList

type ClassList struct {
	// contains filtered or unexported fields
}

ClassList is an immutable, composable typed builder for Tailwind class strings. Every method returns a new ClassList; the builder itself holds no resolved strings until Compile() is called.

The IR is a flat slice of segments. A segment is either:

  • A utility class (resolved at append time, already a string)
  • A prefix frame (opens a group like "hover:") and its end marker

This flat design lets Compile() walk the segments once, tracking the active prefix stack, and emit the final space-separated output in O(n).

func New

func New() ClassList

New returns an empty ClassList.

func (ClassList) Accent

func (cl ClassList) Accent(c Color) ClassList

Accent applies an accent color (Tailwind's "accent-*"). Used by form controls like range inputs and checkboxes to tint the native chrome with a design-system color.

func (ClassList) AnimatePulse

func (cl ClassList) AnimatePulse() ClassList

AnimatePulse applies Tailwind's "animate-pulse" utility.

func (ClassList) AnimateSpin

func (cl ClassList) AnimateSpin() ClassList

AnimateSpin applies Tailwind's "animate-spin" utility.

func (ClassList) AppearanceNone

func (cl ClassList) AppearanceNone() ClassList

AppearanceNone removes native OS chrome from form controls.

func (ClassList) AspectSquare

func (cl ClassList) AspectSquare() ClassList

AspectSquare / AspectVideo set aspect-ratio.

func (ClassList) AspectVideo

func (cl ClassList) AspectVideo() ClassList

func (ClassList) Bg

func (cl ClassList) Bg(c Color) ClassList

Bg applies a background color.

func (ClassList) BgOpacity

func (cl ClassList) BgOpacity(c Color, opacity string) ClassList

BgOpacity sets a background color with an alpha modifier, e.g. Bg(SurfaceOverlay, "75") → "bg-surface-overlay/75".

func (ClassList) Border

func (cl ClassList) Border(b BorderWidth) ClassList

Border applies a border width (use BorderColor for the color). The zero BorderWidth (Border1) emits the base "border" class.

func (ClassList) BorderBottom

func (cl ClassList) BorderBottom(b BorderWidth) ClassList

func (ClassList) BorderBottomColor

func (cl ClassList) BorderBottomColor(c Color) ClassList

func (ClassList) BorderColor

func (cl ClassList) BorderColor(c Color) ClassList

BorderColor applies a border color.

func (ClassList) BorderLeft

func (cl ClassList) BorderLeft(b BorderWidth) ClassList

func (ClassList) BorderLeftColor

func (cl ClassList) BorderLeftColor(c Color) ClassList

func (ClassList) BorderRight

func (cl ClassList) BorderRight(b BorderWidth) ClassList

func (ClassList) BorderRightColor

func (cl ClassList) BorderRightColor(c Color) ClassList

func (ClassList) BorderStyle

func (cl ClassList) BorderStyle(b BorderStyle) ClassList

BorderStyle applies a border-style utility (e.g., border-dashed). Use alongside Border() for width and BorderColor() for color.

func (ClassList) BorderTop

func (cl ClassList) BorderTop(b BorderWidth) ClassList

BorderTop / BorderBottom / BorderLeft / BorderRight apply a one-side border width. Pass Border1 for the default thickness.

func (ClassList) BorderTopColor

func (cl ClassList) BorderTopColor(c Color) ClassList

BorderTopColor / BorderBottomColor / BorderLeftColor / BorderRightColor apply a per-side border color, e.g. BorderTopColor(ColorWhite) → "border-t-white". Use alongside BorderTop etc. for the width.

func (ClassList) Bottom

func (cl ClassList) Bottom(s Spacing) ClassList

func (ClassList) BottomOffset

func (cl ClassList) BottomOffset(v PositionOffset) ClassList

func (ClassList) BreakAll

func (cl ClassList) BreakAll() ClassList

BreakAll lets a browser break a line at any character (Tailwind's "break-all"). Use for user-supplied long tokens like hashes / URLs.

func (ClassList) BreakWords

func (cl ClassList) BreakWords() ClassList

BreakWords allows long words to break.

func (ClassList) Breakpoint

func (cl ClassList) Breakpoint(bp Breakpoint, build func(ClassList) ClassList) ClassList

Breakpoint wraps the build function's output in a responsive prefix (e.g., "sm:"). Nested Breakpoint calls are supported.

func (ClassList) Capitalize

func (cl ClassList) Capitalize() ClassList

func (ClassList) ColSpan

func (cl ClassList) ColSpan(n int) ClassList

ColSpan applies a CSS grid column span ("col-span-N"). N must be positive; 0 or negative → empty.

func (ClassList) ColSpanFull

func (cl ClassList) ColSpanFull() ClassList

ColSpanFull emits Tailwind's "col-span-full" — span every column of the current grid regardless of column count. Distinct from ColSpan(N) which takes a numeric count.

func (ClassList) Compile

func (cl ClassList) Compile() string

Compile resolves the builder into a space-separated Tailwind class string. Output is deterministic and matches the append order. Prefix frames apply their prefix to each utility class between the open/close markers.

func (ClassList) Cursor

func (cl ClassList) Cursor(c Cursor) ClassList

Cursor applies a cursor style.

func (ClassList) Display

func (cl ClassList) Display(d Display) ClassList

Display sets the CSS display mode (flex, grid, block, etc.).

func (ClassList) DivideX

func (cl ClassList) DivideX(s Spacing) ClassList

DivideX / DivideY add borders between adjacent children. Pass empty Spacing for default; pass a Spacing const for a specific width.

func (ClassList) DivideY

func (cl ClassList) DivideY(s Spacing) ClassList

func (ClassList) Duration

func (cl ClassList) Duration(d Duration) ClassList

Duration applies a transition duration.

func (ClassList) Easing

func (cl ClassList) Easing(e Easing) ClassList

Easing applies a transition easing curve.

func (ClassList) Flex1

func (cl ClassList) Flex1() ClassList

Flex1 makes a flex child fill available space — Tailwind's "flex-1".

func (ClassList) FlexDir

func (cl ClassList) FlexDir(f FlexDir) ClassList

FlexDir sets flex-direction.

func (ClassList) FlexGrow

func (cl ClassList) FlexGrow() ClassList

func (ClassList) FlexGrow0

func (cl ClassList) FlexGrow0() ClassList

func (ClassList) FlexNoWrap

func (cl ClassList) FlexNoWrap() ClassList

FlexNoWrap forces all flex children onto a single line — Tailwind's "flex-nowrap" utility. Use alongside Overflow to show a scroll when items exceed the container.

func (ClassList) FlexNone

func (cl ClassList) FlexNone() ClassList

FlexGrow / FlexGrow0 toggle the flex-grow property. FlexNone prevents a flex child from growing or shrinking — Tailwind's "flex-none" utility.

func (ClassList) FlexShrink0

func (cl ClassList) FlexShrink0() ClassList

FlexShrink0 prevents a flex child from shrinking below its intrinsic size — Tailwind's "flex-shrink-0" utility.

func (ClassList) FlexWrap

func (cl ClassList) FlexWrap() ClassList

FlexWrap allows flex children to wrap to the next line — Tailwind's "flex-wrap" utility. Complements FlexDir for multi-line flex rows.

func (ClassList) FontFamily

func (cl ClassList) FontFamily(f FontFamily) ClassList

FontFamily applies a font-family (Tailwind's font-sans/serif/mono).

func (ClassList) FontSize

func (cl ClassList) FontSize(f FontSize) ClassList

FontSize applies a text-size step.

func (ClassList) FontWeight

func (cl ClassList) FontWeight(f FontWeight) ClassList

FontWeight applies a font-weight.

func (ClassList) Gap

func (cl ClassList) Gap(s Spacing) ClassList

Gap sets flex/grid gap.

func (ClassList) GapX

func (cl ClassList) GapX(s Spacing) ClassList

GapX / GapY set axis-specific flex/grid gaps (gap-x-*, gap-y-*).

func (ClassList) GapY

func (cl ClassList) GapY(s Spacing) ClassList

func (ClassList) GridCols

func (cl ClassList) GridCols(n int) ClassList

GridCols applies a CSS grid template with N equally-sized columns ("grid-cols-N"). Use together with Display(DisplayGrid).

func (ClassList) Group

func (cl ClassList) Group() ClassList

Group / Peer apply Tailwind's variant-enabler utilities. A parent with `group` exposes `group-hover:*` / `group-focus:*` to descendants; `peer` does the same for siblings via `peer-*`.

func (ClassList) Height

func (cl ClassList) Height(s Spacing) ClassList

Height sets height.

func (ClassList) HeightViewport

func (cl ClassList) HeightViewport(v ViewportHeight) ClassList

HeightViewport sets a height from the governed viewport-relative scale.

func (ClassList) Inset

func (cl ClassList) Inset(s Spacing) ClassList

Inset applies an offset to all four sides.

func (ClassList) InsetX

func (cl ClassList) InsetX(s Spacing) ClassList

InsetX / InsetY apply to horizontal / vertical pairs.

func (ClassList) InsetY

func (cl ClassList) InsetY(s Spacing) ClassList

func (ClassList) IsEmpty

func (cl ClassList) IsEmpty() bool

IsEmpty reports whether the builder has no segments.

func (ClassList) Italic

func (cl ClassList) Italic() ClassList

Italic / NotItalic set font-style.

func (ClassList) Items

func (cl ClassList) Items(i Items) ClassList

Items sets align-items.

func (ClassList) Justify

func (cl ClassList) Justify(j Justify) ClassList

Justify sets justify-content.

func (ClassList) Leading

func (cl ClassList) Leading(l Leading) ClassList

Leading applies a line-height step.

func (ClassList) Left

func (cl ClassList) Left(s Spacing) ClassList

func (ClassList) LeftOffset

func (cl ClassList) LeftOffset(v PositionOffset) ClassList

LeftOffset / RightOffset / TopOffset / BottomOffset apply one governed fractional overlay position. Unlike the Raw forms, every accepted value is part of emission's closed utility universe.

func (ClassList) LineClamp

func (cl ClassList) LineClamp(n int) ClassList

LineClamp truncates a paragraph after N lines (Tailwind's "line-clamp-N"). Use N >= 1; N == 0 emits "line-clamp-none".

func (ClassList) LineThrough

func (cl ClassList) LineThrough() ClassList

LineThrough / NotLineThrough set the line-through text-decoration.

func (ClassList) ListStyle

func (cl ClassList) ListStyle(style string) ClassList

ListStyle sets list-style-type (decimal/disc/none).

func (ClassList) Lowercase

func (cl ClassList) Lowercase() ClassList

func (ClassList) Margin

func (cl ClassList) Margin(s Spacing) ClassList

Margin sets margin on all sides.

func (ClassList) MarginBottom

func (cl ClassList) MarginBottom(s Spacing) ClassList

func (ClassList) MarginLeft

func (cl ClassList) MarginLeft(s Spacing) ClassList

MarginLeft / MarginRight / MarginTop / MarginBottom — per-side margin.

func (ClassList) MarginRight

func (cl ClassList) MarginRight(s Spacing) ClassList

func (ClassList) MarginTop

func (cl ClassList) MarginTop(s Spacing) ClassList

func (ClassList) MarginX

func (cl ClassList) MarginX(s Spacing) ClassList

MarginX sets horizontal margin.

func (ClassList) MarginY

func (cl ClassList) MarginY(s Spacing) ClassList

MarginY sets vertical margin.

func (ClassList) MaxHeight

func (cl ClassList) MaxHeight(s Spacing) ClassList

MaxHeight sets max-height from the governed spacing scale.

func (ClassList) MaxHeightViewport

func (cl ClassList) MaxHeightViewport(v ViewportHeight) ClassList

MaxHeightViewport sets a max-height from the governed viewport-relative scale.

func (ClassList) MaxWScaled

func (cl ClassList) MaxWScaled(name MaxWidth) ClassList

MaxWScaled applies Tailwind's named max-width scale via a typed handle. Distinct from MaxW which takes an untyped string.

func (ClassList) Merge

func (cl ClassList) Merge(other ClassList) ClassList

Merge appends another ClassList to this one.

func (ClassList) MinHeight

func (cl ClassList) MinHeight(s Spacing) ClassList

MinHeight sets min-height.

func (ClassList) MinHeightScreen

func (cl ClassList) MinHeightScreen() ClassList

MinHeightScreen is min-h-screen: at least the viewport. It is not a Spacing step, so it is a method of its own rather than a value MinHeight takes.

func (ClassList) MinWidth

func (cl ClassList) MinWidth(s Spacing) ClassList

MinWidth sets min-width.

func (ClassList) NegBottom

func (cl ClassList) NegBottom(s Spacing) ClassList

func (ClassList) NegLeft

func (cl ClassList) NegLeft(s Spacing) ClassList

func (ClassList) NegMargin

func (cl ClassList) NegMargin(side string, s Spacing) ClassList

NegMargin sets a negative margin on the requested side. side is one of "" (all sides), "t", "b", "l", "r", "x", "y".

func (ClassList) NegRight

func (cl ClassList) NegRight(s Spacing) ClassList

func (ClassList) NegTop

func (cl ClassList) NegTop(s Spacing) ClassList

NegTop / NegRight / NegBottom / NegLeft apply a negative positional offset on the Spacing scale (e.g., NegTop(tw.S1) emits "-top-1"). Used by badge and pill patterns that sit outside the parent's bounding box.

func (ClassList) NoLineThrough

func (cl ClassList) NoLineThrough() ClassList

func (ClassList) NoUnderline

func (cl ClassList) NoUnderline() ClassList

NoUnderline removes underline text-decoration.

func (ClassList) NormalCase

func (cl ClassList) NormalCase() ClassList

func (ClassList) NotItalic

func (cl ClassList) NotItalic() ClassList

func (ClassList) NotSrOnly

func (cl ClassList) NotSrOnly() ClassList

NotSrOnly undoes SrOnly, which is what a skip link needs: hidden until it is focused, and then a real control in the corner of the page.

func (ClassList) ObjectContain

func (cl ClassList) ObjectContain() ClassList

ObjectContain applies Tailwind's "object-contain" utility — scales the content to fit without cropping.

func (ClassList) ObjectCover

func (cl ClassList) ObjectCover() ClassList

ObjectCover is a shorthand for ObjectFit("cover").

func (ClassList) On

func (cl ClassList) On(state State, build func(ClassList) ClassList) ClassList

On wraps the build function's output in a state prefix (e.g., "hover:"). Nested On calls are supported and prefixes stack in order.

func (ClassList) Opacity

func (cl ClassList) Opacity(o Opacity) ClassList

Opacity applies an opacity percentage.

func (ClassList) Outline

func (cl ClassList) Outline(o Outline) ClassList

Outline applies an outline style.

func (ClassList) Overflow

func (cl ClassList) Overflow(o Overflow) ClassList

Overflow sets overflow on both axes.

func (ClassList) OverflowX

func (cl ClassList) OverflowX(o Overflow) ClassList

OverflowX / OverflowY apply axis-specific overflow.

func (ClassList) OverflowY

func (cl ClassList) OverflowY(o Overflow) ClassList

func (ClassList) OverscrollContain

func (cl ClassList) OverscrollContain() ClassList

OverscrollContain sets overscroll-behavior to contain (Tailwind's "overscroll-contain"). Prevents scroll chaining out of a container.

func (ClassList) Padding

func (cl ClassList) Padding(s Spacing) ClassList

Padding sets padding on all sides.

func (ClassList) PaddingBottom

func (cl ClassList) PaddingBottom(s Spacing) ClassList

func (ClassList) PaddingLeft

func (cl ClassList) PaddingLeft(s Spacing) ClassList

PaddingLeft / PaddingRight / PaddingTop / PaddingBottom — per-side padding.

func (ClassList) PaddingRight

func (cl ClassList) PaddingRight(s Spacing) ClassList

func (ClassList) PaddingTop

func (cl ClassList) PaddingTop(s Spacing) ClassList

func (ClassList) PaddingX

func (cl ClassList) PaddingX(s Spacing) ClassList

PaddingX sets horizontal padding.

func (ClassList) PaddingY

func (cl ClassList) PaddingY(s Spacing) ClassList

PaddingY sets vertical padding.

func (ClassList) Peer

func (cl ClassList) Peer() ClassList

func (ClassList) PointerEvents

func (cl ClassList) PointerEvents(p PointerEvents) ClassList

PointerEvents applies a pointer-events style.

func (ClassList) Position

func (cl ClassList) Position(p Position) ClassList

Position sets CSS position.

func (ClassList) Raw

func (cl ClassList) Raw(classes string) ClassList

Raw is the escape hatch. Pass pre-audited Tailwind classes straight through. Use only for runtime-computed values (e.g., HTMX attributes) or incremental migration; the typed tables and All* enumerators linter watches this.

func (ClassList) Relative

func (cl ClassList) Relative() ClassList

Relative is a shorthand for Position(PositionRelative).

func (ClassList) Resize

func (cl ClassList) Resize(mode ResizeMode) ClassList

Resize applies a textarea-resize mode (`none` / `y` / `x` / `both`).

func (ClassList) ResizeNone

func (cl ClassList) ResizeNone() ClassList

ResizeNone is a shorthand for Resize(ResizeModeNone): disables the textarea resize handle entirely.

func (ClassList) ResizeY

func (cl ClassList) ResizeY() ClassList

ResizeY is a shorthand for Resize(ResizeModeY): allows vertical resize only (the default for auto-grow textareas).

func (ClassList) Right

func (cl ClassList) Right(s Spacing) ClassList

func (ClassList) RightOffset

func (cl ClassList) RightOffset(v PositionOffset) ClassList

func (ClassList) Ring

func (cl ClassList) Ring(r RingWidth) ClassList

Ring applies a focus-ring width (use RingColor for the color).

func (ClassList) RingColor

func (cl ClassList) RingColor(c Color) ClassList

RingColor applies a ring color.

func (ClassList) RingInset

func (cl ClassList) RingInset() ClassList

RingInset makes the focus ring draw on the inside edge of the element — Tailwind's "ring-inset" utility.

func (ClassList) RingOffset

func (cl ClassList) RingOffset(r RingOffset) ClassList

RingOffset applies a ring offset width.

func (ClassList) Rotate

func (cl ClassList) Rotate(deg string) ClassList

Rotate sets a Tailwind rotate-* transform. deg is a numeric step like "45", "90", "180" matching the Tailwind rotate scale.

func (ClassList) Rounded

func (cl ClassList) Rounded(r Radius) ClassList

Rounded applies a border-radius step. RadiusBase emits "rounded".

func (ClassList) RoundedBottom

func (cl ClassList) RoundedBottom(r Radius) ClassList

func (ClassList) RoundedLeft

func (cl ClassList) RoundedLeft(r Radius) ClassList

func (ClassList) RoundedRight

func (cl ClassList) RoundedRight(r Radius) ClassList

func (ClassList) RoundedTop

func (cl ClassList) RoundedTop(r Radius) ClassList

RoundedTop / RoundedBottom / RoundedLeft / RoundedRight apply a per-side border-radius step. Use Rounded(...) for all four corners.

func (ClassList) Shadow

func (cl ClassList) Shadow(s Shadow) ClassList

Shadow applies a box-shadow step. ShadowBase emits "shadow".

func (ClassList) SpaceX

func (cl ClassList) SpaceX(s Spacing) ClassList

SpaceX / SpaceY add horizontal / vertical spacing between adjacent sibling elements (Tailwind's "space-x-*" / "space-y-*").

func (ClassList) SpaceY

func (cl ClassList) SpaceY(s Spacing) ClassList

func (ClassList) SrOnly

func (cl ClassList) SrOnly() ClassList

SrOnly makes content accessible only to screen readers.

func (ClassList) TabularNums

func (cl ClassList) TabularNums() ClassList

TabularNums applies Tailwind's "tabular-nums" font-variant-numeric utility — forces fixed-width digits, used by counter displays.

func (ClassList) TextAlign

func (cl ClassList) TextAlign(t TextAlign) ClassList

TextAlign applies a text-align.

func (ClassList) TextColor

func (cl ClassList) TextColor(c Color) ClassList

TextColor applies a foreground color. (Named TextColor rather than Text to avoid collision with FontSize.)

func (ClassList) Top

func (cl ClassList) Top(s Spacing) ClassList

Positional offsets. Apply to an absolutely/fixed positioned element (call Position first). Use Spacing consts (including SPX/S0) so the offset flows from the same scale as padding/margin.

func (ClassList) TopOffset

func (cl ClassList) TopOffset(v PositionOffset) ClassList

func (ClassList) Tracking

func (cl ClassList) Tracking(t Tracking) ClassList

Tracking applies a letter-spacing step.

func (ClassList) Transform

func (cl ClassList) Transform() ClassList

Transform opts the element into Tailwind's transform utility surface. Required when applying translate/rotate/scale via utility classes in Tailwind v2-compatible output.

func (ClassList) Transition

func (cl ClassList) Transition(t Transition) ClassList

Transition applies a transition property group.

func (ClassList) TranslateX

func (cl ClassList) TranslateX(t Translate) ClassList

TranslateX applies a horizontal translate via the Translate enum.

func (ClassList) TranslateXStep

func (cl ClassList) TranslateXStep(s Spacing) ClassList

TranslateXStep applies a horizontal translate using the Spacing scale (e.g., tw.S5 → "translate-x-5"). Use this when the offset lines up with the platform spacing scale; use TranslateX for negative/fractional offsets outside the scale.

func (ClassList) TranslateY

func (cl ClassList) TranslateY(t Translate) ClassList

TranslateY applies a vertical translate via the Translate enum (handles negative offsets like TranslateNeg05).

func (ClassList) TranslateYStep

func (cl ClassList) TranslateYStep(s Spacing) ClassList

TranslateYStep — vertical equivalent of TranslateXStep.

func (ClassList) Truncate

func (cl ClassList) Truncate() ClassList

Truncate clips overflowing text with ellipsis.

func (ClassList) Underline

func (cl ClassList) Underline() ClassList

Underline applies underline text-decoration.

func (ClassList) UnderlineOffset

func (cl ClassList) UnderlineOffset(step Spacing) ClassList

UnderlineOffset sets the underline offset (Tailwind's "underline-offset-N"). Use the Spacing const names (S4, S8) for semantic offsets, or supply a raw numeric step if the design uses a non-standard value.

func (ClassList) Uppercase

func (cl ClassList) Uppercase() ClassList

Uppercase / Lowercase / Capitalize / NormalCase set text-transform. NormalCase is the default text-transform (no transform) and is required when a base class carries uppercase/lowercase/capitalize and a specific slot wants to reset to the element's natural case.

func (ClassList) UserSelect

func (cl ClassList) UserSelect(s Select) ClassList

UserSelect applies a user-select style.

func (ClassList) WhitespaceNowrap

func (cl ClassList) WhitespaceNowrap() ClassList

WhitespaceNowrap prevents text wrapping.

func (ClassList) WhitespacePreWrap

func (cl ClassList) WhitespacePreWrap() ClassList

WhitespacePreWrap preserves user whitespace and wraps long lines — Tailwind's "whitespace-pre-wrap" utility. Used by transcript and console bubbles that render AI output with embedded newlines.

func (ClassList) Width

func (cl ClassList) Width(s Spacing) ClassList

Width sets width.

func (ClassList) ZIndex

func (cl ClassList) ZIndex(z ZLayer) ClassList

ZIndex is an alias for ZLayer.

func (ClassList) ZLayer

func (cl ClassList) ZLayer(z ZLayer) ClassList

ZLayer applies a typed z-index layer.

type Color

type Color string

Color is a typed semantic color role. Values serialize to the semantic token name (e.g., "surface-primary"), not a Tailwind class fragment. The ClassList builder combines a Color with its role (background, text, border, ring) to produce the final Tailwind class.

const (
	SurfacePrimary     Color = "surface-primary"
	SurfaceSecondary   Color = "surface-secondary"
	SurfaceTertiary    Color = "surface-tertiary"
	SurfaceBrand       Color = "surface-brand"
	SurfaceBrandHover  Color = "surface-brand-hover"
	SurfaceBrandSoft   Color = "surface-brand-soft"
	SurfaceSuccess     Color = "surface-success"
	SurfaceSuccessSoft Color = "surface-success-soft"
	SurfaceWarning     Color = "surface-warning"
	SurfaceWarningSoft Color = "surface-warning-soft"
	SurfaceDanger      Color = "surface-danger"
	SurfaceDangerSoft  Color = "surface-danger-soft"
	SurfaceInfo        Color = "surface-info"
	SurfaceInfoSoft    Color = "surface-info-soft"
	SurfaceDisabled    Color = "surface-disabled"
	SurfaceHover       Color = "surface-hover"
	SurfaceActive      Color = "surface-active"
	SurfaceOverlay     Color = "surface-overlay"
	SurfaceInverse     Color = "surface-inverse"
)

Surface colors — backgrounds and filled surfaces.

const (
	FgPrimary     Color = "fg-primary"
	FgSecondary   Color = "fg-secondary"
	FgTertiary    Color = "fg-tertiary"
	FgMuted       Color = "fg-muted"
	FgPlaceholder Color = "fg-placeholder"
	FgBrand       Color = "fg-brand"
	FgOnBrand     Color = "fg-on-brand"
	FgSuccess     Color = "fg-success"
	FgWarning     Color = "fg-warning"
	FgDanger      Color = "fg-danger"
	FgInfo        Color = "fg-info"
	FgDisabled    Color = "fg-disabled"
	FgOnSurface   Color = "fg-on-surface"
	FgOnInverse   Color = "fg-on-inverse"
	FgLink        Color = "fg-link"
	FgLinkHover   Color = "fg-link-hover"
)

Foreground colors — text and icons.

const (
	BorderPrimary   Color = "border-primary"
	BorderSecondary Color = "border-secondary"
	BorderBrand     Color = "border-brand"
	BorderSuccess   Color = "border-success"
	BorderWarning   Color = "border-warning"
	BorderDanger    Color = "border-danger"
	BorderInfo      Color = "border-info"
)

Border colors — divider lines and outlines.

const (
	RingBrand  Color = "ring-brand"
	RingFocus  Color = "ring-focus"
	RingDanger Color = "ring-danger"
)

Ring colors — focus ring and highlights.

const (
	ColorWhite Color = "white"
	ColorBlack Color = "black"
)

ColorWhite / ColorBlack are Tailwind's plain neutral colors. Prefer the semantic Fg/Surface family; use these only for hard-coded contrast cases like a button's fill-on-brand text.

const ColorTransparent Color = "transparent"

ColorSpecialTransparent is a sentinel for `transparent` backgrounds. Used when a variant needs to explicitly disable a color slot (e.g., ghost/link buttons have transparent backgrounds). It compiles to "bg-transparent", "text-transparent", etc. depending on role.

func AllColors

func AllColors() []Color

AllColors returns every semantic color const in stable order. Used by the typed tables and All* enumerators to validate compile-table coverage.

type Cursor

type Cursor string

Cursor is a typed cursor style.

const (
	CursorAuto       Cursor = "auto"
	CursorDefault    Cursor = "default"
	CursorPointer    Cursor = "pointer"
	CursorWait       Cursor = "wait"
	CursorText       Cursor = "text"
	CursorMove       Cursor = "move"
	CursorHelp       Cursor = "help"
	CursorNotAllowed Cursor = "not-allowed"
	CursorProgress   Cursor = "progress"
	CursorCrosshair  Cursor = "crosshair"
	CursorGrab       Cursor = "grab"
	CursorGrabbing   Cursor = "grabbing"
)

func AllCursors

func AllCursors() []Cursor

AllCursors returns every Cursor in stable order.

type Display

type Display string

Display is a typed CSS display mode.

const (
	DisplayBlock       Display = "block"
	DisplayInline      Display = "inline"
	DisplayInlineBlock Display = "inline-block"
	DisplayFlex        Display = "flex"
	DisplayInlineFlex  Display = "inline-flex"
	DisplayGrid        Display = "grid"
	DisplayInlineGrid  Display = "inline-grid"
	DisplayHidden      Display = "hidden"
)

func AllDisplays

func AllDisplays() []Display

AllDisplays returns every Display const in stable order.

type Duration

type Duration string

Duration is a typed transition duration step.

const (
	Duration75   Duration = "75"
	Duration100  Duration = "100"
	Duration150  Duration = "150"
	Duration200  Duration = "200"
	Duration300  Duration = "300"
	Duration500  Duration = "500"
	Duration700  Duration = "700"
	Duration1000 Duration = "1000"
)

func AllDurations

func AllDurations() []Duration

AllDurations returns every Duration const in stable order.

type Easing

type Easing string

Easing is a typed transition easing curve.

const (
	EaseLinear Easing = "linear"
	EaseIn     Easing = "in"
	EaseOut    Easing = "out"
	EaseInOut  Easing = "in-out"
)

func AllEasings

func AllEasings() []Easing

AllEasings returns every Easing const in stable order.

type FlexDir

type FlexDir string

FlexDir is a typed flex-direction.

const (
	FlexRow        FlexDir = "row"
	FlexRowReverse FlexDir = "row-reverse"
	FlexCol        FlexDir = "col"
	FlexColReverse FlexDir = "col-reverse"
)

func AllFlexDirs

func AllFlexDirs() []FlexDir

AllFlexDirs returns every FlexDir const in stable order.

type FontFamily

type FontFamily string

FontFamily is a typed font-family utility (Tailwind's font-sans / font-serif / font-mono).

const (
	FontSans  FontFamily = "sans"
	FontSerif FontFamily = "serif"
	FontMono  FontFamily = "mono"
)

func AllFontFamilies

func AllFontFamilies() []FontFamily

AllFontFamilies returns every FontFamily const in stable order.

type FontSize

type FontSize string

FontSize is a typed type-scale level matching tokens.TypographyScale.

const (
	TextXS   FontSize = "xs"
	TextSM   FontSize = "sm"
	TextBase FontSize = "base"
	TextLG   FontSize = "lg"
	TextXL   FontSize = "xl"
	Text2XL  FontSize = "2xl"
	Text3XL  FontSize = "3xl"
	Text4XL  FontSize = "4xl"
	Text5XL  FontSize = "5xl"
	Text6XL  FontSize = "6xl"
	Text7XL  FontSize = "7xl"
	Text8XL  FontSize = "8xl"
	Text9XL  FontSize = "9xl"
)

func AllFontSizes

func AllFontSizes() []FontSize

AllFontSizes returns every FontSize const in stable order.

type FontWeight

type FontWeight string

FontWeight is a typed font-weight step.

const (
	FontThin       FontWeight = "thin"       // 100
	FontExtralight FontWeight = "extralight" // 200
	FontLight      FontWeight = "light"      // 300
	FontNormal     FontWeight = "normal"     // 400
	FontMedium     FontWeight = "medium"     // 500
	FontSemibold   FontWeight = "semibold"   // 600
	FontBold       FontWeight = "bold"       // 700
	FontExtrabold  FontWeight = "extrabold"  // 800
	FontBlack      FontWeight = "black"      // 900
)

func AllFontWeights

func AllFontWeights() []FontWeight

AllFontWeights returns every FontWeight const in stable order.

type Items

type Items string

Items maps to align-items.

const (
	ItemsStart    Items = "start"
	ItemsEnd      Items = "end"
	ItemsCenter   Items = "center"
	ItemsBaseline Items = "baseline"
	ItemsStretch  Items = "stretch"
)

func AllItems

func AllItems() []Items

AllItems returns every Items const in stable order.

type Justify

type Justify string

Justify maps to justify-content.

const (
	JustifyStart   Justify = "start"
	JustifyEnd     Justify = "end"
	JustifyCenter  Justify = "center"
	JustifyBetween Justify = "between"
	JustifyAround  Justify = "around"
	JustifyEvenly  Justify = "evenly"
)

func AllJustify

func AllJustify() []Justify

AllJustify returns every Justify const in stable order.

type Leading

type Leading string

Leading is a typed line-height step.

const (
	LeadingNone    Leading = "none"
	LeadingTight   Leading = "tight"
	LeadingSnug    Leading = "snug"
	LeadingNormal  Leading = "normal"
	LeadingRelaxed Leading = "relaxed"
	LeadingLoose   Leading = "loose"
)

func AllLeadings

func AllLeadings() []Leading

AllLeadings returns every Leading const in stable order.

type MaxWidth

type MaxWidth string

MaxWidth is a typed handle for Tailwind's named max-width scale. Values serialize to the Tailwind key ("sm", "2xl", "full") and flow through ClassList.MaxWScaled to produce the "max-w-<key>" utility.

const (
	MaxWXS     MaxWidth = "xs"
	MaxWSM     MaxWidth = "sm"
	MaxWMD     MaxWidth = "md"
	MaxWLG     MaxWidth = "lg"
	MaxWXL     MaxWidth = "xl"
	MaxW2XL    MaxWidth = "2xl"
	MaxW3XL    MaxWidth = "3xl"
	MaxW4XL    MaxWidth = "4xl"
	MaxW5XL    MaxWidth = "5xl"
	MaxW6XL    MaxWidth = "6xl"
	MaxW7XL    MaxWidth = "7xl"
	MaxWFull   MaxWidth = "full"
	MaxWNone   MaxWidth = "none"
	MaxWScreen MaxWidth = "screen"
	MaxWProse  MaxWidth = "prose"
)

type Opacity

type Opacity string

Opacity is a typed opacity percentage step.

const (
	Opacity0   Opacity = "0"
	Opacity5   Opacity = "5"
	Opacity10  Opacity = "10"
	Opacity20  Opacity = "20"
	Opacity25  Opacity = "25"
	Opacity30  Opacity = "30"
	Opacity40  Opacity = "40"
	Opacity50  Opacity = "50"
	Opacity60  Opacity = "60"
	Opacity70  Opacity = "70"
	Opacity75  Opacity = "75"
	Opacity80  Opacity = "80"
	Opacity90  Opacity = "90"
	Opacity95  Opacity = "95"
	Opacity100 Opacity = "100"
)

func AllOpacities

func AllOpacities() []Opacity

AllOpacities returns every Opacity in stable order.

type Outline

type Outline string

Outline is a typed outline style.

const (
	OutlineNone   Outline = "none"
	OutlineSolid  Outline = "solid"
	OutlineDashed Outline = "dashed"
	OutlineDotted Outline = "dotted"
	OutlineDouble Outline = "double"
)

func AllOutlines

func AllOutlines() []Outline

AllOutlines returns every Outline in stable order.

type Overflow

type Overflow string

Overflow is a typed overflow style.

const (
	OverflowAuto    Overflow = "auto"
	OverflowHidden  Overflow = "hidden"
	OverflowClip    Overflow = "clip"
	OverflowVisible Overflow = "visible"
	OverflowScroll  Overflow = "scroll"
)

func AllOverflows

func AllOverflows() []Overflow

AllOverflows returns every Overflow in stable order.

type PointerEvents

type PointerEvents string

PointerEvents is a typed pointer-events style.

const (
	PointerAuto PointerEvents = "auto"
	PointerNone PointerEvents = "none"
)

func AllPointerEvents

func AllPointerEvents() []PointerEvents

AllPointerEvents returns every PointerEvents in stable order.

type Position

type Position string

Position is a typed CSS position.

const (
	PositionStatic   Position = "static"
	PositionRelative Position = "relative"
	PositionAbsolute Position = "absolute"
	PositionFixed    Position = "fixed"
	PositionSticky   Position = "sticky"
)

func AllPositions

func AllPositions() []Position

AllPositions returns every Position const in stable order.

type PositionOffset

type PositionOffset string

PositionOffset is a non-spacing positional fraction used to anchor overlays. It is separate from Spacing so values such as 1/2 cannot leak into padding, gap, or size utilities.

const (
	PositionHalf PositionOffset = "1/2"
)

func AllPositionOffsets

func AllPositionOffsets() []PositionOffset

AllPositionOffsets returns every governed overlay-position fraction.

type Radius

type Radius string

Radius is a typed border-radius step matching tokens.RadiusScale.

const (
	RadiusNone Radius = "none"
	RadiusSM   Radius = "sm"
	RadiusBase Radius = "base"
	RadiusMD   Radius = "md"
	RadiusLG   Radius = "lg"
	RadiusXL   Radius = "xl"
	Radius2XL  Radius = "2xl"
	Radius3XL  Radius = "3xl"
	RadiusFull Radius = "full"
)

func AllRadii

func AllRadii() []Radius

AllRadii returns every Radius const in stable order.

type ResizeMode

type ResizeMode string

ResizeMode is a typed textarea resize mode.

const (
	ResizeModeNone ResizeMode = "none"
	ResizeModeY    ResizeMode = "y"
	ResizeModeBoth ResizeMode = "both"
)

type RingOffset

type RingOffset string

RingOffset is a typed ring-offset thickness step.

const (
	RingOffset0 RingOffset = "0"
	RingOffset1 RingOffset = "1"
	RingOffset2 RingOffset = "2"
	RingOffset4 RingOffset = "4"
	RingOffset8 RingOffset = "8"
)

func AllRingOffsets

func AllRingOffsets() []RingOffset

AllRingOffsets returns every RingOffset in stable order.

type RingWidth

type RingWidth string

RingWidth is a typed focus-ring thickness step.

const (
	Ring0 RingWidth = "0"
	Ring1 RingWidth = "1"
	Ring2 RingWidth = "2"
	Ring4 RingWidth = "4"
	Ring8 RingWidth = "8"
)

func AllRingWidths

func AllRingWidths() []RingWidth

AllRingWidths returns every RingWidth in stable order.

type Select

type Select string

Select is a typed user-select style.

const (
	SelectNone Select = "none"
	SelectText Select = "text"
	SelectAll  Select = "all"
	SelectAuto Select = "auto"
)

func AllSelects

func AllSelects() []Select

AllSelects returns every Select in stable order.

type Shadow

type Shadow string

Shadow is a typed box-shadow step matching tokens.ShadowScale.

const (
	ShadowNone  Shadow = "none"
	ShadowSM    Shadow = "sm"
	ShadowBase  Shadow = "base"
	ShadowMD    Shadow = "md"
	ShadowLG    Shadow = "lg"
	ShadowXL    Shadow = "xl"
	Shadow2XL   Shadow = "2xl"
	ShadowInner Shadow = "inner"
)

func AllShadows

func AllShadows() []Shadow

AllShadows returns every Shadow const in stable order.

type Spacing

type Spacing string

Spacing is a typed spacing step matching tokens.SpacingScale entries. Values serialize to the Tailwind spacing key (e.g., "3.5", "4", "px"), not to a complete utility class. The ClassList builder combines a Spacing with its role (padding, margin, width, height, gap) to produce the final Tailwind class.

const (
	SPX   Spacing = "px"   // 1px
	S0    Spacing = "0"    // 0rem
	S0_5  Spacing = "0.5"  // 0.125rem
	S1    Spacing = "1"    // 0.25rem
	S1_5  Spacing = "1.5"  // 0.375rem
	S2    Spacing = "2"    // 0.5rem
	S2_5  Spacing = "2.5"  // 0.625rem
	S3    Spacing = "3"    // 0.75rem
	S3_5  Spacing = "3.5"  // 0.875rem
	S4    Spacing = "4"    // 1rem
	S5    Spacing = "5"    // 1.25rem
	S6    Spacing = "6"    // 1.5rem
	S7    Spacing = "7"    // 1.75rem
	S8    Spacing = "8"    // 2rem
	S9    Spacing = "9"    // 2.25rem
	S10   Spacing = "10"   // 2.5rem
	S11   Spacing = "11"   // 2.75rem
	S12   Spacing = "12"   // 3rem
	S14   Spacing = "14"   // 3.5rem
	S16   Spacing = "16"   // 4rem
	S20   Spacing = "20"   // 5rem
	S24   Spacing = "24"   // 6rem
	S28   Spacing = "28"   // 7rem
	S32   Spacing = "32"   // 8rem
	S36   Spacing = "36"   // 9rem
	S40   Spacing = "40"   // 10rem
	S44   Spacing = "44"   // 11rem
	S48   Spacing = "48"   // 12rem
	S52   Spacing = "52"   // 13rem
	S56   Spacing = "56"   // 14rem
	S60   Spacing = "60"   // 15rem
	S64   Spacing = "64"   // 16rem
	S72   Spacing = "72"   // 18rem
	S80   Spacing = "80"   // 20rem
	S96   Spacing = "96"   // 24rem
	SAuto Spacing = "auto" // auto
	SFull Spacing = "full" // 100% (width/height only)
)

Spacing steps — names align with tokens.SpacingScale and the Tailwind default spacing scale. Fractional values use underscore for the decimal point in the Go const name (S0_5 → "0.5").

func AllSpacings

func AllSpacings() []Spacing

AllSpacings returns every Spacing const in stable order. Used by the typed tables and All* enumerators to validate compile-table coverage.

type State

type State string

State is a typed CSS modifier state (hover, focus, disabled, etc.). Used with ClassList.On() to wrap child classes in a Tailwind prefix such as "hover:" or "focus-visible:".

const (
	StateHover        State = "hover"
	StateFocus        State = "focus"
	StateFocusVisible State = "focus-visible"
	StateDisabled     State = "disabled"
	StatePlaceholder  State = "placeholder"
)

The state modifiers this application uses. Eleven more were declared and nothing ever named one — a vocabulary is a list of what a component may say, and a word with no speaker is a word a reader has to look up. A component that needs first:, odd: or group-hover: adds it back in the commit that uses it, which is also the commit that makes the CSS carry the rule.

func (State) Prefix

func (s State) Prefix() string

Prefix returns the Tailwind prefix including the trailing colon (e.g., "hover:"). Returns empty string for the zero value.

type TextAlign

type TextAlign string

TextAlign is a typed text alignment.

const (
	TextLeft    TextAlign = "left"
	TextCenter  TextAlign = "center"
	TextRight   TextAlign = "right"
	TextJustify TextAlign = "justify"
)

func AllTextAligns

func AllTextAligns() []TextAlign

AllTextAligns returns every TextAlign const in stable order.

type Tracking

type Tracking string

Tracking is a typed letter-spacing step.

const (
	TrackingTighter Tracking = "tighter"
	TrackingTight   Tracking = "tight"
	TrackingNormal  Tracking = "normal"
	TrackingWide    Tracking = "wide"
	TrackingWider   Tracking = "wider"
	TrackingWidest  Tracking = "widest"
)

func AllTrackings

func AllTrackings() []Tracking

AllTrackings returns every Tracking const in stable order.

type Transition

type Transition string

Transition is a typed CSS transition property group.

const (
	TransitionNone      Transition = "none"
	TransitionAll       Transition = "all"
	TransitionColors    Transition = "colors"
	TransitionOpacity   Transition = "opacity"
	TransitionShadow    Transition = "shadow"
	TransitionTransform Transition = "transform"
)

func AllTransitions

func AllTransitions() []Transition

AllTransitions returns every Transition const in stable order.

type Translate

type Translate string

Translate is a typed translate step (for hover lifts etc.).

const (
	TranslateNone    Translate = "0"
	TranslatePx      Translate = "px"
	Translate0_5     Translate = "0.5"
	TranslateHalf    Translate = "1/2"
	Translate1       Translate = "1"
	TranslateNeg05   Translate = "neg-0.5" // -translate-y-0.5
	TranslateNegHalf Translate = "neg-1/2"
	TranslateNeg1    Translate = "neg-1"
	TranslateNeg2    Translate = "neg-2"
)

func AllTranslates

func AllTranslates() []Translate

AllTranslates returns every Translate in stable order.

type ViewportHeight

type ViewportHeight string

ViewportHeight is the closed set of viewport-relative heights used by governed overlays. Keeping these values typed lets CSS emission remain fail-closed while supporting responsive drawers and sheets.

const (
	VH25  ViewportHeight = "25"
	VH50  ViewportHeight = "50"
	VH75  ViewportHeight = "75"
	VH85  ViewportHeight = "85"
	VH100 ViewportHeight = "100"
)

func AllViewportHeights

func AllViewportHeights() []ViewportHeight

AllViewportHeights returns every supported viewport height in stable order.

type ZLayer

type ZLayer int16

ZLayer is a typed semantic z-index layer. The underlying value is the numeric z-index used across the design system (see tokens.ZIndexScale). The Class() method converts a ZLayer to its Tailwind arbitrary-value class (e.g., ZModal → "z-[1400]"), so there is no "magic z-50 vs z-70" — every layer's number comes from the typed tokens.

const (
	ZBelow    ZLayer = -10
	ZBase     ZLayer = 0
	ZDocked   ZLayer = 10
	ZDropdown ZLayer = 1000
	ZSticky   ZLayer = 1100
	ZBanner   ZLayer = 1200
	ZOverlay  ZLayer = 1300
	ZModal    ZLayer = 1400
	ZPopover  ZLayer = 1500
	ZToast    ZLayer = 1600
	ZTooltip  ZLayer = 1700
)

Semantic z-index layers. Numeric values match tokens.DefaultZIndex and are the single source of truth. Changing the value here is the only place a z-index number should ever appear.

func AllZLayers

func AllZLayers() []ZLayer

AllZLayers returns every ZLayer const in stable order.

func (ZLayer) Class

func (z ZLayer) Class() string

Class returns the Tailwind arbitrary-value z-index class. For negative layers, emits "-z-[N]"; for positive, "z-[N]".

func (ZLayer) String

func (z ZLayer) String() string

String returns the numeric value as a decimal string.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL