diff --git a/app/vue/src/client/preview/index.ts b/app/vue/src/client/preview/index.ts index b3188e051a28..4e515081a915 100644 --- a/app/vue/src/client/preview/index.ts +++ b/app/vue/src/client/preview/index.ts @@ -68,6 +68,7 @@ const defaultContext: StoryContext = { name: 'unspecified', kind: 'unspecified', parameters: {}, + args: {}, }; function decorateStory( diff --git a/examples/official-storybook/stories/core/args.stories.js b/examples/official-storybook/stories/core/args.stories.js new file mode 100644 index 000000000000..fac8eee113d0 --- /dev/null +++ b/examples/official-storybook/stories/core/args.stories.js @@ -0,0 +1,62 @@ +import React, { useState } from 'react'; +import PropTypes from 'prop-types'; + +import { useArgs } from '@storybook/client-api'; + +// eslint-disable-next-line react/prop-types +const ArgUpdater = ({ args, updateArgs }) => { + const [argsInput, updateArgsInput] = useState(JSON.stringify(args)); + + return ( +
+

Hooks args:

+
{JSON.stringify(args)}
+
{ + e.preventDefault(); + updateArgs(JSON.parse(argsInput)); + }} + > +