@wix/design-system
Version:
@wix/design-system
18 lines (12 loc) • 644 B
Markdown
Using composite component validators, you can specify `children` requirements.
Or any other property of `node` type.
> **Note:** PropTypes have been removed from all components. These composite validators are legacy utilities and are no longer actively used.
```js
import { children, optional, once, multiple } from './CompositeValidation';
// Validates that children include an optional Label and exactly one Input
children(optional(Label), once(Input))
// Validates that children include exactly one Label and one Input
children(once(Label), once(Input))
// Validates that title includes one or more Labels
children(multiple(Label))
```