Data grid styling

Styling can be passed down to the grid through the gridStyle prop. It accepts an object that allows for customization.

The toolbarVisibility prop when used as a boolean controls the visibility of the toolbar displayed above the grid. Using the prop as a shape, allows setting the visibility of the individual buttons within.

With the default settings, the showStyleSelector setting in toolbarVisibility means the user has the ability to override the padding and font size passed into gridStyle by the engineer.

<EuiDataGrid
  {...usualProps}
  // This can work as a shape.
  toolbarVisibility={{
    showColumnSelector: false
    showStyleSelector: false
    showSortSelector: false
    showFullScreenSelector: false
  }}
  // Or as a boolean to turn everything off.
  toolbarVisibility={false}
  // Change the initial style of the grid.
  gridStyle={{
    border: 'all',
    stripes: true,
    rowHover: 'highlight',
    header: 'shade',
    // If showStyleSelector={true} from toolbarVisibility, these last two will be superceded by what the user decides.
    fontSize: 'm',
    cellPadding: 'm',
  }}
/>
avatar
name
email
city
country
account

Row: 1, Column: 1:

Row: 1, Column: 2:

Barrows, Lukas III

Row: 1, Column: 3:

Quinn.Lind@yahoo.com

Row: 1, Column: 4:

Rethatown

Row: 1, Column: 5:

Svalbard & Jan Mayen Islands

Row: 1, Column: 6:

66996153

Row: 2, Column: 1:

Row: 2, Column: 2:

Mertz, Gregg II

Row: 2, Column: 3:

Terrence.Thompson@yahoo.com

Row: 2, Column: 4:

Lake Frankie

Row: 2, Column: 5:

Trinidad and Tobago

Row: 2, Column: 6:

85900503

Row: 3, Column: 1:

Row: 3, Column: 2:

Ruecker, Fiona IV

Row: 3, Column: 3:

Lila.Wiegand@gmail.com

Row: 3, Column: 4:

West Amiyaside

Row: 3, Column: 5:

Taiwan

Row: 3, Column: 6:

97429361

Row: 4, Column: 1:

Row: 4, Column: 2:

Emmerich, Alek PhD

Row: 4, Column: 3:

Glenda.Haley54@gmail.com

Row: 4, Column: 4:

Alethamouth

Row: 4, Column: 5:

Guam

Row: 4, Column: 6:

72413756

Data grid adapts to its container

When wrapped inside a container, like a dashboard panel, the grid will start hiding controls and adopt a more strict flex layout

name
email
city
country
account

Row: 1, Column: 1:

Hudson, Macie Jr.

Row: 1, Column: 2:

Maxwell.Schaden@hotmail.com

Row: 1, Column: 3:

Row: 1, Column: 4:

Denmark

Row: 1, Column: 5:

26322618

Row: 2, Column: 1:

Hermiston, Emelie DVM

Row: 2, Column: 2:

Sidney_Mraz56@hotmail.com

Row: 2, Column: 3:

Row: 2, Column: 4:

Liberia

Row: 2, Column: 5:

02643869

Row: 3, Column: 1:

Rowe, Antonietta V

Row: 3, Column: 2:

Jaiden.Carroll@hotmail.com

Row: 3, Column: 3:

Row: 3, Column: 4:

Sudan

Row: 3, Column: 5:

96039291

Row: 4, Column: 1:

Schumm, Lucious DVM

Row: 4, Column: 2:

Karlee_Beatty@yahoo.com

Row: 4, Column: 3:

Row: 4, Column: 4:

Myanmar

Row: 4, Column: 5:

69159469

Row: 5, Column: 1:

Jerde, Itzel DDS

Row: 5, Column: 2:

Crawford57@hotmail.com

Row: 5, Column: 3:

Row: 5, Column: 4:

Serbia

Row: 5, Column: 5:

10914651

Row: 6, Column: 1:

Reynolds, Myrl V

Row: 6, Column: 2:

Coby11@gmail.com

Row: 6, Column: 3:

Row: 6, Column: 4:

Turkmenistan

Row: 6, Column: 5:

61414674

Row: 7, Column: 1:

Okuneva, Edward PhD

Row: 7, Column: 2:

Heber_Brown@yahoo.com

Row: 7, Column: 3:

Row: 7, Column: 4:

Haiti

Row: 7, Column: 5:

28962077

Row: 8, Column: 1:

Leffler, Maude V

Row: 8, Column: 2:

Boyd_Jast@gmail.com

Row: 8, Column: 3:

Row: 8, Column: 4:

Belarus

Row: 8, Column: 5:

58681775

Row: 9, Column: 1:

Hills, Carli II

Row: 9, Column: 2:

Elmo53@yahoo.com

Row: 9, Column: 3:

Row: 9, Column: 4:

Cook Islands

Row: 9, Column: 5:

43715376

Row: 10, Column: 1:

Reinger, Octavia PhD

Row: 10, Column: 2:

Efrain.Simonis@hotmail.com

Row: 10, Column: 3:

Row: 10, Column: 4:

American Samoa

Row: 10, Column: 5:

82424902