Skip to content

Commit

Permalink
Merge pull request #18726 from JReinhold/patch-2
Browse files Browse the repository at this point in the history
docs(addon-controls): custom matchers are no longer default
  • Loading branch information
jonniebigodes authored Nov 23, 2022
2 parents 53af8af + 9cb56e9 commit 6b6a860
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions docs/essentials/controls.md
Original file line number Diff line number Diff line change
Expand Up @@ -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 -->

Expand Down

0 comments on commit 6b6a860

Please sign in to comment.