Theme picker improvements and playground preview override#147
Open
johnleider wants to merge 11 commits intomasterfrom
Open
Theme picker improvements and playground preview override#147johnleider wants to merge 11 commits intomasterfrom
johnleider wants to merge 11 commits intomasterfrom
Conversation
Renders a div (configurable via Atom's `as` prop) with `data-theme` attribute for CSS variable scoping. Provides derived ThemeContext to descendants, overriding the active theme selection while reusing the parent's registered themes.
Each example now has a theme picker button in the preview area that lets users override the theme for that specific example. Uses the new Theme component to scope CSS variables and context to the preview.
Adds provider docs page with basic, nested, and slot-props examples demonstrating scoped theme overrides.
- Replace <p> elements with <div>/<span> to avoid default margins - Use branded themes (Polaris, Nebula, Blackguard, Odyssey) instead of just light/dark for more interesting examples - Add bg-background to Theme wrappers so colors display correctly - Move Slot Props and Polymorphic Rendering under Recipes header - Remove class="dark-area" from polymorphic example - Triple-nested theme example with distinct branded themes
Replace three static examples with one polished interactive demo. A notifications settings card re-themes in place as users click through all registered themes. Removes nested/slot-props example files in favor of inline code snippets under Recipes.
The per-example theme picker already handles theme switching. The example itself is now just the settings card — no duplicate UI.
Theme picker is now in the toolbar bar alongside the code toggle, visible for both peek and non-peek examples. Shows selected theme name when an override is active.
When a Theme component scopes a different theme (e.g. light inside dark), text color was inherited from the parent instead of using the scoped theme's on-background token. The adapter now emits `color: var(--v0-on-background)` in every `[data-theme]` rule.
Theme picker now previews on hover and commits on click. Mouse leave reverts to the committed theme.
Replace AppThemeToggle with a combined theme popover featuring an Editor/Preview segmented toggle. Editor tab mirrors the full theme selector. Preview tab allows overriding the repl iframe theme independently with hover-to-preview and click-to-persist. The repl main.ts now generates all themes from the shared theme definitions instead of hardcoding light/dark.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
[data-theme]rules now setcolor: var(--v0-on-background)so scoped themes inherit correct text colors (e.g. light theme inside dark parent)main.tsnow generates all themes from the shared theme definitions.Test plan