Skip to content

Font Size

Use text-{size} utilities to control the font size and default line-height of text.


Use utilities like text-sm and text-lg to set the font size of an element:

Style('text-sm ...', child: Text('The quick brown fox ...'))
Style('text-base ...', child: Text('The quick brown fox ...'))
Style('text-lg ...', child: Text('The quick brown fox ...'))
Style('text-xl ...', child: Text('The quick brown fox ...'))
Style('text-2xl ...', child: Text('The quick brown fox ...'))

Use text-{size}/{N} to set the font size and line-height at the same time. The /N suffix multiplies the spacing scale (/6 → 24px, /7 → 28px, /8 → 32px):

Style('text-sm/6 ...', child: Text('So I started to walk into the water...'))
Style('text-sm/7 ...', child: Text('So I started to walk into the water...'))
Style('text-sm/8 ...', child: Text('So I started to walk into the water...'))
ClassFont SizeLine Height
text-xs12px16px
text-sm14px20px
text-base16px24px
text-lg18px28px
text-xl20px28px
text-2xl24px32px
text-3xl30px36px
text-4xl36px40px
text-5xl48px48px
text-6xl60px60px
text-7xl72px72px
text-8xl96px96px
text-9xl128px128px
text-{size}/{N}size scaleN * 4px override
text-[<value>]arbitrary numeric font-sizeinherited line-height
text-(length:--var)Resolved against theme-defined StyleThemeData.customProperties (the length: hint is ignored); behaves like text-[<value>]. Cascade-inherited or JS-set CSS variables remain out of scope.