Skip to content

feat(core): ColorButton, a compact colour trigger; StylePanel's custom colour uses it - #548

Merged
lorant-one merged 10 commits into
previewfrom
feat/color-button
Nov 24, 2026
Merged

lorant-one merged 10 commits into
previewfrom
feat/color-button

Conversation

@lorant-one

Copy link
Copy Markdown
Member

HOLD for 3.1. This is stacked on #514 (StylePanel row hints). Retarget it to preview once 3.0.0 and #514 are in.

Lorant asked for this after the Tavilio Design tab: the custom colour there needed a compact button-like trigger instead of the select-style field, and Tavilio had to build one itself (tavilio#239). This moves that trigger into core.

ColorButton (new, @once-ui-system/core)

  • A secondary size-s Button showing a 16px swatch and the hex. Before a colour is picked, it shows its label beside a swatch of every hue.
  • Clicking it opens the browser's colour picker (showPicker(), with a fallback to click()).
  • onValueChange fires on every drag, for a live preview. onValueCommit fires once, on the native change event when the picker closes, for saving.
  • Controlled (value) or uncontrolled (defaultValue). Also takes showValue, size, variant, disabled and aria-describedby.
  • The button is the control: it is named "label: #HEX". The native field is out of the Tab order and has aria-hidden.
  • Docs page form-controls/colorButton, catalog entry, regenerated AI harness, and a bundle-size entry (25.5 KB gzipped entry; root +0.6 KB).

StylePanel

  • When the custom Brand or Accent swatch is chosen, a right-aligned ColorButton now appears under the row in place of the full ColorInput field. The description is shown under it and wired to aria-describedby.
  • labels.custom.remove is deprecated, because there is no clear control any more. It is still accepted and ignored, so nothing breaks.
  • The StylePanel docs are updated to match.

Not changed: the strip fades. In 3.0, the Scroller's default edge is a mask with no blur, so the coloured smear Tavilio worked around on 2.8 does not happen here.

Checks

  • core: color-button (8 new tests, including axe), every-export-renders, color-input: pass.
  • blocks: 369/369 pass, with the custom-colour tests rewritten for the button.
  • tsc passes for core, blocks and docs. The AI validator is clean on the new code; the one warning left in StylePanelSections.tsx was there before this change.

Screenshots: /mnt/project-files/style-panel/core-colorbutton-docs.png, core-colorbutton-picked.png.


Generated by Claude Code

Rows take a `hint` (an info icon with a tooltip beside the label). The Root's
`hints` turns on an English default for every built-in row from the new
`labels.hints`, and `hint={false}` drops one. The Root's `labelWidth` gives
every inline label the same width so controls line up and long or translated
labels truncate instead of wrapping; it is ignored while `stacked`.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_016gNJtzSPqS85sXMVcAaizx
…m colour uses it

A button with a swatch and the hex that opens the browser's colour picker:
onValueChange previews each drag, onValueCommit fires once when the picker
closes. StylePanel's custom Brand and Accent colour shows it in place of the
ColorInput field; labels.custom.remove is deprecated (no clear control).
Docs page, AI harness and bundle-size entry.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_016gNJtzSPqS85sXMVcAaizx
@lorant-one lorant-one self-assigned this Nov 17, 2026

Copy link
Copy Markdown
Member Author

The Compare check fails on a single shot: /components/ogCard (31.55% changed). This PR doesn't touch OgCard or anything that page uses. The diff only covers ColorButton, StylePanel's custom colour row, their docs and tests, and the AI harness. OgCard draws link previews that are fetched at capture time, so that shot moves with remote content rather than with code. The other 859 shots are unchanged. The 2 new shots are the ColorButton docs page.

I'm leaving it red rather than adding visual-change, since nothing in this PR's own demos changed unexpectedly. This PR is held for 3.1 anyway.


Generated by Claude Code

Copy link
Copy Markdown
Member Author

"Build, typecheck and test" fails on 983cc4f in the same catalog size test as #514. catalog.json is 31,450 bytes against the 31,200 cap. #514's base is already at 31,303 after today's preview merge (WorkspaceSwitcher, see my comment there), and the ColorButton entry adds another 147 bytes. Nothing else in the run fails: 4,843 tests pass.

The cap needs to move with a note once #514 settles it, or the catalog needs trimming. If #514 only trims enough to clear its own 103 bytes, I'll shorten ColorButton's purpose line here so this PR clears too. I'm not pushing now, because another session pushed to this branch a few minutes ago.


Generated by Claude Code

@lorant-one
lorant-one changed the base branch from feat/style-panel-row-hints to preview November 24, 2026 00:52
@lorant-one
lorant-one merged commit a465489 into preview Nov 24, 2026
9 checks passed
@github-actions github-actions Bot mentioned this pull request Nov 24, 2026
27 tasks done
@lorant-one lorant-one added the approved label Nov 24, 2026 — with Claude
@lorant-one
lorant-one deleted the feat/color-button branch November 29, 2026 13:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants