Skip to content

feat(docs-app,ui-buttons): add auto-generated prop playground - #2657

Open
balzss wants to merge 3 commits into
masterfrom
docs/visual-prop-editor
Open

feat(docs-app,ui-buttons): add auto-generated prop playground#2657
balzss wants to merge 3 commits into
masterfrom
docs/visual-prop-editor

Conversation

@balzss

@balzss balzss commented Jul 24, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Add internal PropEditor docs component that reads a component's react-docgen metadata at runtime and auto-generates prop controls (enum selects, boolean toggle, text/number inputs) with a live preview and generated JSX.
  • Register PropEditor as a docs global so it can be embedded in any README via a type: embed block; supports an optional config for per-component tuning (include/exclude, control overrides, sample children).
  • Wire it into the Button v2 README as a proof of concept.

Test Plan

  • On the Button docs page, scroll to the new "Playground" section: confirm controls are auto-generated and editing them updates the preview and code live.
  • Verify complex/function props (as, margin, cursor, renderIcon, onClick) show under "Not editable here" and are not rendered as controls.
  • Switch docs theme/version and confirm the preview re-themes and metadata still loads.

Fixes INSTUI-5128

🤖 Generated with Claude Code

@balzss balzss self-assigned this Jul 24, 2026
@balzss
balzss requested review from adamlobler and hajnaldo July 24, 2026 08:41
@github-actions

github-actions Bot commented Jul 24, 2026

Copy link
Copy Markdown
Contributor
PR Preview Action v1.8.1

QR code for preview link

🚀 View preview at
https://instructure.design/pr-preview/pr-2657/

Built to branch gh-pages at 2026-08-24 10:43 UTC.
Preview will be ready when the GitHub Pages deployment is complete.

@github-actions

github-actions Bot commented Jul 24, 2026

Copy link
Copy Markdown
Contributor

Visual regression report

Cypress suite:Failing — see the run logs.

Visual diff: ⚠️ Changes detected.

Status Count
Unchanged 94
Changed 2
New 0
Removed 0

Accessibility (axe): ⚠️ 15 violations on 7 screenshots.

Impact Issue Rule Elements Screenshots
serious Text contrast is too low color-contrast 15 7

📊 View full report — click a screenshot's ⚠ badge to see each violation boxed on the image, with the offending element named and contrast failures shown as color swatches.

Diff images (2)

badge-canvas.png — 1573 pixels differ

tooltip-light.png — 14438 pixels differ

Baselines come from the visual-baselines branch. They refresh on every merge to master. The Cypress suite line covers the a11y and console-error assertions — a ❌ there means the suite found real issues even if the visual diff is clean.

github-actions Bot pushed a commit that referenced this pull request Jul 24, 2026

@adamlobler adamlobler left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the quick work, this is exactly what I had in mind! 🔥

I would only adjust the layout a bit because the prop selectors are very wide, while the preview is quite small. I think a layout where the component preview and the prop selectors are next to each other would work better. Right now, if a component has a lot of props, you can’t see the preview without scrolling.

Also, if it’s possible, it would be great to be able to change the theme locally within this view. It’s a small UX improvement, but it’s something we do a lot. Currently, you have to scroll back up, change the theme, wait for the page to reload, and then set the props again, which is a lot of effort for a quick check that we do a lot.

@balzss
balzss force-pushed the docs/visual-prop-editor branch from eb42c0b to 97d17fd Compare July 27, 2026 10:15
github-actions Bot pushed a commit that referenced this pull request Jul 27, 2026
@balzss
balzss requested a review from adamlobler July 27, 2026 11:31
balzss and others added 2 commits July 27, 2026 18:04
Introduce an internal `PropEditor` docs component that reads a component's
react-docgen metadata at runtime and generates a form of editable prop
controls (selects for string-literal unions, a toggle for booleans, text and
number inputs) with a live preview and the equivalent JSX. It lets non-devs
experiment with components without editing code.

The editor is registered as a docs global so it can be dropped into any README
via a `type: embed` block, and accepts an optional `config` for per-component
adjustments (include/exclude, control overrides, sample children). Wire it up
as a proof of concept in the Button v2 README.

Preview and code generation reuse the existing Preview/compileAndRenderExample
pipeline; theme and version come from AppContext.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
Add a /comprehension-check skill that quizzes the author on the current diff's
design decisions before committing, to stop AI-generated code the author can't
explain from landing. It skips trivial diffs, asks free-text design questions,
grades against the diff, and teaches then re-quizzes on gaps.

Wire it into /commit as a step-0 preamble and whitelist the new skill file in
.gitignore so it ships alongside the other shared commands.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
@balzss
balzss force-pushed the docs/visual-prop-editor branch from 97d17fd to 4090706 Compare July 30, 2026 10:22
github-actions Bot pushed a commit that referenced this pull request Jul 30, 2026
… docs

Opt-in registry: 29 single-element forms and 39 composition templates, each
seeded so the preview renders and the snippet is complete.
@balzss
balzss force-pushed the docs/visual-prop-editor branch from 4090706 to 23f993d Compare August 24, 2026 10:39
github-actions Bot pushed a commit that referenced this pull request Aug 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