Text Pressure
Web (React)
A responsive variable-font typography effect that reacts fluidly to the cursor's proximity.
A highly interactive variable-font typography component. It dynamically adjusts the weight, width, and italic properties of individual characters based on their distance to the user's mouse cursor.
Installation
CLI
npx @modus-ui/cli add text-pressureManual
- Copy the code from the component tab.
- Create a file at
components/ui/text-pressure.tsx. - Paste the code.
Usage
tsx
Props
| Prop | Type | Default | Description |
|---|---|---|---|
text | string | "Pressure" | The text to render. |
fontFamily | string | "Roboto Flex" | Variable font family to use. |
fontUrl | string | "https://fonts.googleapis.com/css2?family=Roboto+Flex:opsz,wdth,wght@8..144,25..151,100..1000&display=swap" | Stylesheet URL that loads the variable font. |
width | boolean | true | Varies the font width with cursor distance. |
weight | boolean | true | Varies the font weight with cursor distance. |
italic | boolean | true | Varies the italic axis with cursor distance. |
alpha | boolean | false | Varies letter opacity with cursor distance. |
flex | boolean | true | Spreads the letters across the container. |
stroke | boolean | false | Draws an outline around the letters. |
scale | boolean | false | Stretches the text vertically to fill the container. |
textColor | string | "hsl(var(--foreground))" | Text colour. |
strokeColor | string | "hsl(var(--foreground))" | Outline colour when stroke is on. |
strokeWidth | number | 2 | Outline width in pixels. |
minFontSize | number | 24 | Minimum font size in pixels. |
Comments