Dynamic Text

Text content that self adjust to available width, no javascript, pure css! Features responsive typography, automatic scaling, and optimized text rendering for different screen sizes.

v0.0.1
🍰
πŸƒ
πŸŽ“
Intermediate

Dynamic Text

Good day, madam/sir! 🎩✨ Please try resizing meβ€”I am dynamic content that adjusts to available space.
Hi there! 😊 Try resizing meβ€”I am dynamic content that adjusts to available space.
Please try resizing me! πŸ™Œ I am dynamic content that adjusts to available space.
I am dynamic content that adjusts to available space 🌍 Resize me!
I am dynamic and adjust to available space πŸš€ Resize me!
I adjust to available space dynamically πŸ”€ Resize me!
I change depending on available space 🀹 Resize me!
I can adjust to available space 🎯 Resize me!
I adjust to available space 😎 Resize me!
I adjust dynamically πŸ”„ Resize me!
I adjust to space πŸ“ Resize me!
I am dynamic! Resize me! ✨
↔️ Resize me!
Resize me!
Resize me
Resize
↔️
Resize
Resize me
Resize me!
↔️ Resize me!
I am dynamic! Resize me! ✨
I adjust to space πŸ“ Resize me!
I adjust dynamically πŸ”„ Resize me!
I adjust to available space 😎 Resize me!
I can adjust to available space 🎯 Resize me!
I change depending on available space 🀹 Resize me!
I adjust to available space dynamically πŸ”€ Resize me!
I am dynamic and adjust to available space πŸš€ Resize me!
I am dynamic content that adjusts to available space 🌍 Resize me!
Please try resizing me! πŸ™Œ I am dynamic content that adjusts to available space.
Hi there! 😊 Try resizing meβ€”I am dynamic content that adjusts to available space.
Good day, madam/sir! 🎩✨ Please try resizing meβ€”I am dynamic content that adjusts to available space.

Other Examples

The text wrap wrapper let browser dynamically adjust the content without any javascript!

Date and Time Formats

Re-distribute the width with the handle in the middle to give more space for the date or the time.

Monday, 27 July 2026 Anno Domini
Monday, 27 July 2026
Mon, 27 July 2026
27 Jul 2026
Mon 27 Jul
27 Jul
27
27 Jul
Mon 27 Jul
27 Jul 2026
Mon, 27 July 2026
Monday, 27 July 2026
Monday, 27 July 2026 Anno Domini
12:27:07 in the afternoon Coordinated Universal Time
12:27:07 in the afternoon UTC
12:27:07 in the afternoon UTC
12:27:07 pm
12:27:07
12:27 pm
12:27
12 pm
12:27
12:27 pm
12:27:07
12:27:07 pm
12:27:07 in the afternoon UTC
12:27:07 in the afternoon UTC
12:27:07 in the afternoon Coordinated Universal Time

Country Name Variations

Different ways to refer to the United Kingdom, from shortest to most formal naming conventions.

The United Kingdom of Great Britain and Northern Ireland (UK)
The United Kingdom of Great Britain and Northern Ireland
The United Kingdom of Great Britain and NI (UK)
The United Kingdom of Great Britain and NI
The United Kingdom of GB & NI
United Kingdom of GB and NI
United Kingdom of GB & NI
United Kingdom (UK)
United Kingdom
UK of GB & NI
The UK
UK
πŸ‡¬πŸ‡§
UK
The UK
UK of GB & NI
United Kingdom
United Kingdom (UK)
United Kingdom of GB & NI
United Kingdom of GB and NI
The United Kingdom of GB & NI
The United Kingdom of Great Britain and NI
The United Kingdom of Great Britain and NI (UK)
The United Kingdom of Great Britain and Northern Ireland
The United Kingdom of Great Britain and Northern Ireland (UK)

Currency Formats

Various ways to format currency values, from full text representation to compact notations.

1,234,567.00 British pounds
GBPΒ 1,234,567.00
GBPΒ 1,234,567
Β£1,234,567
Β£1.2m
Β£1m
Β£1.2m
Β£1,234,567
GBPΒ 1,234,567
GBPΒ 1,234,567.00
1,234,567.00 British pounds

Install

Requires a project with shadcn/ui initialized. Installs all 1 file and any listed registry dependencies.

npx shadcn@latest add https://manglekuo.com/showcase/r/dynamic-text.json

Registry deps: slider, label

Documentation

Dynamic Text

Text that self-adjusts to available width with pure CSS β€” no JavaScript for the core switching behaviour.

Usage

import { DynamicText } from '@/components/ui/dynamic-text';Β <DynamicText  content={{    stages: [      { text: "Short" },      { text: "Medium length" },      { text: "This is a longer text for wider containers" },    ],  }}/>Language: jsx

Props

  • content ({ stages: Stage[] }, required): Text variations from longest to shortest fit.
  • enableAutoSortForMonoFont (boolean, default: false): Auto-sort stages by length for monospace fonts.
  • className (string, optional): Additional CSS classes.
  • showDebug (boolean, default: false): Show debug overlay (use DynamicTextWrapper in demos).

Each stage: { text: string; color?: string }.

How it works

Container-query-driven CSS shows the longest stage that fits. Optional debug mode visualises breakpoints. DynamicTextWrapper adds a resizable panel for showcase-style demos.