### Sample Configuration: Just set fontSize property Source: https://github.com/davidhellmann/tailwindcss-fluid-type/blob/main/README.md Provides a specific configuration example for the tailwindcss-fluid-type plugin where only the `fontSize` property is set, alongside minimum and maximum values for font and screen sizes. ```javascript // tailwind.config.js module.exports = { plugins: [ require("tailwindcss-fluid-type")({ settings: { fontSizeMin: 1.125, fontSizeMax: 1.25, ratioMin: 1.125, ratioMax: 1.2, screenMin: 20, screenMax: 96, unit: "rem", prefix: "", }, values: { // ... base: 0, // ... }, }), ], }; ``` -------------------------------- ### Install and Basic TailwindCSS Fluid Type Plugin Configuration Source: https://context7.com/davidhellmann/tailwindcss-fluid-type/llms.txt Demonstrates how to install the tailwindcss-fluid-type plugin via npm and add it to your tailwind.config.js for basic fluid typography implementation. This configuration enables the plugin's core functionality. ```javascript // Install via npm // npm install tailwindcss-fluid-type // tailwind.config.js - Basic setup module.exports = { plugins: [ require("tailwindcss-fluid-type"), ], }; ``` -------------------------------- ### HTML Examples for Extending vs Replacing Values Source: https://context7.com/davidhellmann/tailwindcss-fluid-type/llms.txt Illustrates the effect of the `extendValues` setting in HTML. The first example shows how custom values are added alongside defaults when `extendValues` is true. The second example demonstrates that only the specified custom values are available when `extendValues` is false. ```html

Default value still available

Custom value added

New extra large size

Only custom values available

text-base is NOT available

text-xl is NOT available

``` -------------------------------- ### Install tailwindcss-fluid-type with npm or Yarn Source: https://github.com/davidhellmann/tailwindcss-fluid-type/blob/main/README.md Installs the tailwindcss-fluid-type plugin using either npm or Yarn package managers. This is the first step to integrate the plugin into a project. ```bash # Using npm npm install tailwindcss-fluid-type # Using Yarn yarn add tailwindcss-fluid-type ``` -------------------------------- ### Sample Usage of tailwindcss-fluid-type with HTML Source: https://github.com/davidhellmann/tailwindcss-fluid-type/blob/main/README.md An example of how to apply fluid type classes to an HTML element. The `text-base` class will utilize the fluid type settings configured in the Tailwind CSS setup. ```html

Fluid type

``` -------------------------------- ### Complete TailwindCSS Fluid Type Plugin Configuration with Custom Settings Source: https://context7.com/davidhellmann/tailwindcss-fluid-type/llms.txt Provides a comprehensive example of configuring the tailwindcss-fluid-type plugin in `tailwind.config.js`. This includes setting custom modular scale ratios, viewport ranges, units, and defining specific typography values for different text sizes. ```javascript // tailwind.config.js - Complete configuration example module.exports = { corePlugins: { fontSize: false, // Disable default fontSize if you want only fluid sizes }, plugins: [ require("tailwindcss-fluid-type")({ settings: { fontSizeMin: 1.125, // Base minimum font size (18px) fontSizeMax: 1.25, // Base maximum font size (20px) ratioMin: 1.125, // Modular scale ratio at min viewport ratioMax: 1.2, // Modular scale ratio at max viewport screenMin: 20, // Minimum viewport size (320px) screenMax: 96, // Maximum viewport size (1536px) unit: "rem", // Use 'rem' or 'px' prefix: "", // Add prefix like "fluid-" to text utilities extendValues: true, // Extend default values or replace them }, values: { xs: [-2, 1.6], // [scale step, line height] sm: [-1, 1.6], base: [0, 1.6], lg: [1, 1.6], xl: [2, 1.2], "2xl": [3, 1.2], "3xl": [4, 1.2], "4xl": [5, 1.1], "5xl": [6, 1.1], "6xl": [7, 1.1], "7xl": [8, 1], "8xl": [9, 1], "9xl": [10, 1], }, }), ], }; ``` -------------------------------- ### Using Line Height Shorthand in HTML Source: https://context7.com/davidhellmann/tailwindcss-fluid-type/llms.txt Demonstrates how to apply overridden line heights directly in HTML using Tailwind CSS classes. This shows examples of using default line heights and custom ones like 'tight', 'relaxed', and 'loose'. ```html

Normal paragraph with default line height

Tight line height (1.25)

Relaxed line height (1.625)

Loose line height (2)

Heading with line height 1

Heading with snug spacing (1.375)

``` -------------------------------- ### Configure Fluid Type with Font Size, Line Height, and Letter Spacing Source: https://github.com/davidhellmann/tailwindcss-fluid-type/blob/main/README.md Configures fluid type to set `fontSize`, `lineHeight`, and `letterSpacing`. This extends the previous example by adding control over letter spacing, further refining typographic scales. ```javascript // tailwind.config.js module.exports = { plugins: [ require("tailwindcss-fluid-type")({ settings: { fontSizeMin: 1.125, fontSizeMax: 1.25, ratioMin: 1.125, ratioMax: 1.2, screenMin: 20, screenMax: 96, unit: "rem", prefix: "", }, values: { // ... base: [ 0, { lineHeight: 1.6, letterSpacing: "-0.1rem", }, ], // ... }, }), ], }; ``` -------------------------------- ### Generated CSS for Line Height Overrides Source: https://context7.com/davidhellmann/tailwindcss-fluid-type/llms.txt Shows the CSS output generated by tailwindcss-fluid-type when line height overrides are applied. This includes examples of 'tight', 'relaxed', and other custom line height utilities, demonstrating the `line-height` property. ```css /* Generated CSS with line height overrides */ .text-base { font-size: clamp( 1.125rem, calc(1.125rem + (1.25 - 1.125) * ((100vw - 20rem) / (96 - 20))), 1.25rem ); line-height: 1.6; } .text-base\/tight { font-size: clamp( 1.125rem, calc(1.125rem + (1.25 - 1.125) * ((100vw - 20rem) / (96 - 20))), 1.25rem ); line-height: 1.25; } .text-base\/relaxed { font-size: clamp( 1.125rem, calc(1.125rem + (1.25 - 1.125) * ((100vw - 20rem) / (96 - 20))), 1.25rem ); line-height: 1.625; } ``` -------------------------------- ### Generated CSS Output for Fluid Font Sizes (px) Source: https://context7.com/davidhellmann/tailwindcss-fluid-type/llms.txt Presents the CSS output generated by the tailwindcss-fluid-type plugin when configured to use pixel ('px') units. This example shows the `clamp()` function utilizing pixel values for font sizes and viewport calculations. ```css /* Generated CSS with px units */ .text-base { font-size: clamp( 18px, calc(18px + ((20 - 18) * ((100vw - 320px) / (1536 - 320)))), 20px ); } ``` -------------------------------- ### Component Using tailwind-merge with Fluid Type Source: https://context7.com/davidhellmann/tailwindcss-fluid-type/llms.txt A React component example demonstrating the use of the `cn` utility function, which integrates tailwind-merge with fluid type support. It shows how fluid text classes can be merged or overridden correctly based on props and additional class names. ```typescript // Component using the cn utility import { cn } from "@/lib/utils"; function Button({ className, size = "default" }) { return ( ); } // Usage examples