diff --git a/packages/react-core/src/components/Button/examples/Button.md b/packages/react-core/src/components/Button/examples/Button.md
index 337b7b04914..07463ecab26 100644
--- a/packages/react-core/src/components/Button/examples/Button.md
+++ b/packages/react-core/src/components/Button/examples/Button.md
@@ -17,350 +17,65 @@ import { Link } from '@reach/router';
### Variations
-```js
-import React from 'react';
-import { Button } from '@patternfly/react-core';
-import TimesIcon from '@patternfly/react-icons/dist/esm/icons/times-icon';
-import PlusCircleIcon from '@patternfly/react-icons/dist/esm/icons/plus-circle-icon';
-import ExternalLinkSquareAltIcon from '@patternfly/react-icons/dist/esm/icons/external-link-square-alt-icon';
-import CopyIcon from '@patternfly/react-icons/dist/esm/icons/copy-icon';
-
-
- Primary {' '}
- Secondary {' '}
-
- Danger Secondary
- {' '}
- Tertiary {' '}
- Danger {' '}
- Warning
-
-
- }>
- Link
- {' '}
- } iconPosition="right">
- Link
- {' '}
-
- Inline link
- {' '}
-
- Danger link
-
-
-
-
-
-
-
-
- Control {' '}
-
-
-
- ;
+```ts file="./ButtonVariations.tsx"
```
### Disabled
-```js
-import React from 'react';
-import { Button } from '@patternfly/react-core';
-import TimesIcon from '@patternfly/react-icons/dist/esm/icons/times-icon';
-import PlusCircleIcon from '@patternfly/react-icons/dist/esm/icons/plus-circle-icon';
-
-
- Primary disabled {' '}
- Secondary disabled {' '}
-
- Danger secondary disabled
- {' '}
-
- Tertiary disabled
- {' '}
-
- Danger disabled
- {' '}
-
- Warning disabled
-
-
-
- }>
- Link disabled
- {' '}
-
- Inline link disabled
- {' '}
-
- Danger link disabled
- {' '}
-
-
- {' '}
-
- Control disabled
-
- ;
+```ts file="./ButtonDisabled.tsx"
```
### Aria disabled
-```js
-import React from 'react';
-import { Button } from '@patternfly/react-core';
-import TimesIcon from '@patternfly/react-icons/dist/esm/icons/times-icon';
-import PlusCircleIcon from '@patternfly/react-icons/dist/esm/icons/plus-circle-icon';
-
-
- Primary aria disabled {' '}
- Secondary aria disabled {' '}
-
- Danger secondary aria disabled
- {' '}
-
- Tertiary aria disabled
- {' '}
-
- Danger disabled
- {' '}
-
- Warning disabled
-
-
-
- }>
- Link aria disabled
- {' '}
-
- Inline link aria disabled
- {' '}
-
- Danger link disabled
- {' '}
-
-
- {' '}
-
- Control aria disabled
-
- ;
+```ts file="./ButtonAriaDisabled.tsx"
```
### Aria disabled button with tooltip
-```js
-import React from 'react';
-import { Button, Tooltip } from '@patternfly/react-core';
-
-
-
- Secondary button to core docs
-
- ;
+```ts file="./ButtonAriaDisabledTooltip.tsx"
```
### Aria disabled link as button with tooltip
-```js
-import React from 'react';
-import { Button, Tooltip } from '@patternfly/react-core';
-
-
-
- Tertiary link as button to core docs
-
- ;
+```ts file="./ButtonAriaDisabledLinkTooltip.tsx"
```
### Links as buttons
-```js
-import React from 'react';
-import { Button } from '@patternfly/react-core';
-
-
-
- Link to core docs
- {' '}
-
- Secondary link to core docs
- {' '}
-
- Tertiary link to core docs
- {' '}
-
- Jump to modifiers in contribution guidelines
-
- ;
+```ts file="./ButtonLinks.tsx"
```
### Inline link as span
-```js
-import React from 'react';
-import { Button } from '@patternfly/react-core';
-
-InlineLinkAsSpan = () => {
- const handleKeydown = evt => {
- const { keyCode } = evt;
- const isEnterOrSpaceKey = keyCode === 13 || keyCode === 32;
-
- if (isEnterOrSpaceKey) {
- evt.preventDefault();
- alert(`${keyCode === 13 ? 'Enter' : 'Space'} key default behavior stopped by onKeyDown`);
- }
- };
-
- return (
- <>
-
- Lorem ipsum dolor sit amet, consectetur adipiscing elit.
-
- This is long button text that needs to be a span so that it will wrap inline with the text around it.
- Sed hendrerit nisi in cursus maximus. Ut malesuada nisi turpis, in condimentum velit elementum non.
-
-
-
-
-
- Note that using a span as a button does not fire the onclick event for Enter or Space keys.
-
- An onKeyDown event listener is needed for Enter and Space key presses to prevent their default behavior
- and trigger your code.
- Pressing the Enter or Space keys on the inline link as span above demonstrates this by triggering an alert.
-
- >
- );
-};
+```ts file="./ButtonInlineSpanLink.tsx"
```
### Block level
-```js
-import React from 'react';
-import { Button } from '@patternfly/react-core';
-
-Block level button ;
+```ts file="./ButtonBlock.tsx"
```
### Types
-```js
-import React from 'react';
-import { Button } from '@patternfly/react-core';
-
-
- Submit Reset Default
- ;
+```ts file="./ButtonTypes.tsx"
```
### Small
-```js
-import React from 'react';
-import { Button } from '@patternfly/react-core';
-
-
-
- Primary
- {' '}
-
- Secondary
- {' '}
-
- Tertiary
- {' '}
-
- Danger
- {' '}
-
- Warning
-
-
-
- ;
+```ts file="./ButtonSmall.tsx"
```
### Call to action
-```js
-import React from 'react';
-import { Button } from '@patternfly/react-core';
-import ArrowRightIcon from '@patternfly/react-icons/dist/esm/icons/arrow-right-icon';
-
-
-
- Call to action
- {' '}
-
- Call to action
- {' '}
-
- Call to action
- {' '}
-
- Call to action
-
-
-
- ;
+```ts file="./ButtonCallToAction.tsx"
```
### Progress
-```js
-import React from 'react';
-import { Button } from '@patternfly/react-core';
-
-ButtonProgressVariants = () => {
- const [isPrimaryLoading, setIsPrimaryLoading] = React.useState(true);
- const [isSecondaryLoading, setIsSecondaryLoading] = React.useState(true);
- const extraPrimaryProps = {};
- if (isPrimaryLoading) {
- extraPrimaryProps.spinnerAriaValueText = 'Loading';
- }
- const extraSecondaryProps = {};
- if (isSecondaryLoading) {
- extraSecondaryProps.spinnerAriaValueText = 'Loading';
- }
-
- return (
-
- setIsPrimaryLoading(!isPrimaryLoading)}
- {...extraPrimaryProps}
- >
- {isPrimaryLoading ? 'Click to stop loading' : 'Click to start loading'}
- {' '}
- setIsSecondaryLoading(!isSecondaryLoading)}
- {...extraSecondaryProps}
- >
- {isSecondaryLoading ? 'Click to stop loading' : 'Click to start loading'}
-
-
-
-
- );
-};
+```ts file="./ButtonProgress.tsx"
```
### Router link
-```js
-import React from 'react';
-import { Button } from '@patternfly/react-core';
-import { Link } from '@reach/router';
- }>
- Router link
-
+```ts file="./ButtonRouterLink.tsx"
```
-
diff --git a/packages/react-core/src/components/Button/examples/ButtonAriaDisabled.tsx b/packages/react-core/src/components/Button/examples/ButtonAriaDisabled.tsx
new file mode 100644
index 00000000000..43bce4e68f8
--- /dev/null
+++ b/packages/react-core/src/components/Button/examples/ButtonAriaDisabled.tsx
@@ -0,0 +1,43 @@
+import React from 'react';
+import { Button, Flex } from '@patternfly/react-core';
+import TimesIcon from '@patternfly/react-icons/dist/esm/icons/times-icon';
+import PlusCircleIcon from '@patternfly/react-icons/dist/esm/icons/plus-circle-icon';
+
+export const ButtonAriaDisabled: React.FunctionComponent = () => (
+
+
+ Primary aria disabled
+ Secondary aria disabled
+
+ Danger secondary aria disabled
+
+
+ Tertiary aria disabled
+
+
+ Danger disabled
+
+
+ Warning disabled
+
+
+
+
+ }>
+ Link aria disabled
+
+
+ Inline link aria disabled
+
+
+ Danger link disabled
+
+
+
+
+
+ Control aria disabled
+
+
+
+);
diff --git a/packages/react-core/src/components/Button/examples/ButtonAriaDisabledLinkTooltip.tsx b/packages/react-core/src/components/Button/examples/ButtonAriaDisabledLinkTooltip.tsx
new file mode 100644
index 00000000000..68acdfe15ec
--- /dev/null
+++ b/packages/react-core/src/components/Button/examples/ButtonAriaDisabledLinkTooltip.tsx
@@ -0,0 +1,10 @@
+import React from 'react';
+import { Button, Tooltip } from '@patternfly/react-core';
+
+export const ButtonAriaDisabledLinkTooltip: React.FunctionComponent = () => (
+
+
+ Tertiary link as button to core docs
+
+
+);
diff --git a/packages/react-core/src/components/Button/examples/ButtonAriaDisabledTooltip.tsx b/packages/react-core/src/components/Button/examples/ButtonAriaDisabledTooltip.tsx
new file mode 100644
index 00000000000..24c35bb1965
--- /dev/null
+++ b/packages/react-core/src/components/Button/examples/ButtonAriaDisabledTooltip.tsx
@@ -0,0 +1,10 @@
+import React from 'react';
+import { Button, Tooltip } from '@patternfly/react-core';
+
+export const ButtonAriaDisabledTooltip: React.FunctionComponent = () => (
+
+
+ Secondary button to core docs
+
+
+);
diff --git a/packages/react-core/src/components/Button/examples/ButtonBlock.tsx b/packages/react-core/src/components/Button/examples/ButtonBlock.tsx
new file mode 100644
index 00000000000..69d484378df
--- /dev/null
+++ b/packages/react-core/src/components/Button/examples/ButtonBlock.tsx
@@ -0,0 +1,4 @@
+import React from 'react';
+import { Button } from '@patternfly/react-core';
+
+export const ButtonBlock: React.FunctionComponent = () => Block level button ;
diff --git a/packages/react-core/src/components/Button/examples/ButtonCallToAction.tsx b/packages/react-core/src/components/Button/examples/ButtonCallToAction.tsx
new file mode 100644
index 00000000000..efdf1ffcd35
--- /dev/null
+++ b/packages/react-core/src/components/Button/examples/ButtonCallToAction.tsx
@@ -0,0 +1,20 @@
+import React from 'react';
+import { Button, Flex } from '@patternfly/react-core';
+import ArrowRightIcon from '@patternfly/react-icons/dist/esm/icons/arrow-right-icon';
+
+export const ButtonCallToAction: React.FunctionComponent = () => (
+
+
+ Call to action
+
+
+ Call to action
+
+
+ Call to action
+
+
+ Call to action
+
+
+);
diff --git a/packages/react-core/src/components/Button/examples/ButtonDisabled.tsx b/packages/react-core/src/components/Button/examples/ButtonDisabled.tsx
new file mode 100644
index 00000000000..b9d421240c1
--- /dev/null
+++ b/packages/react-core/src/components/Button/examples/ButtonDisabled.tsx
@@ -0,0 +1,43 @@
+import React from 'react';
+import { Button, Flex } from '@patternfly/react-core';
+import TimesIcon from '@patternfly/react-icons/dist/esm/icons/times-icon';
+import PlusCircleIcon from '@patternfly/react-icons/dist/esm/icons/plus-circle-icon';
+
+export const ButtonDisabled: React.FunctionComponent = () => (
+
+
+ Primary disabled
+ Secondary disabled
+
+ Danger secondary disabled
+
+
+ Tertiary disabled
+
+
+ Danger disabled
+
+
+ Warning disabled
+
+
+
+
+ }>
+ Link disabled
+
+
+ Inline link disabled
+
+
+ Danger link disabled
+
+
+
+
+
+ Control disabled
+
+
+
+);
diff --git a/packages/react-core/src/components/Button/examples/ButtonInlineSpanLink.tsx b/packages/react-core/src/components/Button/examples/ButtonInlineSpanLink.tsx
new file mode 100644
index 00000000000..25ac07115bc
--- /dev/null
+++ b/packages/react-core/src/components/Button/examples/ButtonInlineSpanLink.tsx
@@ -0,0 +1,36 @@
+import React from 'react';
+import { Button } from '@patternfly/react-core';
+
+const handleKeydown = (event: React.KeyboardEvent) => {
+ const { key } = event;
+ const isEnterKey: boolean = key === 'Enter';
+ const isEnterOrSpaceKey: boolean = isEnterKey || key === 'Space';
+
+ if (isEnterOrSpaceKey) {
+ event.preventDefault();
+ alert(`${isEnterKey ? 'Enter' : 'Space'} key default behavior stopped by onKeyDown`);
+ }
+};
+
+export const ButtonInlineSpanLink: React.FunctionComponent = () => (
+ <>
+
+ Lorem ipsum dolor sit amet, consectetur adipiscing elit.
+
+ This is long button text that needs to be a span so that it will wrap inline with the text around it.
+
+ Sed hendrerit nisi in cursus maximus. Ut malesuada nisi turpis, in condimentum velit elementum non.
+
+
+
+
+
+ Note that using a span as a button does not fire the onclick event for Enter or Space keys.
+
+ An onKeyDown event listener is needed for Enter and Space key presses to prevent their default behavior
+ and trigger your code.
+
+ Pressing the Enter or Space keys on the inline link as span above demonstrates this by triggering an alert.
+
+ >
+);
diff --git a/packages/react-core/src/components/Button/examples/ButtonLinks.tsx b/packages/react-core/src/components/Button/examples/ButtonLinks.tsx
new file mode 100644
index 00000000000..c6f7334e31f
--- /dev/null
+++ b/packages/react-core/src/components/Button/examples/ButtonLinks.tsx
@@ -0,0 +1,19 @@
+import React from 'react';
+import { Button, Flex } from '@patternfly/react-core';
+
+export const ButtonLinks: React.FunctionComponent = () => (
+
+
+ Link to core docs
+
+
+ Secondary link to core docs
+
+
+ Tertiary link to core docs
+
+
+ Jump to modifiers in contribution guidelines
+
+
+);
diff --git a/packages/react-core/src/components/Button/examples/ButtonProgress.tsx b/packages/react-core/src/components/Button/examples/ButtonProgress.tsx
new file mode 100644
index 00000000000..a0243494431
--- /dev/null
+++ b/packages/react-core/src/components/Button/examples/ButtonProgress.tsx
@@ -0,0 +1,29 @@
+import React from 'react';
+import { Button, Flex } from '@patternfly/react-core';
+
+export const ButtonProgress: React.FunctionComponent = () => {
+ const [isPrimaryLoading, setIsPrimaryLoading] = React.useState(true);
+ const [isSecondaryLoading, setIsSecondaryLoading] = React.useState(true);
+
+ return (
+
+ setIsPrimaryLoading(!isPrimaryLoading)}
+ {...(isPrimaryLoading && { spinnerAriaValueText: 'Loading' })}
+ >
+ {isPrimaryLoading ? 'Click to stop loading' : 'Click to start loading'}
+
+
+ setIsSecondaryLoading(!isSecondaryLoading)}
+ {...(isSecondaryLoading && { spinnerAriaValueText: 'Loading' })}
+ >
+ {isSecondaryLoading ? 'Click to stop loading' : 'Click to start loading'}
+
+
+ );
+};
diff --git a/packages/react-core/src/components/Button/examples/ButtonRouterLink.tsx b/packages/react-core/src/components/Button/examples/ButtonRouterLink.tsx
new file mode 100644
index 00000000000..20f4246de17
--- /dev/null
+++ b/packages/react-core/src/components/Button/examples/ButtonRouterLink.tsx
@@ -0,0 +1,9 @@
+import React from 'react';
+import { Button } from '@patternfly/react-core';
+import { Link } from '@reach/router';
+
+export const ButtonRouterLink: React.FunctionComponent = () => (
+ }>
+ Router link
+
+);
diff --git a/packages/react-core/src/components/Button/examples/ButtonSmall.tsx b/packages/react-core/src/components/Button/examples/ButtonSmall.tsx
new file mode 100644
index 00000000000..26e21960fe5
--- /dev/null
+++ b/packages/react-core/src/components/Button/examples/ButtonSmall.tsx
@@ -0,0 +1,22 @@
+import React from 'react';
+import { Button, Flex } from '@patternfly/react-core';
+
+export const ButtonSmall: React.FunctionComponent = () => (
+
+
+ Primary
+
+
+ Secondary
+
+
+ Tertiary
+
+
+ Danger
+
+
+ Warning
+
+
+);
diff --git a/packages/react-core/src/components/Button/examples/ButtonTypes.tsx b/packages/react-core/src/components/Button/examples/ButtonTypes.tsx
new file mode 100644
index 00000000000..51cb5ae3f9d
--- /dev/null
+++ b/packages/react-core/src/components/Button/examples/ButtonTypes.tsx
@@ -0,0 +1,10 @@
+import React from 'react';
+import { Button, Flex } from '@patternfly/react-core';
+
+export const ButtonTypes: React.FunctionComponent = () => (
+
+ Submit
+ Reset
+ Default
+
+);
diff --git a/packages/react-core/src/components/Button/examples/ButtonVariations.tsx b/packages/react-core/src/components/Button/examples/ButtonVariations.tsx
new file mode 100644
index 00000000000..2bcba2abca3
--- /dev/null
+++ b/packages/react-core/src/components/Button/examples/ButtonVariations.tsx
@@ -0,0 +1,47 @@
+import React from 'react';
+import { Button, Flex } from '@patternfly/react-core';
+import TimesIcon from '@patternfly/react-icons/dist/esm/icons/times-icon';
+import PlusCircleIcon from '@patternfly/react-icons/dist/esm/icons/plus-circle-icon';
+import ExternalLinkSquareAltIcon from '@patternfly/react-icons/dist/esm/icons/external-link-square-alt-icon';
+import CopyIcon from '@patternfly/react-icons/dist/esm/icons/copy-icon';
+
+export const ButtonVariations: React.FunctionComponent = () => (
+
+
+ Primary
+ Secondary
+
+ Danger Secondary
+
+ Tertiary
+ Danger
+ Warning
+
+
+
+ }>
+ Link
+
+ } iconPosition="right">
+ Link
+
+
+ Inline link
+
+
+ Danger link
+
+
+
+
+
+
+
+
+ Control
+
+
+
+
+
+);