Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Clearer example for x-bind #4430

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions packages/docs/src/en/directives/bind.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ title: bind
For example, here's a component where we will use `x-bind` to set the placeholder value of an input.

```alpine
<div x-data="{ placeholder: 'Type here...' }">
<input type="text" x-bind:placeholder="placeholder">
<div x-data="{ placeholder_text: 'Type here...' }">
<input type="text" x-bind:placeholder="placeholder_text">
</div>
```

Expand All @@ -21,7 +21,7 @@ For example, here's a component where we will use `x-bind` to set the placeholde
If `x-bind:` is too verbose for your liking, you can use the shorthand: `:`. For example, here is the same input element as above, but refactored to use the shorthand syntax.

```alpine
<input type="text" :placeholder="placeholder">
<input type="text" :placeholder="placeholder_text">
```

> Despite not being included in the above snippet, `x-bind` cannot be used if no parent element has `x-data` defined. [→ Read more about `x-data`](/directives/data)
Expand Down
Loading