Skip to content

Style buttons now preview their own formatting (MS Word-style)#5

Merged
codewriter3000 merged 2 commits intomasterfrom
copilot/adjust-style-buttons-appearance
Mar 17, 2026
Merged

Style buttons now preview their own formatting (MS Word-style)#5
codewriter3000 merged 2 commits intomasterfrom
copilot/adjust-style-buttons-appearance

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Mar 17, 2026

Formatting buttons in the ribbon showed generic icons with no visual hint of what they'd produce. This replaces them with styled-text buttons that render their own label in the format they apply — matching the MS Word ribbon convention.

Changes

Ribbon.tsx

  • Added FormatButton: a native <button> with aria-pressed, aria-label, and title; replaces Carbon's icon-only Button for the 7 text-format toggles
  • Each button renders a <span> styled with the format it applies:
    <FormatButton active={isBold} onClick={fmt('bold')} title="Bold">
      <span className="format-btn__label format-btn__label--bold">B</span>
    </FormatButton>
  • STYLES array extended with previewStyle: React.CSSProperties; each Styles-chunk button wraps its label in <span style={style.previewStyle}> so "Heading 1" looks like an actual H1, etc.
  • Removed 7 unused Carbon icon imports (TextBold, TextItalic, TextUnderline, TextStrikethrough, TextSubscript, TextSuperscript, TextHighlight)

globals.scss

  • .format-btn — sizing, hover/active states (#cce0ff bg + #0f62fe border), focus ring
  • .format-btn__label + modifier classes --bold, --italic, --underline, --strikethrough, --highlight

Result

Ribbon with styled format buttons

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • www-api.ibm.com
    • Triggering command: /home/REDACTED/work/_temp/ghcca-node/node/bin/node node /home/REDACTED/work/carbon-type/carbon-type/node_modules/@ibm/telemetry-js/dist/REDACTED-process.js --log=/tmp/ibmtelemetry-20260317T143058804Z-771048.log --config=telemetry.yml (dns block)

If you need me to access, download, or install something from one of these locations, you can either:

Original prompt

Could we possibly adjust how the style buttons look by having them mimic what they will actually look like if used in the document? MS Word does this and we should make custom buttons in order to accommodate this change.

Created from VS Code.


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

@bolt-new-by-stackblitz
Copy link
Copy Markdown

Review PR in StackBlitz Codeflow Run & review this pull request in StackBlitz Codeflow.

Co-authored-by: codewriter3000 <58712923+codewriter3000@users.noreply.github.com>
Copilot AI changed the title [WIP] Update style buttons to mimic document appearance Style buttons now preview their own formatting (MS Word-style) Mar 17, 2026
Copilot AI requested a review from codewriter3000 March 17, 2026 14:43
@codewriter3000 codewriter3000 marked this pull request as ready for review March 17, 2026 15:10
@codewriter3000 codewriter3000 merged commit 7b102e2 into master Mar 17, 2026
1 check passed
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