Forced breaks
Offsets are UTF-16 positions at internal grapheme boundaries. Forced breaks do not alter the original text; explicit newlines remain in breakAfter.
Existing line breaks
Source CRLF and LF are retained in breakAfter. Automatic wraps do not insert characters into the original string.
<JuliyaText as="h1">{'First line\nSecond line'}</JuliyaText>forcedBreaks
Provide source UTF-16 positions to force a boundary even when more content fits. Locations are sorted and duplicates removed; long segments still wrap automatically.
const lines = wrap(text, { width, measure, forcedBreaks: [1] });Valid positions
Only internal grapheme boundaries are accepted. Index zero, end-of-string and positions inside combined emoji or graphemes throw RangeError.
SSR initial line breaks
splitLines preserves explicit and forced breaks without measuring width. Use the same initial result on server and client.
import { splitLines } from '@oddmash/juliya';
const lines = splitLines('A👩💻B', [1]);Dynamic React control
Use useJuliya with initialForcedBreaks, then setForcedBreaks or clearForcedBreaks. Recalculate indices when text changes.
const { ref, lines, setForcedBreaks, clearForcedBreaks } = useJuliya({ text, initialForcedBreaks: [1] });