Skip to content

Commit e5fe191

Browse files
committed
docs: add shadow + scroll snippet
1 parent b8ae3d1 commit e5fe191

1 file changed

Lines changed: 37 additions & 8 deletions

File tree

  • packages/website/docs/getting-started/theming/utilities/shadows

packages/website/docs/getting-started/theming/utilities/shadows/index.mdx

Lines changed: 37 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -53,14 +53,14 @@ this might result in duplicate neighboring borders. To adjust this, use the `bor
5353
import { euiShadow } from '@elastic/eui';
5454

5555
const styles = css`
56-
${euiShadow('s', { border: 'none'})}
57-
${euiShadow('s', { border: 'all'})}
58-
${euiShadow('s', { border: 'top'})}
59-
${euiShadow('s', { border: 'bottom'})}
60-
${euiShadow('s', { border: 'left'})}
61-
${euiShadow('s', { border: 'right'})}
62-
${euiShadow('s', { border: 'horizontal'})}
63-
${euiShadow('s', { border: 'vertical'})}
56+
${euiShadow(euiThemeContext, 's', { border: 'none'})}
57+
${euiShadow(euiThemeContext, 's', { border: 'all'})}
58+
${euiShadow(euiThemeContext, 's', { border: 'top'})}
59+
${euiShadow(euiThemeContext, 's', { border: 'bottom'})}
60+
${euiShadow(euiThemeContext, 's', { border: 'left'})}
61+
${euiShadow(euiThemeContext, 's', { border: 'right'})}
62+
${euiShadow(euiThemeContext, 's', { border: 'horizontal'})}
63+
${euiShadow(euiThemeContext, 's', { border: 'vertical'})}
6464
`;
6565
```
6666
</Example.Snippet>
@@ -132,6 +132,35 @@ Combining EUI shadow utils like `euiShadow()` and scroll behavior (e.g. via `ove
132132
in DARK mode to be scrolled. If you want to combine both, separate the styles onto different elements by placing the shadow util on the outer wrapper and the scroll
133133
behavior on the inner one.
134134

135+
<Example.Snippet>
136+
```ts
137+
import { euiShadow } from '@elastic/eui';
138+
import { css } from '@emotion/react';
139+
140+
const Component = () => {
141+
const euiThemeContext = useEuiTheme();
142+
143+
const shadowStyles = css`
144+
${euiShadow(euiThemeContext, 's')};
145+
`;
146+
const scrollContainerStyles = css`
147+
max-height: 100px;
148+
overflow-y: auto;
149+
/* specific scroll bar styling */
150+
${useEuiScrollBar()};
151+
`;
152+
153+
return (
154+
<div css={shadowStyles}>
155+
<div css={scrollContainerStyles}>
156+
// scrollable content
157+
</div>
158+
</div>
159+
);
160+
}
161+
```
162+
</Example.Snippet>
163+
135164
```tsx interactive
136165
import React, { useState } from 'react';
137166
import {

0 commit comments

Comments
 (0)