Skip to content

Commit

Permalink
Add documentation snippet example
Browse files Browse the repository at this point in the history
NOTE: I did not update the actual example, since that uses EuiText which overrides line-height, and is no longer a good example to demo lineHeight with
  • Loading branch information
cee-chen committed Sep 28, 2021
1 parent 7ab940d commit 79e3daf
Showing 1 changed file with 7 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,9 @@ const rowHeightsSnippet = `rowHeightsOptions = {
4: 200, // for row which have index 4 we set 140 pixel
5: 80,
},
lineHeight: '1em', // default every cell line-height to 1em
// NOTE: if you wrap your cell content in CSS that overrides/sets line-height (e.g. in an EuiText),
// EuiDataGrid will not calculate row height correctly - make sure to match this to your used line height
}`;

const rowHeightsFullSnippet = `const rowHeightsOptions = useMemo(
Expand Down Expand Up @@ -122,6 +125,10 @@ export const DataGridRowHeightOptionsExample = {
<EuiCode>rowHeights</EuiCode> - overrides the height for a specific
row
</li>
<li>
<EuiCode>lineHeight</EuiCode> - set a default line height for all
cells, which is also used to calculate row height
</li>
</ul>
<p>
Each of these can be configured with an exact pixel height, a line
Expand Down

0 comments on commit 79e3daf

Please sign in to comment.