Skip to content

Commit d91ce10

Browse files
committed
docs(button): click listener example
1 parent f871557 commit d91ce10

File tree

1 file changed

+47
-3
lines changed

1 file changed

+47
-3
lines changed

elements/pf-button/docs/pf-button.md

Lines changed: 47 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
{% renderInstallation %} {% endrenderInstallation %}
2-
31
<style>
42
pf-button + pf-button {
53
margin-inline-start: 4px;
@@ -8,9 +6,12 @@ pf-button + pf-button {
86
</style>
97

108
<script type="module">
11-
import '@patternfly/elements/pf-icon/pf-icon.js';
9+
import '@patternfly/elements/pf-icon/pf-icon.js';
10+
import '@patternfly/elements/pf-tabs/pf-tabs.js';
1211
</script>
1312

13+
{% renderInstallation %} {% endrenderInstallation %}
14+
1415
{% renderOverview %}
1516

1617
<div class="overview-buttons">
@@ -70,6 +71,49 @@ import '@patternfly/elements/pf-icon/pf-icon.js';
7071
<pf-button>Medium Button</pf-button>
7172
<pf-button size="large">Large Button</pf-button>
7273
{% endhtmlexample %}
74+
75+
### Click listeners
76+
77+
<pf-tabs class="html-lit-react-snippets">
78+
<pf-tab slot="tab">HTML</pf-tab>
79+
<pf-tab-panel>
80+
81+
```html
82+
<script type="module">
83+
import '@patternfly/elements/pf-button/pf-button.js';
84+
</script>
85+
<pf-button onclick="console.log('clicked!');">
86+
Click me!
87+
</pf-button>
88+
```
89+
90+
</pf-tab-panel>
91+
<pf-tab slot="tab">Lit</pf-tab>
92+
<pf-tab-panel>
93+
94+
```js
95+
import '@patternfly/elements/pf-button/pf-button.js';
96+
html`
97+
<pf-button @click="${() => console.log('clicked!');}">
98+
Click me!
99+
</pf-button>
100+
`;
101+
```
102+
103+
</pf-tab-panel>
104+
<pf-tab slot="tab">React</pf-tab>
105+
<pf-tab-panel>
106+
107+
```jsx
108+
import { Button } from '@patternfly/elements/react/pf-button/pf-button.js';
109+
<Button onClick={() => console.log('clicked!');}>
110+
Click me!
111+
</Button>
112+
```
113+
114+
</pf-tab-panel>
115+
</pf-tabs>
116+
73117
{% endband %}
74118

75119
{% renderSlots %}{% endrenderSlots %}

0 commit comments

Comments
 (0)