Skip to content

Commit dbd52bd

Browse files
committed
Input key support
1 parent 9caf716 commit dbd52bd

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

Sources/SwiftHtml/Html/Tags/Input.swift

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ public final class Input: Tag {
1818
}
1919

2020
public extension Input {
21+
2122
enum `Type`: String {
2223
case button
2324
case checkbox
@@ -43,6 +44,13 @@ public extension Input {
4344
case week
4445
}
4546

47+
/// Sets both the name and id
48+
func key(_ value: String) -> Self {
49+
node.upsert(Attribute(key: "id", value: value))
50+
node.upsert(Attribute(key: "name", value: value))
51+
return self
52+
}
53+
4654
/// Specifies a filter for what file types the user can pick from the file input dialog box (only for type="file")
4755
func accept(_ value: String) -> Self {
4856
node.upsert(Attribute(key: "accept", value: value))

0 commit comments

Comments
 (0)