Skip to content

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'

On this page
  1. English and Spanish side by side
  2. When to use it
  3. For everyone
  4. Props

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 lang on the page too, so screen readers pronounce it right.

Props

SypniaProviderTypeDefault
locale string en
  1. English and Spanish side by side
  2. When to use it
  3. For everyone
  4. Props

    Search pages, sections and terms