Skip to content

Commit

Permalink
chore(wiki): add a section about css usage, behavior and required B…
Browse files Browse the repository at this point in the history
…abel preset (#8323)
  • Loading branch information
weronikaolejniczak authored Feb 17, 2025
1 parent 656ae53 commit f39dfe4
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion wiki/consuming-eui/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,9 +49,15 @@ import { findTestSubject } from '@elastic/eui/lib/test'; // Enzyme
import { findByTestSubject, render, screen } from '@elastic/eui/lib/test/rtl'; // React Testing Library
```

### Custom styles

EUI uses a CSS-in-JS approach for styling, specifically [Emotion](https://emotion.sh) library. We recommend using the `css` function (read more [here](https://emotion.sh/docs/css-prop#use-the-css-prop)) from `@emotion/react`, which automatically sets the generated `className` and combines all passed styles into a single ruleset. To enable `css` concatenation, you'll need the [Babel preset](https://www.npmjs.com/package/@emotion/babel-preset-css-prop).

You can find more information regarding Emotion usage with EUI [here](https://github.com/elastic/eui/discussions/6828).

### Theming

EUI uses CSS-in-JS (specifically [Emotion](https://emotion.sh)) for its styles and theming. As such, we require an `<EuiProvider>` wrapper around your application in order for various theme-related UI & UX (such as dark/light mode switching) to work as expected.
EUI leverages [Emotion](https://emotion.sh) for its theming as well. As such, we require an `<EuiProvider>` wrapper around your application in order for various theme-related UI & UX (such as dark/light mode switching) to work as expected.

```jsx
import React from 'react';
Expand Down

0 comments on commit f39dfe4

Please sign in to comment.