SypniaProvider
The language of the components and their formats. Without a provider they follow the page's <html lang>.
import { SypniaProvider } from '@sypnia/ui/react'
English and Spanish side by side
$1,240.50 · Nov 17, 2026 · Copy 1.8K
1240,50 US$ · 17 nov 2026 · Copiar 1,8 mil
26–50 de 204
Code
import { Count, Pagination, SypniaProvider, useSypnia } from '@sypnia/ui/react';
function Figures() {
const { format, t } = useSypnia();
return <p>{format.currency(1240.5, 'USD')} · {format.date('2026-11-17')} · {t('copy')} <Count value={1840} /></p>;
}
// Without a provider, components follow <html lang>. A provider fixes the language for what is inside.
export default function Lang() {
return (
<div className="sy-stack" style={{ '--gap': 'var(--s-3)' } as React.CSSProperties}>
<SypniaProvider locale="en"><Figures /></SypniaProvider>
<SypniaProvider locale="es"><Figures /><Pagination page={2} pageSize={25} total={204} onPage={() => {}} /></SypniaProvider>
</div>
);
} When to use it
Use it when
- An app that knows the person's language from their account.
Do not use it when
- Translating your own words with it: it holds the library's words; yours belong to your app.
For everyone
- Set
langon the page too, so screen readers pronounce it right.
Props
| SypniaProvider | Type | Default |
|---|---|---|
locale | string | en |