Skip to content

Add support for JSX components in slate-hyperscript - #6103

Merged
dylans merged 2 commits into
ianstormtaylor:mainfrom
12joan:ft/jsx-components
Sep 1, 2026
Merged

Add support for JSX components in slate-hyperscript#6103
dylans merged 2 commits into
ianstormtaylor:mainfrom
12joan:ft/jsx-components

Conversation

@12joan

@12joan 12joan commented Aug 31, 2026

Copy link
Copy Markdown
Contributor

Description
This PR adds support for JSX components in slate-hyperscript, analogous to React components.

Example

interface MentionProps {
  id: string
  children: unknown
}

function Mention({ id, children }: MentionProps) {
  return <element inline id={id}>{children}</element>
}

const element = (
  <element>
    This is <Mention id="alice-123">Alice</Mention>.
  </element>
)

Context
Complex applications using Slate sometimes require repetitive, deeply nested JSX for their tests. Using components lets us refactor out this JSX into reusable, logical units.

Checks

  • The new code matches the existing patterns and styles.
  • The tests pass with yarn test.
  • The linter passes with yarn lint. (Fix errors with yarn fix.)
  • The relevant examples still work. (Run examples with yarn start.)
  • You've added a changeset if changing functionality. (Add one with yarn changeset add.)

@changeset-bot

changeset-bot Bot commented Aug 31, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 0a7e31e

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
slate-hyperscript Minor

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

return !!match
},

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

From yarn fix

@dylans
dylans merged commit 0e798d3 into ianstormtaylor:main Sep 1, 2026
11 checks 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.

3 participants