Merge branch 'next' into tech/introduce-preview-api

This commit is contained in:
Norbert de Langen 2022-11-23 19:24:17 +01:00
commit 5151554b4d
No known key found for this signature in database
GPG Key ID: FD0E78AF9A837762

View File

@ -88,14 +88,14 @@ This replaces the input with a radio group for a more intuitive experience.
## Custom control type matchers
For a few types, Controls will automatically infer them by using [regex](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/RegExp). You can change the matchers for a regex that suits you better.
For a few types, Controls can automatically be inferred with [regex](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/RegExp). If you've used the Storybook CLI to setup your project it should have automatically created the following defaults in `.storybook/preview.js`:
| Data type | Default regex | Description |
| :-------: | :-----------------------: | :-------------------------------------------------------: |
| **color** | `/(background\|color)$/i` | Will display a color picker UI for the args that match it |
| **color** | `/(background|color)$/i` | Will display a color picker UI for the args that match it |
| **date** | `/Date$/` | Will display a date picker UI for the args that match it |
To do so, use the `matchers` property in the `controls` parameter:
If you haven't used the CLI to setup the configuration, or if you want to define your own patterns, use the `matchers` property in the `controls` parameter:
<!-- prettier-ignore-start -->