diff --git a/CHANGELOG.md b/CHANGELOG.md
index 517e28617a6..b6e5c3942e3 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -4,6 +4,8 @@
- Converted `EuiFlexGrid`, `EuiFlexGroup`, `EuiFlexItem`, `EuiDescriptionList`, `EuiDescriptionListTitle`, and `EuiDescriptionListDescription` to TypeScript ([#1365](https://github.com/elastic/eui/pull/1365))
- Converted `EuiAvatar` to Typescript ([#1654](https://github.com/elastic/eui/pull/1654))
- Added missing `anchorClassName` prop to `EuiToolTip` definition ([#1657](https://github.com/elastic/eui/pull/1657))
+- Added `fullWidth` prop to `EuiButton` ([#1665](https://github.com/elastic/eui/pull/1665))
+- Added `.eui-fullWidth` utility class ([#1665](https://github.com/elastic/eui/pull/1665))
## [`9.0.1`](https://github.com/elastic/eui/tree/v9.0.1)
diff --git a/src-docs/src/views/form_layouts/inline_popover.js b/src-docs/src/views/form_layouts/inline_popover.js
index dfbcd74e5b8..d05800c57e7 100644
--- a/src-docs/src/views/form_layouts/inline_popover.js
+++ b/src-docs/src/views/form_layouts/inline_popover.js
@@ -138,6 +138,7 @@ export default class extends Component {
name="poprange"
/>
+ Save
);
diff --git a/src-docs/src/views/utility_classes/utility_classes.js b/src-docs/src/views/utility_classes/utility_classes.js
index 97906f2c283..ddbceb6ab01 100644
--- a/src-docs/src/views/utility_classes/utility_classes.js
+++ b/src-docs/src/views/utility_classes/utility_classes.js
@@ -147,6 +147,10 @@ export default () => (
.eui-displayInlineBlock
+
+
+ .eui-fullWidth (similar to eui-displayBlock but adds 100% width)
+
Responsive
.eui-hideFor--xs
diff --git a/src/components/button/__snapshots__/button.test.js.snap b/src/components/button/__snapshots__/button.test.js.snap
index 910820d5e76..df5bc9f2382 100644
--- a/src/components/button/__snapshots__/button.test.js.snap
+++ b/src/components/button/__snapshots__/button.test.js.snap
@@ -124,6 +124,21 @@ exports[`EuiButton props fill is rendered 1`] = `
`;
+exports[`EuiButton props fullWidth is rendered 1`] = `
+
+`;
+
exports[`EuiButton props href secures the rel attribute when the target is _blank 1`] = `
{
@@ -69,6 +70,7 @@ export const EuiButton = ({
className,
{
'euiButton--fill': fill,
+ 'euiButton--fullWidth': fullWidth,
},
);
@@ -162,6 +164,11 @@ EuiButton.propTypes = {
*/
color: PropTypes.oneOf(COLORS),
size: PropTypes.oneOf(SIZES),
+
+ /**
+ * Expands button to fill the width of the parent
+ */
+ fullWidth: PropTypes.bool,
isDisabled: PropTypes.bool,
href: PropTypes.string,
target: PropTypes.string,
diff --git a/src/components/button/button.test.js b/src/components/button/button.test.js
index 5fafda284ad..a13a9476275 100644
--- a/src/components/button/button.test.js
+++ b/src/components/button/button.test.js
@@ -64,6 +64,17 @@ describe('EuiButton', () => {
});
});
+ describe('fullWidth', () => {
+ it('is rendered', () => {
+ const component = render(
+
+ );
+
+ expect(component)
+ .toMatchSnapshot();
+ });
+ });
+
describe('iconType', () => {
it('is rendered', () => {
const component = render(
diff --git a/src/components/button/index.d.ts b/src/components/button/index.d.ts
index 363271ecdac..fd363d5a65d 100644
--- a/src/components/button/index.d.ts
+++ b/src/components/button/index.d.ts
@@ -34,6 +34,7 @@ declare module '@elastic/eui' {
size?: ButtonSize;
isLoading?: boolean;
isDisabled?: boolean;
+ fullWidth?: boolean;
contentProps?: HTMLAttributes;
textProps?: HTMLAttributes;
}
diff --git a/src/global_styling/utility/_utility.scss b/src/global_styling/utility/_utility.scss
index 23b0c6f38b8..2638d6b8142 100644
--- a/src/global_styling/utility/_utility.scss
+++ b/src/global_styling/utility/_utility.scss
@@ -12,6 +12,11 @@
.eui-displayInline {display: inline !important;}
.eui-displayInlineBlock {display: inline-block !important;}
+.eui-fullWidth {
+ display: block !important;
+ width: 100% !important;
+}
+
// Text
.eui-textCenter {text-align: center !important;}
.eui-textLeft {text-align: left !important;}