Skip to content

[Meta][CSS-in-JS] Switching to emotion #3912

Closed as not planned
3 of 3 issues completed
Closed as not planned

Description

@cchaos

This is a meta ticket to discuss the rollout plan of the CSS in JS solution (Emotion). It is for documenting the expected upgrade process both within EUI and by consuming applications, and being transparent about our timeline.

(Tentative) Timeline & tasks

Spring 2021:

Get the contexts built out and (partially) used in the EUI components and docs, as well as thoroughly tested in downstream applications like Kibana and Cloud. Figure out all the dependencies, hooks and possible state management that go with it.

Summer 2021:

Fall 2021:

Start shifting component styles from SASS to JS. This part will probably take a full year and probably means phasing out the old 'legacy' theme, making Amsterdam default.

### 2022-2024
- [ ] #5685

Beyond component conversions:

Needs discussion

  • Remove use of ghost and ink in favor of EuiThemeProvider + colorMode (see discussion)
    • I'm not sure if this still needs to be done or if this is something to instead be visited in the new theme/visual refresh work.
  • Deprecate using EUI's classnames
  • Remove class names (after a lengthy deprecation period)
    • For context, the deprecation of classNames was something Caroline and Greg were pushing for. I'm not convinced that it's even feasible considering Kibana however.

Sub-issues

Sub-issues

3 of 3 Issues completed
Loading 3 sub-issues

Activity

  1. added
    meta
    on Aug 13, 2020
  2. changed the title [-][Meta] CSS in JS: Switching to Emotion[/-] [+][Meta] CSS-in-JS: Switching to `emotion`[/+] on Jul 30, 2021
  3. cchaos commented on Aug 15, 2021

    @cchaos
    ContributorAuthor

    Upgrade process

    Questions

    • Do we want to allow EUI styling apart from css prop (e.g. in Kibana)
    • EUI does not always apply className to the outermost element, does a css prop on an object prop apply as expected
    • What do we do with the handful of createElement usages, replace with emotion’s createElement equivalent?
    • When css is applied on a custom component which element gets the style? What if there's a fragment at the top level?

    EUI

    See #5685

    Charts theme

    Can we create a EuiThemeCharts similar to EuiThemeDefault that can be used primarily as a React hook to pass the theme down to an elastic-charts implementation? And it know the light/dark color mode automatically.

    Consuming apps

    • TBD (babel, etc)
    • Vanilla JS support (Kibana plugins; basic, immutable theme variables)
    • SSR support (verify + link to emotion's docs)
    • Update Gatsby and Next starters
  4. pinned this issue on Aug 17, 2021
  5. lightwave commented on Oct 30, 2021

    @lightwave

    Will EUI theme be compatible with the theme specification used in theme-ui and styled system?

  6. cchaos commented on Nov 1, 2021

    @cchaos
    Author
  7. lightwave commented on Nov 3, 2021

    @lightwave
  8. cchaos commented on Nov 3, 2021

    @cchaos
    ContributorAuthor

    @lightwave I've converted your questions to a discussion to keep this Meta issue centered around tasks. #5351

  9. jlalmes commented on Nov 23, 2021

    @jlalmes

    Keen to help out with the implementation and rollout for this. Our use case:

    • We need to easily adjust the "primary", "primaryText" colors at runtime using the EuiThemeProvider
    • We would like to use individual components from this library for lightweight applications without needing to include the main @elastic/eui/dist/eui_theme_amsterdam_light.css css file in our bundle.

    It seems that we're blocked by this PR #4575 which will outline the game plan for moving forward & converting all other components from sass to emotion. What is the current status of this - and how can we help move this PR closer to alpha/beta/production?

  10. cchaos commented on Nov 23, 2021

    @cchaos
    ContributorAuthor

    👋 Hey @jlalmes, that's exciting and we'd absolutely love the help during the conversion. You are correct about #4575 being the next step in the process. We like to put a lot of thinking up front in the endeavors so it's less likely that we look back and wish we had done it differently 😄 . We've tentatively given ourselves the typically slow month of December to figure that part out and have a final plan hopefully by the beginning of 2022. We totally understand your pain points and we hope this will solve most of them. Mostly we've been having to juggle prioritizing this work in tandem with other consumer priorities.

  11. changed the title [-][Meta] CSS-in-JS: Switching to `emotion`[/-] [+][Meta][CSS-in-JS] Switching to `emotion`[/+] on Mar 3, 2022
  12. unpinned this issue on Apr 3, 2023
  13. 3 remaining items

  14. removed this from the 8.16 FF milestone on Aug 28, 2024
  15. removed their assignment
    on Dec 13, 2024
  16. added theissue type on Dec 15, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    emotionmetatech debt

    Type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions