Skip to main content
Elastic UI
Elastic UI
ComponentsPatternsContentData visualization
EUI ChangelogGitHubFigma
  • Guidelines
    • Getting started
    • Accessibility
    • Writing
    • Testing
  • Theming
    • Theme provider
    • Color mode
    • High contrast mode
    • Borders
    • Breakpoints
    • Colors
    • Sizing
    • Typography
  • Templates
    • Page template
    • Sitewide search
  • Layout
    • Accordion
    • Bottom bar
    • Flex
    • Flyout
    • Header
    • Horizontal rule
    • Modal
    • Page components
    • Page header
    • Panel
    • Popover
    • Resizable container
    • Spacer
  • Navigation
    • Breadcrumbs
    • Buttons
    • Collapsible nav
    • Context menu
    • Facet
    • Key pad menu
    • Link
    • Pagination
    • Side nav
    • Steps
    • Tabs
    • Tree view
  • Display
    • Aspect ratio
    • Avatar
    • Badge
    • Callout
    • Card
    • Comment list
    • Description list
    • Drag and drop
    • Empty prompt
    • Health
    • Icons
    • Image
    • List group
    • Loading
    • Progress
    • Skeleton
    • Stat
    • Text
    • Timeline
    • Title
    • Toast
    • Tooltip
    • Tour
  • Forms
    • Form controls
    • Form layouts
    • Form validation
    • Text controls
    • Numeric controls
    • Selection controls
    • Search and filter controls
    • Date and time controls
    • Other controls
  • Tabular content
    • Tables
    • Data grid
  • Editors & Syntax
    • Code
    • Markdown
  • Utilities
    • Accessibility
    • Auto sizer
    • Beacon
    • Color palettes
    • Copy
    • CSS utility classes
    • Delay
    • Error boundary
    • Focus trap
    • Highlight and mark
    • HTML ID generator
    • I18n
    • Inner text
    • Mutation observer
    • Outside click detector
    • Overlay mask
    • Portal
    • Pretty duration
    • Provider
    • Resize observer
    • Scroll
    • Text diff
    • Text truncation
    • Window events
  • EUI
  • Utilities
  • I18n

I18n

Internalization

useEuiI18n and EuiI18n allows localizing string and numeric values for internationalization. There are two provided ways to use this: a React hook and a render prop component. In their simplest form, these take a

token and a default value. token provides a reference to use when mapping to a localized value and default provides the untranslated value when no mapping is available.

Loading...

Interpolation

useEuiI18n and EuiI18n support variable interpolation. In a translation like Signed in as {name} ({email}), two values can be interpolated (name and email). These values can be specified by passing a values prop to EuiI18n, or by passing an object of values as the third argument to useEuiI18n. Interpolation values can be passed as a string, number, or a React Component.

Loading...

Using localized values in attributes

Some times a localized value is needed for a prop instead of rendering directly to the DOM. In these cases useEuiI18n can be called inline, or EuiI18n can be used as a render prop child which is called with the localized value.

Loading...

Multi-value lookup

If many localized values are needed in a small area, multiple tokens can be retrieved from the hook or via a single render prop. In this case the token/default props are replaced by the pluralized tokens/defaults. Value injection is not supported when processing more than one token.

Loading...

Number localization

EuiI18nNumber can be used to format one or more numbers. Similarly to EuiI18n, it takes value or values and can render directly to the DOM or call a render prop.

Loading...

Context

EuiContext allows setting global internationalization copy for EUI components. Any components used within this context will lookup their display values from this mapping.

Loading...

Props

EuiI18n

๐˜‚๐˜‚
โœ„๐˜—โœ„๐˜—
Prop
โ†ฆ
Description and type
โ†ฆ
Default value
โ†ต
Prop
default#
โ†ฆ
Description and type
Type: Renderable<T>
โ†ฆ
Default value
โ†ต
Prop
token#
โ†ฆ
Description and type
Type: string
โ†ฆ
Default value
โ†ต
Prop
tokens#
โ†ฆ
Description and type
Type: string[]
โ†ฆ
Default value
โ†ต
Prop
defaults#
โ†ฆ
Description and type
Type: any[]
โ†ฆ
Default value
โ†ต
Prop
children#
โ†ฆ
Description and type

Render function that returns a ReactElement

Type: ((x: DEFAULTS[number][]) => ReactNode) | ((x: ResolvedType<DEFAULT>) => ReactNode)
โ†ฆ
Default value
โ†ต
Prop
values#
โ†ฆ
Description and type
Type: {} | Record<string, ReactNode>
โ†ฆ
Default value
โ†ต
๐˜‚๐˜‚

EuiContext

๐˜‚๐˜‚
โœ„๐˜—โœ„๐˜—
Prop
โ†ฆ
Description and type
โ†ฆ
Default value
โ†ต
Prop
children#
โ†ฆ
Description and type

ReactNode to render as this component's content

Type: ReactNode
โ†ฆ
Default value
Required
โ†ต
Prop
i18n#
โ†ฆ
Description and type
Type: I18nShape
โ†ฆ
Default value
{}
โ†ต
๐˜‚๐˜‚
Edit this page

Previous
HTML ID generator
Next
Inner text
  • Internalization
  • Interpolation
  • Using localized values in attributes
  • Multi-value lookup
  • Number localization
  • Context
  • Props
EUI is dual-licensed under Elastic License 2.0 and Server Side Public License, v 1 | Crafted with โค by Elastic