Skip to content

Commit b1f6a76

Browse files
committed
Docs: Improve docs around @event usage in templaets
1 parent 9140d44 commit b1f6a76

File tree

2 files changed

+16
-9
lines changed

2 files changed

+16
-9
lines changed

CHANGELOG.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ Please note after `1.0` Semver will be followed using normal protocols.
7171
# Version 0.15.0 - 07.24.2025
7272

7373
## Major Features
74-
* **Feature** - Added support for binding events from inside templates using `@` handlers like `<div @click={doSomething}></div>`. See [template expressions guide](https://next.semantic-ui.com/templates/expressions).
74+
* **Feature** - Added support for binding events from inside templates using `@` handlers like `<div @click={doSomething}></div>`. See [component event guide](https://next.semantic-ui.com/components/events#inside-templates).
7575
* **Feature** - Added support for binding element properties from inside templates like `<input type="checkbox" .checked={checked}>`. See [template expressions guide](https://next.semantic-ui.com/templates/expressions).
7676
* **Feature** - Added [`registerHelper()`](https://next.semantic-ui.com/api/templating/template#registerhelper) and [`registerHelpers()`](https://next.semantic-ui.com/api/templating/template#registerhelpers) functions for registering custom template helpers.
7777

@@ -299,7 +299,7 @@ Some paths have shifted
299299
* Template Helpers - Added `isNot` helper
300300

301301
## Bug
302-
* Fix `value` / `val` in Query would not set value of custom elements because of too strict html element type checking.
302+
* Fix [`value`](https://next.semantic-ui.com/api/query/content#value) / [`val`](https://next.semantic-ui.com/api/query/content#value) in Query would not set value of custom elements because of too strict html element type checking.
303303

304304
# Version 0.10.9
305305

docs/src/pages/components/events.mdx

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import PlaygroundExample from '@components/PlaygroundExample/PlaygroundExample.a
1010
import lifecycleImage from '@images/lifecycle-diagram.png';
1111

1212

13-
## Binding Event Handlers
13+
## Inside Component
1414

1515
Semantic components can include events by passing in an object mapping events to event handlers when creating your component. Events take the form of `eventName selector`, for instance `click .submit`.
1616

@@ -76,6 +76,18 @@ const events = {
7676
};
7777
```
7878

79+
## Inside Templates
80+
81+
### @Event Handler
82+
83+
You can bind events directly from inside templates using `@event` syntax. You can specify the handler using an [expression](/templates/expressions) that points to any function, like a setting, or template method.
84+
85+
```sui
86+
<div @click={doSomething}></div>
87+
```
88+
89+
<PlaygroundExample id="template-event-handlers" direction="horizontal"></PlaygroundExample>
90+
7991

8092
## Special Event Bindings
8193

@@ -95,17 +107,12 @@ const events = {
95107
};
96108
```
97109

98-
## Binding From Templates
99-
100-
You can also bind events directly from inside templates if you prefer this syntax.
101-
102-
<PlaygroundExample id="template-event-handlers" direction="horizontal"></PlaygroundExample>
103110

104111

105112

106113
### Deep Events
107114

108-
You can use the `deep` keyword to attach events to nested web components or slotted content. This can let you target parts of the component's shadow DOM or slotted content which a person using your component might include.
115+
You can use the `deep` keyword to attach events to nested web components or slotted content. This can let you target parts of the component's [shadow DOM](/query/shadow-dom) or [slotted content](/templates/slots) which a person using your component might include.
109116

110117
> **Deep Usage** By default selectors will only match the DOM of your component's template. This will prevent the handler from firing if the user slots content which also matches your selectors.
111118

0 commit comments

Comments
 (0)