Skip to main content
Elastic UI
Elastic UI
Getting startedComponentsPatternsContentData visualization
EUI ChangelogGitHubFigma
  • Overview
  • Layout
  • Containers
  • Navigation
  • Display
  • Forms
    • Form controls
    • Form layouts
    • Form validation
    • Text controls
    • Numeric controls
    • Selection controls
    • Search and filter controls
      • Search bar
      • Filter group
      • Expression
    • Date and time controls
    • Other controls
  • Tabular content
  • Templates
  • Editors and syntax
  • EUI
  • Forms
  • Search and filter controls
  • Expression

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.

Loading...

Colors

You can pass a color prop but it will only color the description.

Loading...

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.

Loading...

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.

Loading...

Invalid state

Set isInvalid to true to display EuiExpression's error state. This state will override the color prop with danger.

Loading...

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.

Loading...

Props

EuiExpression

Extends ButtonHTMLAttributes
𐘂𐘂
✄𐘗✄𐘗
Prop
↦
Description and type
↦
Default value
↵
Prop
description#
↦
Description and type

First part of the expression

Type: 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.
@see aria-labelledby.

Type: 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

Type: ReactNode
↦
Default value
↵
Prop
valueProps#
↦
Description and type
Type: CommonProps & HTMLAttributes<HTMLSpanElement>
↦
Default value
↵
Prop
color#
↦
Description and type

Color of the description

Type: "primary" | "accent" | "success" | "warning" | "danger" | "subdued"
↦
Default value
success
↵
Prop
uppercase#
↦
Description and type

Should the description auto-uppercase?

Type: boolean
↦
Default value
true
↵
Prop
isActive#
↦
Description and type

Adds an solid border at the bottom

Type: boolean
↦
Default value
false
↵
Prop
onClick#
↦
Description and type

Turns the component into a button and adds an editable style border at the bottom

Type: MouseEventHandler<HTMLButtonElement> | (MouseEventHandler<HTMLButtonElement> & MouseEventHandler<HTMLSpanElement>)
↦
Default value
↵
Prop
display#
↦
Description and type

Sets the display style for the expression. Defaults to inline

Type: "inline" | "columns"
↦
Default value
inline
↵
Prop
isInvalid#
↦
Description and type

Forces color to display as danger and shows an error icon

Type: boolean
↦
Default value
false
↵
Prop
descriptionWidth#
↦
Description and type

Sets a custom width for the description when using the columns layout.
Set to a number for a custom width in px.
Set to a string for a custom width in custom measurement.
Defaults to 20%

Type: string | number
↦
Default value
20%
↵
Prop
textWrap#
↦
Description and type

Sets how to handle the wrapping of long text.

Type: "break-word" | "truncate"
↦
Default value
break-word
↵
𐘂𐘂
Edit this page

Previous
Filter group
Next
Date picker
  • Colors
  • Stringing a bunch together
  • Column display
  • Invalid state
  • Truncate text
  • Props
EUI is dual-licensed under Elastic License 2.0 and Server Side Public License, v 1 | Crafted with ❤ by Elastic