From 3ff6f60638f0e535eecb259846ea9e405effcc82 Mon Sep 17 00:00:00 2001 From: Nikhil M Warrier Date: Sun, 15 Mar 2026 12:41:11 +0530 Subject: Add `select`, `radio`, `checkbox` to forms --- src/components/FormField.astro | 76 ++++++++++++++++++++++++++++++++++++++++++ src/content.config.ts | 13 +++++++- src/content/forms/test.mdx | 14 ++++++-- src/pages/forms/[...id].astro | 53 ++++++++++++----------------- src/styles/global.css | 2 ++ 5 files changed, 122 insertions(+), 36 deletions(-) create mode 100644 src/components/FormField.astro (limited to 'src') diff --git a/src/components/FormField.astro b/src/components/FormField.astro new file mode 100644 index 0000000..f03403d --- /dev/null +++ b/src/components/FormField.astro @@ -0,0 +1,76 @@ +--- +import type { CollectionEntry } from 'astro:content' + +interface Props { + field: CollectionEntry<'forms'>['data']['form']['fields'][number] +} + +const field = Astro.props.field +const fieldType = field.type as astroHTML.JSX.HTMLInputTypeAttribute +--- + +
+ + + { + () => { + switch (field.type) { + case 'textarea': + return ( +