Skip to content

feat: controllable pattern & attribute tags#48

Merged
DylanPiercey merged 18 commits intostorybookjs:mainfrom
LuLaValva:change-handlers
Mar 24, 2026
Merged

feat: controllable pattern & attribute tags#48
DylanPiercey merged 18 commits intostorybookjs:mainfrom
LuLaValva:change-handlers

Conversation

@LuLaValva
Copy link
Copy Markdown
Contributor

@LuLaValva LuLaValva commented Feb 19, 2026

Description

Adds first-class support for change handlers and Marko's controllable pattern.

Controllable args in argTypes can now include changeHandler. This does two things:

  1. Automatically add a _Change entry in the table with a default description and type that references docs, or a custom one determined by the user
  2. Wires up the arguments in storybook so they automatically sync with the preview, demonstrating how the pattern might be used.
controllable.mov
{
  argTypes: {
    value: {
      changeHandler: true,
      control: { type: "text" },
      description: "Controllable text value",
      table: {
        type: { summary: "string" },
      },
    },
    pressed: {
      changeHandler: "Control the `pressed` attribute with a hoist",
      control: { type: "boolean" },
      description: "Controllable boolean value",
      table: {
        type: { summary: "boolean" },
        defaultValue: {
          summary: "false",
        },
      },
    },
    color: {
      options: ["red", "orange", "yellow"],
      changeHandler: spanishChangeHandlerMessage,
      control: { type: "inline-radio" },
      description: "Controllable boolean value",
      table: {
        type: { summary: "boolean" },
      },
    },
  },
}

Checklist:

  • I have updated/added documentation affected by my changes.
  • I have added tests to cover my changes.

@changeset-bot
Copy link
Copy Markdown

changeset-bot bot commented Feb 19, 2026

🦋 Changeset detected

Latest commit: 44dd3f6

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@storybook/marko Minor

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@LuLaValva LuLaValva changed the title feat: add first-class support for change handlers feat: controllable, attribute tags, body content Mar 10, 2026
@LuLaValva LuLaValva changed the title feat: controllable, attribute tags, body content feat: controllable pattern & attribute tags Mar 18, 2026
@DylanPiercey DylanPiercey force-pushed the change-handlers branch 2 times, most recently from b462c00 to 3930f74 Compare March 24, 2026 21:34
@DylanPiercey DylanPiercey merged commit 3dd1596 into storybookjs:main Mar 24, 2026
2 of 3 checks passed
@DylanPiercey DylanPiercey removed their assignment Mar 24, 2026
@github-actions github-actions bot mentioned this pull request Mar 24, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants