storybook-addon-mock-date-parameter
v0.0.10
Published
mock date
Downloads
8
Maintainers
Readme
Storybook Addon storybook addon mock date parameter
mock date
Development scripts
npm run start
runs babel in watch mode and starts Storybooknpm run build
build and package your addon code
Switch from TypeScript to JavaScript
Don't want to use TypeScript? We offer a handy eject command: npm run eject-ts
This will convert all code to JS. It is a destructive process, so we recommended running this before you start writing any code.
Sample documentation template
# My Addon
## Installation
First, install the package.
```sh
npm install --save-dev my-addon
```
Then, register it as an addon in `.storybook/main.js`.
```js
// .storybook/main.ts
// Replace your-framework with the framework you are using (e.g., react-webpack5, vue3-vite)
import type { StorybookConfig } from '@storybook/your-framework';
const config: StorybookConfig = {
// ...rest of config
addons: [
'@storybook/addon-essentials'
'storybook-addon-mock-date-parameter', // 👈 register the addon here
],
};
export default config;
```
## Usage
The primary way to use this addon is to define the `exampleParameter` parameter. You can do this the
component level, as below, to affect all stories in the file, or you can do it for a single story.
```js
// Button.stories.ts
// Replace your-framework with the name of your framework
import type { Meta } from '@storybook/your-framework';
import { Button } from './Button';
const meta: Meta<typeof Button> = {
component: Button,
parameters: {
mockingDate: new Date(2002, 1, 1)
}
};
export default meta;
```