Elastic UI Framework (EUI)
repository·main·Indexed 27 days ago
https://github.com/elastic/euiA collection of React UI components and theme utilities used to build consistent, branded user interfaces across Elastic's web products. The repository includes the core design system, a Docusaurus preset and theme (@elastic/eui-docusaurus-preset, @elastic/eui-docusaurus-theme) for documentation, an ESLint plugin (@elastic/eslint-plugin-eui) to enforce accessibility and design tokens, and a documentation generator (@elastic/eui-docgen) for component prop tables.
What's inside elastic-eui
- The Elastic UI Framework (EUI) is a design library consisting of typed React UI components and static assets designed to build web layouts that share Elastic's branding and aesthetics. It provides reusable components that abstract away CSS, and includes theme and style utilities that can be used independently. EUI is used to maintain a single source of truth for design standards across Elastic's web products.
Overview of Elastic Charts
mainElastic Charts is a system of independent chart components designed to work cohesively within the Elastic UI (EUI) ecosystem. Rather than a simple library, it is treated as a design system where components share common rules for style, behavior, and interaction to ensure a consistent user experience across products.Use EuiDataGrid for large tabular datasets
mainEuiDataGrid is designed for displaying large amounts of tabular data. It is the preferred choice over standard EUI tables when your use case involves:
- A high number of columns.
- Uniform data types across columns.
- A need for strict schemas and sorting to facilitate data comparison.
Note that while it shares similarities with spreadsheet software, its primary strength lies in high-performance rendering rather than content creation.
Understand the difference between EUI Guidelines and Patterns
mainWhen building interfaces with EUI, distinguish between using Guidelines and Patterns to determine your implementation approach:
- Guidelines: Use these to learn how to use individual EUI components correctly. They provide usage instructions, accessibility requirements, and 'do's and don'ts' for specific components.
- Patterns: Use these when you need to solve a specific design problem or user flow. Patterns are reusable solutions that combine multiple components to address frequent design issues, providing layout, interaction, and code examples for complex user needs.
Use EuiBanner for announcements
mainEuiBanner is a full-width announcement component used to surface promotional or informational messages.
When to use EuiBanner vs EuiCallOut:
- Use EuiBanner for broad, product-level announcements (e.g., new features, promotions, or onboarding nudges).
- Use EuiCallOut for inline, contextual feedback (e.g., warnings, errors, or confirmation messages).
Use EuiSearchBar for Elasticsearch Query DSL
mainThe
EuiSearchBaris a specialized toolbar designed for creating search queries using syntax compatible with Elasticsearch's Query DSL. It supports free-text terms, phrases, field/value searches (e.g.,tag:bug), range queries (e.g.,followers>=10), booleanisclauses, andor groupclauses.Note: For generic search use cases that do not require Elasticsearch-specific syntax, use the
EuiFieldSearchcomponent instead.Understand EuiIcon code-splitting and icon loading
mainTheEuiIconcomponent uses dynamic imports to load icon assets lazily at runtime. This prevents icon SVGs from being included in your main JavaScript bundle. Instead, icons are fetched as separate chunks only when they are rendered. Note that the mapping object (which links icon names to their chunk references) is always included in your bundle whenEuiIconis used.Get started with the Elastic UI Framework
mainThe Elastic UI Framework (EUI) is a collection of React UI components designed for building user interfaces that follow the Elastic aesthetic.
To use EUI in your projects, refer to the following resources:
- Full Documentation: Visit eui.elastic.co for component examples, usage guidelines, and implementation details.
- FAQ: For common usage questions, check the EUI FAQ.
- Technical Guidelines: For detailed instructions on usage and development, refer to the EUI Wiki.
- Community Support: For general questions, use the GitHub Discussions tab.
Core concepts of EuiDataGrid
mainThe
EuiDataGridcomponent provides a high-performance way to display large datasets with several key features:- In-memory management: You can define an
inMemorylevel (e.g.,level: 'sorting') to allow the grid to automatically handle updates like sorting or filtering. Note that depending on the level, you may need to manage content order separately. - Schemas: Use schemas to tailor how specific columns are rendered or sorted. The component includes automatic detection, but custom schemas can be provided.
- Truncation & Popovers: Unlike standard tables, the data grid forces content truncation. To show more information or actions, use popovers.
- Control Columns: You can add repeatable actions, such as checkboxes or buttons, using
trailingControlColumns. - Toolbar: Provides users with ways to manipulate data display and order.
- Styling: Grid styling can be controlled by the developer and can be augmented by user preferences based on enabled features.
- In-memory management: You can define an
Access Typography theme tokens and hooks
mainEUI provides hooks and tokens for fine-grained typography control, including:
- Font weight: Access specific font weight tokens.
- Font settings: Access font settings tokens.
- Font scale hook: Use the font scale hook to manage typography scaling.
Understand Emotion and CSS-in-JS in EUI
mainEUI uses Emotion as its underlying CSS-in-JS library. This allows you to write styles directly in your JS/TS files using standard CSS syntax. EUI recommends implementing Emotion as your primary styling method for best compatibility. Styles are processed using Stylis, and EUI automatically applies vendor prefixes for evergreen browsers.Explore Elastic UI (EUI) components by topic
mainEUI provides a comprehensive library of components organized into functional categories. You can find specific components, live examples, usage guidelines, and prop definitions under the following topical sections:
- Layout: Flexbox and layout utilities.
- Containers: Components like Accordion for grouping content.
- Navigation: Elements like Breadcrumbs for site navigation.
- Display: Visual indicators like Badges.
- Forms: Layouts and elements for user input.
- Data grid: Advanced data grid components.
- Tables: Basic table structures.
- Templates: High-level structures like Page Templates.
- Editors and syntax: Specialized components for Markdown and syntax formatting.