Middle Truncation
Truncate text in the middle while preserving start and end.
Loading...
Installation
pnpm dlx shadcn@latest add https://jb.desishub.com/r/middle-truncation.json
Usage
import { MiddleTruncation } from "@/components/middle-truncation";<MiddleTruncation>
/Users/jb/Code/portfolio/src/components/ui/button.tsx
</MiddleTruncation>Props
| Prop | Type | Default | Description |
|---|---|---|---|
children | string | - | The text content to truncate. |
end | number | - | Fixed number of characters to preserve at the end. |
minEnd | number | - | Minimum characters at the end when splitting evenly. |
ellipsis | string | "..." | Custom ellipsis string. |

