Skip to content

[Feature] defineArgTypes macro to set argTypes for all stories #70

@floroz

Description

@floroz

The issue

Currently, in Storybook you have the possibility to define argTypes either via automatic inference or by manually setting the properties..

Manually setting argTypes brings the benefit to allow for a specific value to be selected within the controls, or overriding/customizing descriptions.

Syntax proposal

<script setup lang="ts">
import BButton from "./b-button.vue";

defineArgs<typeof BButton>({
  variant: {
    options: ["primary", "secondary"],
    control: "select",
  },
  label: {
    control: "text",
    description: "This is the text displayed on the button."
  },
});
</script>

<template>
  <Stories title="Components/Button" :component="BButton">
    <Story title="Primary">
      <BButton variant="primary" label="Click"/>
    </Story>
    <Story title="Secondary">
      <BButton variant="secondary" label="Click" />
    </Story>
  </Stories>
</template>

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions