Skip to content

[MarkdownEditor] Add className support to toolbar for custom styling#9349

Merged
weronikaolejniczak merged 3 commits intoelastic:mainfrom
ragini-pandey:feat/markdown-editor-toolbar-classname
Feb 2, 2026
Merged

[MarkdownEditor] Add className support to toolbar for custom styling#9349
weronikaolejniczak merged 3 commits intoelastic:mainfrom
ragini-pandey:feat/markdown-editor-toolbar-classname

Conversation

@ragini-pandey
Copy link
Contributor

@ragini-pandey ragini-pandey commented Jan 31, 2026

Summary

Adds className support to the EuiMarkdownEditor toolbar through the toolbarProps prop, allowing consumers to apply custom styles to the toolbar element.

Changes

  • Extended toolbarProps to accept className in addition to right
  • Updated EuiMarkdownEditorToolbar to merge custom className with the default euiMarkdownEditorToolbar class using classNames utility
  • Added unit test to verify className is properly applied

Usage

<EuiMarkdownEditor
  value={value}
  onChange={onChange}
  aria-label="Markdown editor"
  toolbarProps={{ className: 'myCustomToolbarClass' }}
/>

Why are we making this change?

Closes #9153

In Kibana dashboards, there's a need to display very small markdown editors where hiding the toolbar is necessary. Currently, this is being done by targeting the element via data-test-subj, but targeting via className is preferred for styling purposes. See related Kibana PR: elastic/kibana#240806

Screenshots #

N/A - No visual changes. This adds a passthrough prop for custom styling.

Impact to users

Non-breaking change. This is an additive enhancement that allows users to pass a custom className to the toolbar via toolbarProps. Existing usage remains unaffected.

Users who previously targeted the toolbar via data-test-subj="euiMarkdownEditorToolbar" can now use a custom className instead:

// Before (using data-test-subj)
<EuiMarkdownEditor ... />
// CSS: [data-test-subj="euiMarkdownEditorToolbar"] { display: none; }

// After (using className)
<EuiMarkdownEditor toolbarProps={{ className: 'hiddenToolbar' }} ... />
// CSS: .hiddenToolbar { display: none; }

QA

General checklist

  • Browser QA
    • Checked in both light and dark modes (No visual changes)
    • Checked in both MacOS and Windows high contrast modes (No visual changes)
    • Checked in mobile (No visual changes)
    • Checked in Chrome, Safari, Edge, and Firefox (No visual changes)
    • Checked for accessibility including keyboard-only and screenreader modes (No accessibility impact)
  • Docs site QA
    • Added documentation (Props are self-documenting via TypeScript)
    • Props have proper autodocs (using @default if default values are missing) and playground toggles
    • Checked Code Sandbox works for any docs examples (No new examples added)
  • Code quality checklist
    • Added or updated jest and cypress tests
    • Updated visual regression tests (No visual changes)
  • Release checklist
    • A changelog entry exists and is marked appropriately
    • If applicable, added the breaking change issue label (Not a breaking change)
    • If the changes unblock an issue in a different repo, smoke tested carefully (Minor enhancement)
  • Designer checklist
    • If applicable, file an issue to update EUI's Figma library (No UI changes)
@ragini-pandey ragini-pandey requested a review from a team as a code owner January 31, 2026 05:59
@github-actions
Copy link

👋 Since this is a community submitted pull request, a Buildkite build has not been started automatically. Would an Elastic organization member please verify the contents of this pull request and kick off a build manually?

@github-actions github-actions bot added the community contribution (Don't delete - used for automation) label Jan 31, 2026
Copy link
Contributor

Choose a reason for hiding this comment

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

@ragini-pandey this filename needs to be: 9349.md, same as your PR number! 😄

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ohk Thanks. I thought it was an issue number.
Renamed!

Copy link
Contributor

@weronikaolejniczak weronikaolejniczak left a comment

Choose a reason for hiding this comment

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

The code looks as expected, let's see if the CI passes. If so, we're good to merge! Thank you for the contribution, @ragini-pandey 🙏🏻 💚

@weronikaolejniczak
Copy link
Contributor

buildkite test this

@elasticmachine
Copy link
Collaborator

@weronikaolejniczak weronikaolejniczak enabled auto-merge (squash) February 2, 2026 12:38
@elasticmachine
Copy link
Collaborator

💚 Build Succeeded

@weronikaolejniczak weronikaolejniczak merged commit 0fed41e into elastic:main Feb 2, 2026
5 checks passed
mgadewoll added a commit to elastic/kibana that referenced this pull request Feb 10, 2026
## Dependency updates

- `@elastic/eui`: v112.2.0 ⏩ v112.3.0
- `@elastic/eslint-plugin-eui`: v2.7.0 ⏩ v2.8.0

---

## Package updates

### `@elastic/eui`
[v112.3.0](https://github.com/elastic/eui/releases/tag/v112.3.0)

- Added new `server` icon.
([#9355](elastic/eui#9355))
- Added `className` support to `EuiMarkdownEditor`'s `toolbarProps` for
custom toolbar styling
([#9349](elastic/eui#9349))
- Updated `EuiFilePicker` to use the `upload` icon to better indicate
uploads. ([#9351](elastic/eui#9351))
- Exported the flyout system store singleton and added an event observer
for emitting close session events
([#9347](elastic/eui#9347))
- Updated `EuiIcon` to use standard dynamic imports for icon assets,
enabling native support for modern bundlers (Rollup, Parcel) and
improving initial load performance
([#9342](elastic/eui#9342))

**Bug fixes**

- Fixed a potential crash in the flyout system: due to asynchronous
state updates and React's batching behavior, it was possible to
experience a crash when closing a managed flyout.
([#9356](elastic/eui#9356))

### `@elastic/eslint-plugin-eui` v2.8.0

- Added new `icon-accessibility-rules` rule.
([#9357](elastic/eui#9357))
- Added new `badge-accessibility-rules` rule.
([#9354](elastic/eui#9354))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

community contribution (Don't delete - used for automation)

3 participants