Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Try: React 19 <link /> for components #66781

Draft
wants to merge 3 commits into
base: try/react-19-beta
Choose a base branch
from

Conversation

tyxla
Copy link
Member

@tyxla tyxla commented Nov 6, 2024

What?

As we experiment with React 19, this PR attempts to use <link /> for component styles.

For more info, see:

Why?

Currently @wordpress/component styles are a monolithic stylesheet. This approach will allow us to have separate CSS files per component, and to load each of the stylesheets actually when the component is to be rendered.

How?

For the experiment, we're refactoring ButtonGroup's stylesheet from SCSS to CSS. In production, we'd either have CSS modules or have a pre-processing step from SASS to separate CSS files.

We're then loading the stylesheet by using <link /> directly in the ButtonGroup component.

Testing Instructions

  • Insert a Buttons block and a couple of buttons in it.
  • Select one of the Button blocks.
  • Open inspector controls of the block
  • Verify the stylesheet gets loaded and the width controls look well

Testing Instructions for Keyboard

Same

Screenshots or screencast

Screenshot 2024-11-06 at 13 28 27

@tyxla tyxla added [Package] Components /packages/components [Type] Experimental Experimental feature or API. labels Nov 6, 2024
@tyxla tyxla self-assigned this Nov 6, 2024
@tyxla tyxla changed the title Try: React 19 <link /> for components Try: React 19 <link /> for components Nov 6, 2024
@tyxla tyxla mentioned this pull request Nov 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Package] Components /packages/components [Type] Experimental Experimental feature or API.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant