-
Notifications
You must be signed in to change notification settings - Fork 861
feat(website): add Utilities > CSS Utility Classes page #8370
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
Merged
weronikaolejniczak
merged 3 commits into
elastic:main
from
weronikaolejniczak:feat/eui-plus-utility-classes
Mar 5, 2025
Merged
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
186 changes: 186 additions & 0 deletions
186
packages/website/docs/components/utilities/css_utility_classes.mdx
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,186 @@ | ||
| --- | ||
| slug: /utilities/css-utility-classes | ||
| id: utilities_css_utility_classes | ||
| --- | ||
|
|
||
| import { Example } from '@site/src/components'; | ||
| import { css } from '@emotion/react'; | ||
|
|
||
| import { EuiIcon, EuiMark } from '@elastic/eui'; | ||
|
|
||
| # CSS utility classes | ||
|
|
||
| The following CSS-only classes are provided as helper utilities. They are useful for making micro-adjustments to existing React components. | ||
|
|
||
| :::info Scroll utilities have moved | ||
|
|
||
| For overflow and scrolling specific utilities, go to [the Scroll documentation page](./scroll/overview.mdx). | ||
| ::: | ||
|
|
||
| :::info Text utilities have moved | ||
|
|
||
| For text and typography specific utilities, go to [the Text documentation page](../theming/typography.mdx). | ||
| ::: | ||
|
|
||
| :::info Responsive utilities have moved | ||
|
|
||
| For responsive specific utilities, go to [the Breakpoint utilities page](../theming/breakpoints.mdx). | ||
| ::: | ||
|
|
||
| ## Display | ||
|
|
||
| <Example> | ||
| <Example.Description> | ||
| ### `eui-displayBlock` <Badge color="hollow">className</Badge> | ||
|
|
||
| Changes the element's display property to `display: block;` | ||
| </Example.Description> | ||
| <Example.Preview> | ||
| <EuiMark css={css`background: 'rgba(254, 228, 181, 0.25)';`} className="eui-displayBlock">Displaying block</EuiMark> | ||
mgadewoll marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| </Example.Preview> | ||
| <Example.Snippet> | ||
| ```tsx | ||
| <span className="eui-displayBlock"> | ||
| /* Your content */ | ||
| </span> | ||
| ``` | ||
| </Example.Snippet> | ||
| </Example> | ||
| <Example> | ||
| <Example.Description> | ||
| ### `eui-displayInline` <Badge color="hollow">className</Badge> | ||
|
|
||
| Changes the element's display property to `display: inline;` | ||
| </Example.Description> | ||
| <Example.Preview> | ||
| <EuiMark css={css`background: 'rgba(254, 228, 181, 0.25)';`} className="eui-displayInline">Displaying inline</EuiMark> | ||
| </Example.Preview> | ||
| <Example.Snippet> | ||
| ```tsx | ||
| <div className="eui-displayInline"> | ||
| /* Your content */ | ||
| </div> | ||
| ``` | ||
| </Example.Snippet> | ||
| </Example> | ||
| <Example> | ||
| <Example.Description> | ||
| ### `eui-displayInlineBlock` <Badge color="hollow">className</Badge> | ||
|
|
||
| Changes the element's display property to `display: inline-block;` | ||
| </Example.Description> | ||
| <Example.Preview> | ||
| <EuiMark css={css`background: 'rgba(254, 228, 181, 0.25)';`}className="eui-displayInlineBlock">Displaying inline block</EuiMark> | ||
| </Example.Preview> | ||
| <Example.Snippet> | ||
| ```tsx | ||
| <span className="eui-displayInlineBlock"> | ||
| /* Your content */ | ||
| </span> | ||
| ``` | ||
| </Example.Snippet> | ||
| </Example> | ||
| <Example> | ||
| <Example.Description> | ||
| ### `eui-fullWidth` <Badge color="hollow">className</Badge> | ||
|
|
||
| Changes the element's display property to `display: inline-block;` and adds `width: 100%;` | ||
| </Example.Description> | ||
| <Example.Preview> | ||
| <EuiMark css={css`background: 'rgba(254, 228, 181, 0.25)';`} className="eui-fullWidth">Displaying full width</EuiMark> | ||
| </Example.Preview> | ||
| <Example.Snippet> | ||
| ```tsx | ||
| <span className="eui-fullWidth"> | ||
| /* Your content */ | ||
| </span> | ||
| ``` | ||
| </Example.Snippet> | ||
| </Example> | ||
|
|
||
| ## Vertical alignment | ||
|
|
||
| <Example> | ||
| <Example.Description> | ||
| ### `eui-alignTop` <Badge color="hollow">className</Badge> | ||
|
|
||
| Changes the element's vertical alignment property to `vertical-align: top;` | ||
| </Example.Description> | ||
| <Example.Preview> | ||
| <p> | ||
| <EuiIcon | ||
| type="logoElasticStack" | ||
| size="xxl" | ||
| className="eui-alignTop" | ||
| /> Icon is aligned to the top of the text | ||
| </p> | ||
| </Example.Preview> | ||
| <Example.Snippet> | ||
| ```tsx | ||
| <EuiIcon className="eui-alignTop" type="logoElasticStack" /> | ||
| ``` | ||
| </Example.Snippet> | ||
| </Example> | ||
| <Example> | ||
| <Example.Description> | ||
| ### `eui-alignMiddle` <Badge color="hollow">className</Badge> | ||
|
|
||
| Changes the element's vertical alignment property to `vertical-align: middle;` | ||
| </Example.Description> | ||
| <Example.Preview> | ||
| <p> | ||
| <EuiIcon | ||
| type="logoElasticStack" | ||
| size="xxl" | ||
| className="eui-alignMiddle" | ||
| /> Icon is aligned to the middle of the text | ||
| </p> | ||
| </Example.Preview> | ||
| <Example.Snippet> | ||
| ```tsx | ||
| <EuiIcon className="eui-alignMiddle" type="logoElasticStack" /> | ||
| ``` | ||
| </Example.Snippet> | ||
| </Example> | ||
| <Example> | ||
| <Example.Description> | ||
| ### `eui-alignBottom` <Badge color="hollow">className</Badge> | ||
|
|
||
| Changes the element's vertical alignment property to `vertical-align: bottom;` | ||
| </Example.Description> | ||
| <Example.Preview> | ||
| <p> | ||
| <EuiIcon | ||
| type="logoElasticStack" | ||
| size="xxl" | ||
| className="eui-alignBottom" | ||
| /> Icon is aligned to the bottom of the text | ||
| </p> | ||
| </Example.Preview> | ||
| <Example.Snippet> | ||
| ```tsx | ||
| <EuiIcon className="eui-alignBottom" type="logoElasticStack" /> | ||
| ``` | ||
| </Example.Snippet> | ||
| </Example> | ||
| <Example> | ||
| <Example.Description> | ||
| ### `eui-alignBaseline` <Badge color="hollow">className</Badge> | ||
|
|
||
| Changes the element's vertical alignment property to `vertical-align: baseline;` | ||
| </Example.Description> | ||
| <Example.Preview> | ||
| <p> | ||
| <EuiIcon | ||
| type="logoElasticStack" | ||
| size="xxl" | ||
| className="eui-alignBaseline" | ||
| /> Icon is aligned to the baseline of the text | ||
| </p> | ||
| </Example.Preview> | ||
| <Example.Snippet> | ||
| ```tsx | ||
| <EuiIcon className="eui-alignBaseline" type="logoElasticStack" /> | ||
| ``` | ||
| </Example.Snippet> | ||
| </Example> | ||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.