Move optional attribute documentation (#369)
This commit is contained in:
parent
4f14db7415
commit
cdb9d3a48d
2 changed files with 19 additions and 19 deletions
docs/content
|
@ -84,25 +84,6 @@ html! {
|
|||
# ;
|
||||
```
|
||||
|
||||
## Optional attributes: `title=[Some("value")]`
|
||||
|
||||
Add optional attributes to an element using `attr=[value]` syntax, with *square* brackets.
|
||||
These are only rendered if the value is `Some<T>`, and entirely omitted if the value is `None`.
|
||||
|
||||
```rust
|
||||
# let _ = maud::
|
||||
html! {
|
||||
p title=[Some("Good password")] { "Correct horse" }
|
||||
|
||||
@let value = Some(42);
|
||||
input value=[value];
|
||||
|
||||
@let title: Option<&str> = None;
|
||||
p title=[title] { "Battery staple" }
|
||||
}
|
||||
# ;
|
||||
```
|
||||
|
||||
## Empty attributes: `checked`
|
||||
|
||||
Declare an empty attribute by omitting the value.
|
||||
|
|
|
@ -142,3 +142,22 @@ html! {
|
|||
}
|
||||
# ;
|
||||
```
|
||||
|
||||
### Optional attributes with values: `title=[Some("value")]`
|
||||
|
||||
Add optional attributes to an element using `attr=[value]` syntax, with *square* brackets.
|
||||
These are only rendered if the value is `Some<T>`, and entirely omitted if the value is `None`.
|
||||
|
||||
```rust
|
||||
# let _ = maud::
|
||||
html! {
|
||||
p title=[Some("Good password")] { "Correct horse" }
|
||||
|
||||
@let value = Some(42);
|
||||
input value=[value];
|
||||
|
||||
@let title: Option<&str> = None;
|
||||
p title=[title] { "Battery staple" }
|
||||
}
|
||||
# ;
|
||||
```
|
Loading…
Add table
Reference in a new issue