Skip to main content
Elastic UI
Elastic UI
ComponentsPatternsContentData visualization
EUI ChangelogGitHubFigma
  • Guidelines
    • Getting started
    • Accessibility
    • Writing
    • Testing
  • Theming
    • Theme provider
    • Color mode
    • High contrast mode
    • Borders
    • Breakpoints
    • Colors
    • Sizing
    • Typography
  • Templates
    • Page template
    • Sitewide search
  • Layout
    • Accordion
    • Bottom bar
    • Flex
    • Flyout
    • Header
    • Horizontal rule
    • Modal
    • Page components
    • Page header
    • Panel
    • Popover
    • Resizable container
    • Spacer
  • Navigation
    • Breadcrumbs
    • Buttons
    • Collapsible nav
    • Context menu
    • Facet
    • Key pad menu
    • Link
    • Pagination
    • Side nav
    • Steps
    • Tabs
    • Tree view
  • Display
    • Aspect ratio
    • Avatar
    • Badge
    • Callout
    • Card
    • Comment list
    • Description list
    • Drag and drop
    • Empty prompt
    • Health
    • Icons
    • Image
    • List group
    • Loading
    • Progress
    • Skeleton
    • Stat
    • Text
    • Timeline
    • Title
    • Toast
    • Tooltip
    • Tour
  • Forms
    • Form controls
    • Form layouts
    • Form validation
    • Text controls
    • Numeric controls
    • Selection controls
    • Search and filter controls
    • Date and time controls
    • Other controls
  • Tabular content
    • Tables
    • Data grid
  • Editors & Syntax
    • Code
    • Markdown
  • Utilities
    • Accessibility
    • Auto sizer
    • Beacon
    • Color palettes
    • Copy
    • CSS utility classes
    • Delay
    • Error boundary
    • Focus trap
    • Highlight and mark
    • HTML ID generator
    • I18n
    • Inner text
    • Mutation observer
    • Outside click detector
    • Overlay mask
    • Portal
    • Pretty duration
    • Provider
    • Resize observer
    • Scroll
    • Text diff
    • Text truncation
    • Window events
  • EUI
  • Theming
  • Sizing

Sizing

Base

All sizing values, including font sizes, are calculated from a single base integer and converted to pixel or rem string values.

euiTheme.base = 16 token

This base integer sets the scale for the entire theme. You can use calculations on top of the base value, just be sure to append the px unit to the end.

padding: 32px
✄𐘗
tsx code block:
✄𐘗css` padding: ${euiTheme.base * 2}px; `

Scale

euiTheme.size[size] token

Use the named keys as as much as possible.

padding: 32px
✄𐘗
tsx code block:
✄𐘗css` padding: ${euiTheme.size.xl}; `

calc() CSS function

When doing calculations on top of the named key values, you have to use the CSS calc() function because the value that is returned is a string value with the appended unit.

padding: calc(16px * 2)
✄𐘗
tsx code block:
✄𐘗css` padding: calc(${euiTheme.size.base} * 2); `
𐘂𐘂
✄𐘗✄𐘗
Sample
↦
Token
↦
Value
↵
 size.xxs
↦
size.xxs
↦
Value
2px
↵
 size.xs
↦
size.xs
↦
Value
4px
↵
 size.s
↦
size.s
↦
Value
8px
↵
 size.m
↦
size.m
↦
Value
12px
↵
 size.base
↦
size.base
↦
Value
16px
↵
 size.l
↦
size.l
↦
Value
24px
↵
 size.xl
↦
size.xl
↦
Value
32px
↵
 size.xxl
↦
size.xxl
↦
Value
40px
↵
 size.xxxl
↦
size.xxxl
↦
Value
48px
↵
 size.xxxxl
↦
size.xxxxl
↦
Value
64px
↵
𐘂𐘂
Edit this page

Previous
Utilities
Next
Typography
  • Base
    • euiTheme.base = 16 token
  • Scale
    • euiTheme.size[size] token
    • calc() CSS function
EUI is dual-licensed under Elastic License 2.0 and Server Side Public License, v 1 | Crafted with ❤ by Elastic