# @univerjs/sheets-data-validation

[![npm version](https://img.shields.io/npm/v/@univerjs/sheets-data-validation?style=flat-square)](https://npmjs.com/package/@univerjs/sheets-data-validation)
[![license](https://img.shields.io/npm/l/@univerjs/sheets-data-validation?style=flat-square)](https://npmjs.com/package/@univerjs/sheets-data-validation)
[![downloads](https://img.shields.io/npm/dm/@univerjs/sheets-data-validation?style=flat-square)](https://npmjs.com/package/@univerjs/sheets-data-validation)

`@univerjs/sheets-data-validation` connects shared data validation rules to Univer Sheets and provides sheet-specific commands, services, and Facade APIs.

## Package Overview

| Package | UMD global | CSS | Locales | Facade entry | Worker entry |
| --- | --- | :---: | :---: | :---: | :---: |
| `@univerjs/sheets-data-validation` | `UniverSheetsDataValidation` | No | Yes | Yes | No |

## Installation

```sh
pnpm add @univerjs/sheets-data-validation
# or
npm install @univerjs/sheets-data-validation
```

## Usage

Start with the [integration setup](https://docs.univer.ai/) for your document type, including its required plugins, styles, and locale resources. The snippet below assumes that setup is complete.

```ts
import { LocaleType, mergeLocales, Univer } from '@univerjs/core';
import { UniverSheetsDataValidationPlugin } from '@univerjs/sheets-data-validation';
import EnUS from '@univerjs/sheets-data-validation/locale/en-US';

const univer = new Univer({
    locale: LocaleType.EN_US,
    locales: {
        [LocaleType.EN_US]: mergeLocales(EnUS),
    },
});

univer.registerPlugin(UniverSheetsDataValidationPlugin);
```

## Integration Notes

Use this package with `@univerjs/sheets-data-validation-ui` when users need validation dialogs, dropdowns, and error UI.
- Import `@univerjs/sheets-data-validation/facade` when using this package through Univer Facade APIs.

## Resources

- [Documentation](https://docs.univer.ai)
- [NPM package](https://npmjs.com/package/@univerjs/sheets-data-validation)
- [GitHub repository](https://github.com/dream-num/univer)
