aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRoss Bratton <bratton.ross@gmail.com>2024-03-07 15:40:46 +0000
committerGitHub <noreply@github.com>2024-03-07 16:40:46 +0100
commitd5b9215efd814af64f422bb7b4ea70d6a1fa5168 (patch)
tree2275f0cdfa58f6d55c574d6897d4f307ca82d38f
parent54e5c2efc1efa7f0cfb37d6f9038c7982834298f (diff)
downloadlustre-d5b9215efd814af64f422bb7b4ea70d6a1fa5168.tar.gz
lustre-d5b9215efd814af64f422bb7b4ea70d6a1fa5168.zip
🔀 Add form-related attributes. (#50)
* feat: add form-related attributes see: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/form#attributes_for_form_submission * snake_case for form_* attributes
-rw-r--r--src/lustre/attribute.gleam47
1 files changed, 47 insertions, 0 deletions
diff --git a/src/lustre/attribute.gleam b/src/lustre/attribute.gleam
index 3889aa7..b99e241 100644
--- a/src/lustre/attribute.gleam
+++ b/src/lustre/attribute.gleam
@@ -287,3 +287,50 @@ pub fn controls(visible: Bool) -> Attribute(msg) {
pub fn loop(should_loop: Bool) -> Attribute(msg) {
property("loop", should_loop)
}
+
+// FORMS -----------------------------------------------------------------------
+
+///
+pub fn action(url: String) -> Attribute(msg) {
+ attribute("action", url)
+}
+
+///
+pub fn enctype(value: String) -> Attribute(msg) {
+ attribute("enctype", value)
+}
+
+///
+pub fn method(method: String) -> Attribute(msg) {
+ attribute("method", method)
+}
+
+///
+pub fn novalidate(value: Bool) -> Attribute(msg) {
+ property("novalidate", value)
+}
+
+///
+pub fn form_action(action: String) -> Attribute(msg) {
+ attribute("formaction", action)
+}
+
+///
+pub fn form_enctype(value: String) -> Attribute(msg) {
+ attribute("formenctype", value)
+}
+
+///
+pub fn form_method(method: String) -> Attribute(msg) {
+ attribute("formmethod", method)
+}
+
+///
+pub fn form_novalidate(value: Bool) -> Attribute(msg) {
+ property("formnovalidate", value)
+}
+
+///
+pub fn form_target(target: String) -> Attribute(msg) {
+ attribute("formtarget", target)
+}