Skip to content

Commit ca6946a

Browse files
committed
docs: add usage notes for ExternalLinkButton
1 parent 3834310 commit ca6946a

File tree

4 files changed

+75
-0
lines changed

4 files changed

+75
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
---
2+
section: Component groups
3+
subsection: Controls
4+
id: External link button
5+
source: react
6+
propComponents: ['ExternalLinkButton']
7+
sourceLink: https://github.com/patternfly/react-component-groups/blob/main/packages/module/patternfly-docs/content/extensions/component-groups/examples/ExternalLinkButton/ExternalLinkButton.md
8+
---
9+
10+
import ExternalLinkButton from "@patternfly/react-component-groups/dist/dynamic/ExternalLinkButton"
11+
12+
The **external link button** component is a button that opens links in an external tab. To further customize this component, you can also utilize all properties of the [button component](/components/button).
13+
14+
## Examples
15+
16+
### Basic external link button
17+
18+
In order to display a basic external link button, you can use the `href` property to specify the URL and the `variant` property to set the button style.
19+
20+
```js file="./ExternalLinkButtonExample.tsx"
21+
22+
```
23+
24+
### Inline external link button
25+
26+
You may use the external link button component inline with other text by using the `inline` property.
27+
28+
```js file="./ExternalLinkButtonInlineExample.tsx"
29+
30+
```
31+
32+
### Passing props to the icon
33+
34+
You may pass props to the icon using the `iconProps` property. This is useful for customizing the title of the icon for enhanced screen reader support.
35+
36+
```js file="./ExternalLinkButtonIconPropsExample.tsx"
37+
38+
```
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
import ExternalLinkButton from '@patternfly/react-component-groups/dist/dynamic/ExternalLinkButton';
2+
3+
export const BasicExample = () => (
4+
<ExternalLinkButton
5+
href="https://www.patternfly.org"
6+
variant="primary"
7+
>
8+
Learn more about PatternFly
9+
</ExternalLinkButton>
10+
);
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
import ExternalLinkButton from '@patternfly/react-component-groups/dist/dynamic/ExternalLinkButton';
2+
3+
export const BasicExample = () => (
4+
<ExternalLinkButton
5+
href="https://www.patternfly.org"
6+
iconProps={{ title: '(Opens in new tab)' }}
7+
variant="link"
8+
>
9+
Learn more about PatternFly
10+
</ExternalLinkButton>
11+
);
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
import ExternalLinkButton from '@patternfly/react-component-groups/dist/dynamic/ExternalLinkButton';
2+
import { Content, ContentVariants } from '@patternfly/react-core';
3+
4+
export const BasicExample = () => (
5+
<Content component={ContentVariants.p}>
6+
Today, I had a burger for lunch. It reminded me of the
7+
<ExternalLinkButton
8+
href="https://www.patternfly.org"
9+
isInline
10+
variant="link"
11+
>
12+
PatternFly
13+
</ExternalLinkButton>
14+
design system.
15+
</Content>
16+
);

0 commit comments

Comments
 (0)