Expression
Use the EuiExpression component to surface expressions. It requires both a description (left side) and value (right side). Optionally, you can pass it an onClick function that will convert it to a button and add some additional styling to indicate that it is clickable.
Colors
You can pass a color prop but it will only color the description.
Stringing a bunch together
If the expression is more than one description and value, you can string multiple expressions together and they should inline together and wrap at logical points.
Column display
There might be cases where displaying multiple EuiExpressions in a paragraph is not ideal. For example, when both the description and the value are variable or when their text is quite long. To use a column display instead, pass display="columns".
In column display, each expression is its own line and the description column is aligned to the right. The default width for the description is 20%, but you can customize this with thedescriptionWidth prop. When displaying a group of EuiExpressions, make sure to set the same width for all descriptions.
Invalid state
Set isInvalid to true to display EuiExpression's error state. This state will override the color prop with danger.
Truncate text
To truncate EuiExpression's content, pass textWrap="truncate". Text truncation only works properly if the prop types of description and value are strings. If you're using nodes, use the .eui-textTruncate utility class on all their sub-children.
Props
EuiExpression
Prop | Description and type | Default value |
|---|---|---|
Prop description# | Description and type First part of the expression ReactNode | Default value Required |
Prop className# | Description and type Type: string | Default value |
Prop aria-label# | Description and type Defines a string value that labels the current element. string | Default value |
Prop data-test-subj# | Description and type Type: string | Default value |
Prop css# | Description and type Type: Interpolation<Theme> | Default value |
Prop descriptionProps# | Description and type Type: CommonProps & HTMLAttributes<HTMLSpanElement> | Default value |
Prop value# | Description and type Second part of the expression ReactNode | Default value |
Prop valueProps# |