@storybook/react#Meta TypeScript Examples

The following examples show how to use @storybook/react#Meta. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: SQFormResetButtonWithConfirmation.stories.tsx    From SQForm with MIT License 6 votes vote down vote up
meta: Meta = {
  title: 'Components/SQFormResetButtonWithConfirmation',
  component: SQFormResetButtonWithConfirmationComponent,
  argTypes: {
    onReset: {action: 'reset', table: {disable: true}},
  },
  parameters: {
    docs: {
      page: createDocsPage(),
    },
  },
}
Example #2
Source File: Typography.stories.tsx    From ontwik-ui with MIT License 6 votes vote down vote up
meta: Meta = {
  title: 'Typography',
  component: Typography,
  argTypes: {
    variant: {
      name: 'variant',
      type: { name: 'string', required: false },
      description: 'Typography variant',
      control: {
        type: 'select',
        options: ['title', 'subtitle', 'paragraph', 'content'],
      },
    },
    bold: {
      name: 'bold',
      type: { name: 'boolean', required: false },
      description: 'Typography bold',
      control: {
        type: 'inline-radio',
        options: [true, false],
      },
    },
    align: {
      name: 'align',
      type: { name: 'string', required: false },
      description: 'Typography alignment',
      control: {
        type: 'select',
        options: ['left', 'center', 'right'],
      },
    },
  },
  parameters: {
    controls: { expanded: true },
  },
}
Example #3
Source File: story.tsx    From joplin-utils with MIT License 6 votes vote down vote up
/**
 * Create a typed story of a given component
 *
 * @example
 * const { meta, of } = story(Button)
 * export default meta({})
 * export const story1 = of({})
 * export const story2 = of({})
 */
export function story<T>(Component: React.ComponentType<T>) {
  return {
    meta(meta: Meta<T>): Meta<T> {
      return { ...meta, component: Component }
    },
    of(
      annotations: Annotations<T, StoryFnReactReturnType> &
        Pick<BaseStory<any, any>, 'storyName'> = {},
    ) {
      const copy: Story<T> = (props: T) => <Component {...props} />
      Object.assign(copy, annotations)
      return copy
    },
  }
}
Example #4
Source File: Select.stories.tsx    From plasmic with MIT License 6 votes vote down vote up
meta: Meta = {
  title: "Select",
  component: Select,
  subcomponents: {
    "Select.Option": Select__Option,
    "Select.OptionGroup": Select__OptionGroup,
  },
  argTypes: {
    placeholder: {
      control: "text",
    },
    ...FOCUSABLE_ARGS,
    ...HOVERABLE_ARGS,
  },
  parameters: {
    controls: { expanded: true },
  },
}
Example #5
Source File: MenuButton.stories.tsx    From plasmic with MIT License 6 votes vote down vote up
meta: Meta = {
  title: "MenuButton",
  component: MenuButton,
  argTypes: {
    ...FOCUSABLE_ARGS,
    ...HOVERABLE_ARGS,
  },
  parameters: {
    controls: { expanded: true },
  },
}
Example #6
Source File: Checkbox.stories.tsx    From plasmic with MIT License 6 votes vote down vote up
meta: Meta = {
  title: "Checkbox",
  component: Checkbox,
  argTypes: {
    ...FOCUSABLE_ARGS,
    ...HOVERABLE_ARGS,
  },
  parameters: {
    controls: { expanded: true },
  },
}
Example #7
Source File: Logo.stories.tsx    From dendron with GNU Affero General Public License v3.0 6 votes vote down vote up
meta: Meta = {
  title: "Logo",
  component: Logo,
  argTypes: {
    boxSize: {
      control: { type: "range", min: 8, max: 80, step: 8 },
    },
  },
  parameters: {
    controls: { expanded: true },
  },
}
Example #8
Source File: SQFormTextarea.stories.tsx    From SQForm with MIT License 6 votes vote down vote up
meta: Meta = {
  title: 'Components/SQFormTextarea',
  component: SQFormTextareaComponent,
  argTypes: {
    onBlur: {action: 'blurred', table: {disable: true}},
    onChange: {action: 'changed', table: {disable: true}},
    name: {table: {disable: true}},
  },
  parameters: {
    docs: {
      page: createDocsPage(),
    },
  },
}
Example #9
Source File: SQFormResetInitialValuesButton.stories.tsx    From SQForm with MIT License 6 votes vote down vote up
meta: Meta = {
  title: 'Components/SQFormResetInitialValuesButton',
  component: SQFormResetInitialValuesButtonComponent,
  parameters: {
    docs: {
      page: createDocsPage(),
    },
  },
}
Example #10
Source File: SQFormReadOnlyField.stories.tsx    From SQForm with MIT License 6 votes vote down vote up
meta: Meta = {
  title: 'Components/SQFormReadOnlyField',
  component: SQFormReadOnlyFieldComponent,
  argTypes: {
    name: {table: {disable: true}},
  },
  parameters: {
    docs: {
      page: createDocsPage({markdown}),
    },
  },
}
Example #11
Source File: SQFormMaskedReadOnlyField.stories.tsx    From SQForm with MIT License 6 votes vote down vote up
meta: Meta = {
  title: 'Components/SQFormMaskedReadOnlyField',
  component: SQFormMaskedReadOnlyFieldComponent,
  argTypes: {
    onBlur: {action: 'blurred', table: {disable: true}},
    onChange: {action: 'changed', table: {disable: true}},
    name: {table: {disable: true}},
  },
  parameters: {
    docs: {
      page: createDocsPage(),
    },
  },
}
Example #12
Source File: SQFormDropdown.stories.tsx    From SQForm with MIT License 6 votes vote down vote up
meta: Meta = {
  title: 'Components/SQFormDropdown',
  component: SQFormDropdownComponent,
  argTypes: {
    children: {table: {disable: true}},
    onBlur: {action: 'blurred', table: {disable: true}},
    onChange: {action: 'changed', table: {disable: true}},
    name: {table: {disable: true}},
    sqFormProps: {table: {disable: true}},
  },
  parameters: {
    docs: {
      page: createDocsPage({markdown}),
      source: {
        type: 'code',
      },
    },
  },
}
Example #13
Source File: SQFormDialog.stories.tsx    From SQForm with MIT License 6 votes vote down vote up
meta: Meta = {
  title: 'Forms/SQFormDialog',
  component: SQFormDialog,
  argTypes: {
    onSave: {action: 'onSave', table: {disable: true}},
    onTertiaryClick: {action: 'onTertiaryClick', table: {disable: true}},
    onClose: {action: 'onClose', table: {disable: true}},
    children: {table: {disable: true}},
    validationSchema: {table: {disable: true}},
  },
  parameters: {
    docs: {page: createDocsPage({showStories: false})},
  },
}
Example #14
Source File: SQFormDateTimePicker.stories.tsx    From SQForm with MIT License 6 votes vote down vote up
meta: Meta = {
  title: 'Components/SQFormDateTimePicker',
  component: SQFormDateTimePickerComponent,
  argTypes: {
    onBlur: {action: 'blurred', table: {disable: true}},
    onChange: {action: 'changed', table: {disable: true}},
    name: {table: {disable: true}},
  },
  parameters: {
    docs: {page: createDocsPage({markdown})},
  },
}
Example #15
Source File: SQFormDatePickerWithDateFNS.stories.tsx    From SQForm with MIT License 6 votes vote down vote up
meta: Meta = {
  title: 'Components/SQFormDatePickerWithDateFNS',
  component: SQFormDatePickerComponent,
  argTypes: {
    onBlur: {action: 'blurred', table: {disable: true}},
    onChange: {action: 'changed', table: {disable: true}},
    schema: {table: {disable: true}},
    name: {table: {disable: true}},
  },
  parameters: {
    docs: {page: createDocsPage({markdown})},
  },
}
Example #16
Source File: SQFormDatePickerWithCalendarInputOnly.stories.tsx    From SQForm with MIT License 6 votes vote down vote up
meta: Meta = {
  title: 'Components/SQFormDatePickerWithCalendarInputOnly',
  component: SQFormDatePickerWithCalendarInputOnlyComponent,
  argTypes: {
    onBlur: {action: 'blurred', table: {disable: true}},
    onChange: {action: 'changed', table: {disable: true}},
    name: {table: {disable: true}},
  },
  parameters: {
    docs: {page: createDocsPage()},
  },
}
Example #17
Source File: SQFormDatePicker.stories.tsx    From SQForm with MIT License 6 votes vote down vote up
meta: Meta = {
  title: 'Components/SQFormDatePicker',
  component: SQFormDatePickerComponent,
  argTypes: {
    onBlur: {action: 'blurred', table: {disable: true}},
    onChange: {action: 'changed', table: {disable: true}},
    schema: {table: {disable: true}},
    name: {table: {disable: true}},
  },
  parameters: {
    docs: {page: createDocsPage({markdown})},
  },
}
Example #18
Source File: SQFormAutocomplete.stories.tsx    From SQForm with MIT License 6 votes vote down vote up
meta: Meta = {
  title: 'Components/SQFormAutocomplete',
  component: SQFormAutocomplete,
  argTypes: {
    onBlur: {action: 'blurred', table: {disable: true}},
    onChange: {action: 'changed', table: {disable: true}},
    onInputChange: {action: 'inputChanged', table: {disable: true}},
    name: {table: {disable: true}},
  },
  parameters: {
    docs: {
      page: createDocsPage(),
      source: {
        type: 'code',
      },
    },
  },
}
Example #19
Source File: SQFormAsyncAutocomplete.stories.tsx    From SQForm with MIT License 6 votes vote down vote up
meta: Meta = {
  title: 'Components/SQFormAsyncAutocomplete',
  component: SQFormAsyncAutocomplete,
  argTypes: {
    onBlur: {action: 'blurred', table: {disable: true}},
    onChange: {action: 'changed', table: {disable: true}},
    onInputChange: {action: 'inputChanged', table: {disable: true}},
    onOpen: {action: 'opened', table: {disable: true}},
    onClose: {action: 'closed', table: {disable: true}},
    name: {table: {disable: true}},
    handleAsyncInputChange: {table: {disable: true}},
  },
  parameters: {
    docs: {
      page: createDocsPage(),
      source: {
        type: 'code',
      },
    },
  },
}
Example #20
Source File: SQFormReadOnly.stories.tsx    From SQForm with MIT License 5 votes vote down vote up
meta: Meta = {
  title: 'forms/SQFormReadOnly',
  component: SQFormReadOnlyComponent,
  argTypes: {
    name: {table: {disable: true}},
  },
}
Example #21
Source File: FilePicker.stories.tsx    From useFilePicker with MIT License 5 votes vote down vote up
meta: Meta = {
  title: 'use-file-picker',
  component: FilePickerComponent,
  argTypes: {
    multiple: {
      defaultValue: true,
      control: {
        type: 'boolean',
      },
      description: 'Allow user to pick multiple files at once',
    },
    accept: {
      defaultValue: '*',
      control: {
        type: 'text',
      },
      description: 'Set type of files that user can choose from the list',
    },
    readAs: {
      defaultValue: 'Text',
      control: {
        options: ['Text', 'BinaryString', 'ArrayBuffer', 'DataURL'],
        type: 'select',
      },
      description: 'Set a return type of filesContent',
    },
    readFilesContent: {
      defaultValue: true,
      control: {
        type: 'boolean',
      },
      description: 'Ignores files content and omits reading process if set to false',
    },
    storyTitle: {
      name: '',
      control: {
        type: 'none',
      },
    },
  },
  parameters: {
    controls: { expanded: true },
  },
}
Example #22
Source File: SampleApp.stories.tsx    From react-query-auth with MIT License 5 votes vote down vote up
meta: Meta = {
  title: 'SampleApp',
  component: SampleApp,
  parameters: {
    controls: { expanded: true },
  },
}
Example #23
Source File: Menu.stories.tsx    From plasmic with MIT License 5 votes vote down vote up
meta: Meta = {
  title: "Menu",
  component: Menu,
  parameters: {
    controls: { expanded: true },
  },
}
Example #24
Source File: Button.stories.tsx    From ontwik-ui with MIT License 4 votes vote down vote up
meta: Meta = {
  title: 'Button',
  component: Button,
  argTypes: {
    title: {
      name: 'title',
      type: { name: 'string', required: true },
      description: 'Button title',
      control: {
        type: 'text',
      },
    },
    variant: {
      name: 'variant',
      type: { name: 'string', required: false },
      description: 'Button variant',
      control: {
        type: 'select',
        options: ['primary', 'secondary', 'ghost'],
      },
    },
    size: {
      name: 'size',
      type: { name: 'string', required: false },
      description: 'Button size',
      control: {
        type: 'select',
        options: ['xlarge', 'large', 'medium', 'small'],
      },
    },
    state: {
      name: 'state',
      type: { name: 'string', required: false },
      description: 'Button state',
      control: {
        type: 'select',
        options: ['success', 'danger', 'warning', false],
      },
    },
    color: {
      name: 'color',
      type: { name: 'string', required: false },
      description: 'Button text color',
      control: {
        type: 'color',
      },
    },
    bg: {
      name: 'bg',
      type: { name: 'string', required: false },
      description: 'Button background color',
      control: {
        type: 'color',
      },
    },
    borderColor: {
      name: 'borderColor',
      type: { name: 'string', required: false },
      description: 'Button border color',
      control: {
        type: 'color',
      },
    },
    gradient1: {
      name: 'gradient 1',
      type: { name: 'string', required: false },
      description: 'Button Gradient',
      control: {
        type: 'color',
      },
    },
    gradient2: {
      name: 'gradient 2',
      type: { name: 'string', required: false },
      description: 'Button Gradient',
      control: {
        type: 'color',
      },
    },
    disabled: {
      name: 'disabled',
      type: { name: 'boolean', required: false },
      description: 'Button disabled',
      control: {
        type: 'inline-radio',
        options: [true, false],
      },
    },
    wide: {
      name: 'wide',
      type: { name: 'boolean', required: false },
      description: 'Button wide',
      control: {
        type: 'inline-radio',
        options: [true, false],
      },
    },
    uppercase: {
      name: 'uppercase',
      type: { name: 'boolean', required: false },
      description: 'Button text uppercase',
      control: {
        type: 'inline-radio',
        options: [true, false],
      },
    },
    icon: {
      name: 'icon',
      type: { name: 'string', required: false },
      description: 'Button icon',
      control: {
        type: 'inline-radio',
        options: [true, false],
      },
    },
    iconPosition: {
      name: 'iconPosition',
      type: { name: 'string', required: false },
      description: 'Button icon position',
      control: {
        type: 'inline-radio',
        options: ['right', 'left'],
      },
    },
    type: {
      name: 'type',
      type: { name: 'string', required: false },
      description: 'Button type',
      control: {
        type: 'select',
        options: ['button', 'submit', 'reset'],
      },
    },
  },
  parameters: {
    controls: { expanded: true },
  },
}