Truncate
moleculesCharacter-count truncation at the end, middle, start or by path segment, or fitted to the measured width, with a full-text tooltip and optional copy.
Transaction details
mode="middle" keeps both ends of hashes and addresses; copyable copies the full value on click; hover or focus a shortened value for the full text.
- Status
- Confirmed
- Hash
- 0x9f4c2e71b0d8a35e6c1f22a7b94e0d3c5a8b17f6e2d09c4b3a1e5f7d8c6b2a90
- From
- 0x71C7656EC7ab88b098defB751B7401B5f6d8976F
- To
- 0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48
- Memo
- Quarterly payout for the media-tran… Quarterly payout for the media-transcode contractors, batch 4 of 6
Modes
mode="end" | "middle" | "start" | "path" against a max character budget; path abbreviates ancestors first and keepFirst protects leading segments; ellipsis swaps the marker.
end, max 20 a-very-long-resourc…
a-very-long-resource-identifier-that-keeps-going
middle, max 16 0x71C765…6d8976F
0x71C7656EC7ab88b098defB751B7401B5f6d8976F
start, max 22 …/14/request-trace.log
/srv/app/var/logs/2026/06/14/request-trace.log
path, max 24 /h/a/D/t/s/l/truncate.ts
/home/amara/Documents/tsumikit/src/lib/truncate.ts
path, keepFirst 1 ~/D/t/s/lib/truncate.ts
~/Documents/tsumikit/src/lib/truncate.ts
path, separator "." c.e.b.i.export.CsvWriter
com.example.billing.invoices.export.CsvWriter
ellipsis "..." Quarterly payou...
Quarterly payout for the contractors
Fit, fits and tooltips
fit measures the host and shows the longest candidate that fits (drag the handle), grow claims the free space of a flex row; text within budget renders as-is with no tooltip; tooltip={false} and placement control the reveal.
fit + grow /home/amara/Documents/tsumikit/src/demo/molecules/Truncate/03-States.svelte
fit, middle sha256:4f1c9e0b7a2d38c5e6f90a1b2c3d4e5f60718293a4b5c6d7e8f9012345678abc
fits, so no tooltip: short tooltip off: a-very-long… placement="bottom": a-very-long… a-very-long-resource-identifier
empty: []Props
| Prop | Type | Default | Description |
|---|---|---|---|
text required | string | — | |
max | number | — | Character budget. Ignored when `fit` is set. |
mode | TruncateMode | 'end' | |
ellipsis | string | '…' | |
separator | string | '/' | `path` mode options. |
minLeaf | number | 3 | |
keepFirst | number | 0 | |
fit | boolean | false | Measure the host width and show the longest candidate that fits. |
mono | boolean | false | |
copyable | boolean | false | Click copies the full text; announces via a live region. |
copiedLabel | string | 'Copied' | |
oncopy | (ok: boolean) => void | — | |
grow | boolean | false | `flex: 1 1 0; min-width: 0` so the host claims a flex row's free space. |
tooltip | boolean | true | Reveal the full text on hover/focus when truncated. Default true. |
placement | 'top' | 'bottom' | 'left' | 'right' | 'top' | |
class | string | '' | |
style | string | '' |