offline docs
This commit is contained in:
29
offline-docs/alpinejs/directives/text.md
Normal file
29
offline-docs/alpinejs/directives/text.md
Normal file
@@ -0,0 +1,29 @@
|
||||
# Alpine.js Documentation - Directives
|
||||
|
||||
Alpine directives are attributes that you can add to HTML elements to give them special behavior.
|
||||
|
||||
## [x-text](/directives/text)
|
||||
|
||||
`x-text` sets the text content of an element to the result of a given expression.
|
||||
|
||||
Here's a basic example of using `x-text` to display a user's username.
|
||||
|
||||
```
|
||||
<div x-data="{ username: 'calebporzio' }">
|
||||
|
||||
|
||||
nUsername: <strong x-text="username"></strong>
|
||||
|
||||
|
||||
n</div>
|
||||
```
|
||||
|
||||
Username:
|
||||
|
||||
Now the `<strong>` tag's inner text content will be set to "calebporzio".
|
||||
|
||||
[← x-on](/directives/on)
|
||||
|
||||
[x-html →](/directives/html)
|
||||
|
||||
Code highlighting provided by [Torchlight](https://torchlight.dev/)
|
||||
Reference in New Issue
Block a user