Juliya (줄이야)
English · 한국어 · 日本語 · 简体中文
Natural line breaks for multilingual interfaces.
Normal CSS line wrapping breaks text where it fits, which can split a phrase at an awkward point or leave a short final line. Juliya measures the actual font and available width, then chooses line breaks using language-specific boundaries and balanced line widths. Use it for headings, product copy, and article prose without inserting manual line breaks or rewriting your source strings.
Playground | Documentation | npm
Choose how to integrate
Wrap a React heading directly:
import { JuliyaText } from '@oddmash/juliya/react';
<JuliyaText as="h1" locale="en">
Keep all your team documents in one place.
</JuliyaText>
Use JuliyaText for individual elements, useJuliya for custom rendering, or mountJuliyaScope with an opt-in selector configuration for existing prose. A shared juliya.json can define locale, strategy and scopes across your app. Vue, Svelte and plain HTML are also supported.
The framework-independent core returns lines and UTF-16 ranges. This small example uses character counts; in production, supply a measurement function in the same units as the width.
import { wrap } from '@oddmash/juliya/en';
const lines = wrap('Keep all your team documents in one place.', {
width: 12,
measure: text => [...text].length,
});
Try in a browser
Save this English example as index.html and open it in a browser connected to the internet.
<!doctype html>
<html lang="en">
<meta charset="utf-8">
<title>Juliya example</title>
<p id="title" style="max-width: 220px; font-size: 24px">Keep all your team documents in one place.</p>
<script type="module">
import { mountJuliya } from 'https://cdn.jsdelivr.net/npm/@oddmash/juliya@0.6.0/dist/dom/index.js/+esm';
const title = document.getElementById('title');
mountJuliya(title, { text: title.textContent, locale: 'en' });
</script>
</html>
Supported languages
| Language |
Entry point |
Locale |
| Korean |
@oddmash/juliya/ko |
ko |
| English |
@oddmash/juliya/en |
en |
| Japanese |
@oddmash/juliya/ja |
ja |
| Simplified Chinese |
@oddmash/juliya/zh |
zh, zh-Hans |
The root API defaults to Korean if no locale is specified. Pass an explicit locale for multilingual content.
Behavior and limits
- Original text, explicit line breaks, nested links and emphasis.
- Automatic recalculation when container width or fonts change.
- Existing markup in supported inline and scoped modes, with protected code and controls.
Language rules are heuristic, not full semantic analysis. Check wrapping on your own content; native CSS may produce the same result at certain widths.
Integration guide | Project configuration | Contributing | MIT License