# @commercetools-uikit/localized-rich-text-input

> A controlled text input component for localized rich text input with validation states.

Latest version **20.6.8** (published 2026-11-23) · MIT license · 0 weekly downloads

## Install

```sh
npm install @commercetools-uikit/localized-rich-text-input
pnpm add @commercetools-uikit/localized-rich-text-input
yarn add @commercetools-uikit/localized-rich-text-input
bun add @commercetools-uikit/localized-rich-text-input
```

## Health

**Score 65/100 (B)** — status: active.

Positive: esm support; no vulnerabilities; has provenance; recently updated; high maintenance score.

Warnings: low downloads; no types.

## Facts

| | |
|---|---|
| Version | 20.6.8 |
| Published | 2026-11-23 |
| First published | 2019-11-29 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | ESM + CommonJS |
| Dependencies | 27 |
| Unpacked size | 366.4 KB |
| Known vulnerabilities | 0 (+2 in 1 direct dependencies) |
| Install scripts | no |
| Provenance | attested (GitHub Actions) |
| GitHub stars | 154 |
| Maintainers | emmenko, commercetools-admin, tdeekens |
| Keywords | javascript, typescript, design-system, react, uikit |

## Links

- npm: https://www.npmjs.com/package/@commercetools-uikit/localized-rich-text-input
- Repository: https://github.com/commercetools/ui-kit
- Homepage: https://uikit.commercetools.com
- Issues: https://github.com/commercetools/ui-kit/issues
- npm.io page: https://npm.io/package/@commercetools-uikit/localized-rich-text-input

## Dependencies (27)

- [slate](https://npm.io/package/slate.md) 0.75.0
- [lodash](https://npm.io/package/lodash.md) 4.18.1
- [downshift](https://npm.io/package/downshift.md) 9.4.0
- [immutable](https://npm.io/package/immutable.md) 4.3.8
- [is-hotkey](https://npm.io/package/is-hotkey.md) 0.2.0
- [slate-react](https://npm.io/package/slate-react.md) 0.75.0
- [slate-history](https://npm.io/package/slate-history.md) 0.113.1
- [@babel/runtime](https://npm.io/package/@babel/runtime.md) ^7.20.13
- [@emotion/react](https://npm.io/package/@emotion/react.md) ^11.10.5
- [@emotion/styled](https://npm.io/package/@emotion/styled.md) ^11.10.5
- [@babel/runtime-corejs3](https://npm.io/package/@babel/runtime-corejs3.md) ^7.20.13
- [react-textarea-autosize](https://npm.io/package/react-textarea-autosize.md) 8.5.9
- [@commercetools-uikit/text](https://npm.io/package/@commercetools-uikit/text.md) ^20.6.8
- [@commercetools-uikit/hooks](https://npm.io/package/@commercetools-uikit/hooks.md) ^20.6.8
- [@commercetools-uikit/icons](https://npm.io/package/@commercetools-uikit/icons.md) ^20.6.8
- [@commercetools-uikit/utils](https://npm.io/package/@commercetools-uikit/utils.md) ^20.6.8
- [@commercetools-uikit/tooltip](https://npm.io/package/@commercetools-uikit/tooltip.md) ^20.6.8
- [@commercetools-uikit/messages](https://npm.io/package/@commercetools-uikit/messages.md) ^20.6.8
- [@commercetools-uikit/constraints](https://npm.io/package/@commercetools-uikit/constraints.md) ^20.6.8
- [@commercetools-uikit/flat-button](https://npm.io/package/@commercetools-uikit/flat-button.md) ^20.6.8
- [@commercetools-uikit/input-utils](https://npm.io/package/@commercetools-uikit/input-utils.md) ^20.6.8
- [@commercetools-uikit/design-system](https://npm.io/package/@commercetools-uikit/design-system.md) ^20.6.8
- [@commercetools-uikit/spacings-stack](https://npm.io/package/@commercetools-uikit/spacings-stack.md) ^20.6.8
- [@commercetools-uikit/localized-utils](https://npm.io/package/@commercetools-uikit/localized-utils.md) ^20.6.8
- [@commercetools-uikit/rich-text-utils](https://npm.io/package/@commercetools-uikit/rich-text-utils.md) ^20.6.8
- [@commercetools-uikit/spacings-inline](https://npm.io/package/@commercetools-uikit/spacings-inline.md) ^20.6.8
- [@commercetools-uikit/collapsible-motion](https://npm.io/package/@commercetools-uikit/collapsible-motion.md) ^20.6.8

## Alternatives

- [mobx-react](https://npm.io/package/mobx-react.md) — 2.8M weekly downloads
- [rc-tree](https://npm.io/package/rc-tree.md) — 2.6M weekly downloads
- [@react-oauth/google](https://npm.io/package/@react-oauth/google.md) — 1.3M weekly downloads
- [@wagmi/connectors](https://npm.io/package/@wagmi/connectors.md) — 877.0K weekly downloads
- [vee-validate](https://npm.io/package/vee-validate.md) — 836.4K weekly downloads

## Recent versions

- 20.6.8 (latest) — 2026-11-23
- 0.0.0-canary-20261123143223 (canary) — 2026-11-23
- 0.0.0-FEC-938-ui-kit-post-pnpm-tooling-polish-catalogs-bundlewatch-bundlesize-20260518121756 (FEC-938-ui-kit-post-pnpm-tooling-polish-catalogs-bundlewatch-bundlesize) — 2026-05-18
- 0.0.0-migration-pnpm-20260513114959 (migration-pnpm) — 2026-05-13
- 0.0.0-CRAFT-2040-rich-text-input-destroys-hyperlink-tag-20260219190637 (CRAFT-2040-rich-text-input-destroys-hyperlink-tag) — 2026-02-19
- 0.0.0-fec-155-react-19-20250528075244 (fec-155-react-19) — 2025-05-28
- 0.0.0-FCT-1500-adjust-legacy-css-reset-20250527090339 (FCT-1500-adjust-legacy-css-reset) — 2025-05-27
- 0.0.0-SUPPORT-32352-de-ch-money-input-20250509174254 (SUPPORT-32352-de-ch-money-input) — 2025-05-09
- 0.0.0-main-20250115172531 (main) — 2025-01-15
- 0.0.0-preview-fec-155-react-19-20250113184401 (preview-fec-155-react-19) — 2025-01-13
- 0.0.0-preview-test-icon-entrypoints-20241212201418 (preview-test-icon-entrypoints) — 2024-12-12
- 0.0.0-preview-test-icon-pure-annotations-20241211181046 (preview-test-icon-pure-annotations) — 2024-12-11
- 0.0.0-preview-test-icon-bundle-20241210182318 (preview-test-icon-bundle) — 2024-12-10
- 0.0.0-preview-test-canary-preview-20241204111237 (preview-test-canary-preview) — 2024-12-04
- 0.0.0-preview-FCT-1187-20241024123200 (preview) — 2024-10-24
- … 1233 more at https://npm.io/package/@commercetools-uikit/localized-rich-text-input/versions

## README

<!-- THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. -->
<!-- This file is created by the `pnpm generate-readme` script. -->

# LocalizedRichTextInput

## Description

A controlled text input component for localized rich text input with validation
states.

## Installation

```
pnpm add @commercetools-uikit/localized-rich-text-input
```

```
npm --save install @commercetools-uikit/localized-rich-text-input
```

Additionally install the peer dependencies (if not present)

```
pnpm add react react-dom react-intl
```

```
npm --save install react react-dom react-intl
```

## Usage

```jsx
import LocalizedRichTextInput from '@commercetools-uikit/localized-rich-text-input';

const Example = () => (
  <LocalizedRichTextInput
    value={{
      en: '',
      de: '',
    }}
    onChange={(event) => console.log('event.target.value', event.target.value)}
    selectedLanguage="en"
  />
);

export default Example;
```

## Properties

| Props                           | Type                                                                                      | Required | Default   | Description                                                                                                                                                     |
| ------------------------------- | ----------------------------------------------------------------------------------------- | :------: | --------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `id`                            | `string`                                                                                  |          |           | Used as prefix of HTML `id` property. Each input field id will have the language as a suffix (`${idPrefix}.${lang}`), e.g. \`foo.en                             |
| `name`                          | `string`                                                                                  |          |           | Used as HTML `name` property for each input field. Each input field name will have the language as a suffix (`${namePrefix}.${lang}`), e.g. `foo.en`            |
| `value`                         | `Record`                                                                                  |    ✅    |           | Values to use. Keyed by language, the values are the actual values, e.g. \`{ en: '<p>Horse</p>', de: '<p>Pferd</p>' }                                           |
| `onChange`                      | `Function`<br/>[See signature.](#signature-onchange)                                      |          |           | Gets called when any input is changed. Is called with the change event of the changed input.                                                                    |
| `selectedLanguage`              | `string`                                                                                  |    ✅    |           | Specifies which language will be shown in case the `LocalizedRichTextInput` is collapsed.                                                                       |
| `onBlur`                        | `FocusEventHandler`                                                                       |          |           | Called when any field is blurred. Is called with the `event` of that field.                                                                                     |
| `onFocus`                       | `FocusEventHandler`                                                                       |          |           | Called when any field is focussed. Is called with the `event` of that field.                                                                                    |
| `defaultExpandMultilineText`    | `boolean`                                                                                 |          |           | Expands input components holding multiline values instead of collapsing them by default.                                                                        |
| `hideLanguageExpansionControls` | `boolean`                                                                                 |          |           | Will hide the language expansion controls when set to `true`. All languages will be shown when set to `true`                                                    |
| `defaultExpandLanguages`        | `boolean`                                                                                 |          |           | Controls whether one or all languages are visible by default. Pass `true` to show all languages by default.                                                     |
| `isDisabled`                    | `boolean`                                                                                 |          |           | Disables all input                                                                                                                                              |
| `isReadOnly`                    | `boolean`                                                                                 |          |           | Disables all input fields and shows them in read-only mode.                                                                                                     |
| `placeholder`                   | `Record`                                                                                  |          |           | Placeholders for each language. Object of the same shape as                                                                                                     |
| `horizontalConstraint`          | `union`<br/>Possible values:<br/>`, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 'scale', 'auto'` |          | `'scale'` | Horizontal size limit of the input fields.                                                                                                                      |
| `hasError`                      | `boolean`                                                                                 |          |           | Will apply the error state to each input without showing any error message.                                                                                     |
| `hasWarning`                    | `boolean`                                                                                 |          |           | Will apply the warning state to each input without showing any warning message.                                                                                 |
| `errors`                        | `Record`                                                                                  |          |           | Used to show errors underneath the inputs of specific languages. Pass an object whose key is a language and whose value is the error to show for that key.      |
| `warnings`                      | `Record`                                                                                  |          |           | Used to show warnings underneath the inputs of specific languages. Pass an object whose key is a language and whose value is the warning to show for that key.  |
| `additionalInfo`                | `Record`                                                                                  |          |           | An object mapping locales to additional messages to be rendered below each input element.&#xA;Example:&#xA;{&#xA;en: 'Some value',&#xA;es: 'Algún valor',&#xA;} |
| `showExpandIcon`                | `boolean`                                                                                 |          | `false`   | Shows an `expand` icon in the toolbar                                                                                                                           |
| `onClickExpand`                 | `Function`<br/>[See signature.](#signature-onclickexpand)                                 |          |           | Called when the `expand` button is clicked                                                                                                                      |

## Signatures

### Signature `onChange`

```ts
(event: TCustomEvent) => void
```

### Signature `onClickExpand`

```ts
() => boolean;
```

### Static Properties

### `createLocalizedString(languages, existingTranslations)`

This function creates a [localized string](https://docs.commercetools.com/http-api-types.html#localizedstring). It merges the `languages` and the language keys of existing translations to form a localized string holding all languages.
The `existingTranslations` argument is optional. If it is not passed, an empty localized field will be created.

```js
const languages = ['en', 'de'];
LocalizedRichTextInput.createLocalizedString(languages);
// -> { en: '<p></p>', de: '<p></p>' }
```

In case existingTranslations is passed, it will merge an empty localized field with the existing translations. Usually this is used to ensure that a localized string contains at least the project's languages.

```js
const languages = ['en', 'de'];
const existingTranslations = { en: '<p>Tree</p>', ar: '<p>شجرة</p>' };
LocalizedRichTextInput.createLocalizedString(languages, existingTranslations);
// -> { en: 'Tree', de: '', ar: '<p>شجرة</p>' }
```

### `isEmpty(localizedField)`

Returns `true` when all values in a localized field are empty.

```js
LocalizedRichTextInput.isEmpty({});
// -> true
```

```js
LocalizedRichTextInput.isEmpty({ en: '', de: '<p></p>' });
// -> true
```

```js
LocalizedRichTextInput.isEmpty({ en: '<p>Tree</p>', de: '<p></p>' });
// -> false
```

### `omitEmptyTranslations(localizedField)`

Omits translations with empty values.

```js
LocalizedRichTextInput.omitEmptyTranslations({ en: '', de: '  ' });
// -> {}
```

```js
LocalizedRichTextInput.omitEmptyTranslations({ en: '<p>Tree</p>', de: '' });
// -> { en: '<p>Tree</p>' }
```

### `isTouched(touched)`

Expects to be called with an object or `undefined`.
Returns `true` when at least one value is truthy.

### `RequiredValueErrorMessage`

This field exports a default error message which can be used when the field is
required, but the user provided no value. You can use it as

---
_Source: https://npm.io/package/@commercetools-uikit/localized-rich-text-input · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
