|$ curl https://forge-ai.dev/api/markdown?path=docs/components/forms
$cat docs/forms.md
updated Recently·15 min read·published

Forms

CSSHTMLUIIntermediate
Form Components

Forms are the primary way users submit data. These examples demonstrate clean form layouts with proper labels, validation states, input groups, and error handling — styled with modern CSS and zero dependencies.

Input with Label

Every input must have an associated label for accessibility. Use the for attribute matching the input id to connect them.

form-inputs
Live
untitled.html
HTML
1<div class="form">
2 <div class="field">
3 <label class="label" for="name2">
4 Full Name
5 </label>
6 <input class="input" id="name2" type="text" placeholder="Enter your name" />
7 </div>
8 <div class="field">
9 <label class="label" for="email2">
10 Email Address
11 </label>
12 <input class="input" id="email2" type="email" placeholder="your@email.com" />
13 <span class="error-msg" id="email-error">
14 <svg width="12" height="12" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
15 <circle cx="12" cy="12" r="10"/>
16 <line x1="15" y1="9" x2="9" y2="15"/>
17 <line x1="9" y1="9" x2="15" y2="15"/>
18 </svg>
19 Please enter a valid email
20 </span>
21 </div>
22 <div class="field">
23 <label class="label" for="msg2">
24 Message
25 <span id="msg-count" style="color:#525252;font-weight:400">
26 (0)
27 </span>
28 </label>
29 <textarea class="input" id="msg2" rows="3" placeholder="Write your message..." maxlength="200">
30 </textarea>
31 </div>
32 <button class="btn" style="width:100%" id="submit-btn">
33 Submit
34 </button>
35</div>
preview
Select & Checkbox

Styled select dropdowns and checkbox inputs using clean CSS. The select uses appearance: none with a custom SVG arrow for consistent cross-browser styling.

form-select
Live
untitled.html
HTML
1<div class="form">
2 <div class="field">
3 <label class="label" for="country">
4 Country
5 </label>
6 <select class="select" id="country">
7 <option>
8 United States
9 </option>
10 <option>
11 Canada
12 </option>
13 <option>
14 United Kingdom
15 </option>
16 <option>
17 Germany
18 </option>
19 <option>
20 Japan
21 </option>
22 </select>
23 </div>
24 <div class="field">
25 <span class="label">
26 Preferences
27 <span id="cb-count" style="color:#525252;font-weight:400">
28 (1 selected)
29 </span>
30 </span>
31 <div class="checkbox-group">
32 <label class="checkbox-label">
33 <input type="checkbox" checked />
34 Email notifications
35 </label>
36 <label class="checkbox-label">
37 <input type="checkbox" />
38 SMS updates
39 </label>
40 <label class="checkbox-label">
41 <input type="checkbox" />
42 Weekly digest
43 </label>
44 </div>
45 </div>
46</div>
preview
Form Layout

A complete sign-up form with grid layout, inline fields, and validation-ready styling. This is a production-ready form card you can drop into any project.

signup-form
Live
untitled.html
HTML
1<div class="form-card">
2 <h2 class="form-title">
3 Create Account
4 </h2>
5 <p class="form-sub">
6 Get started with a free account
7 </p>
8 <div class="row">
9 <div class="field">
10 <label class="label">
11 First Name
12 </label>
13 <input class="input" placeholder="John" />
14 </div>
15 <div class="field">
16 <label class="label">
17 Last Name
18 </label>
19 <input class="input" placeholder="Doe" />
20 </div>
21 </div>
22 <div class="field">
23 <label class="label">
24 Email
25 </label>
26 <input class="input" type="email" placeholder="john@example.com" />
27 </div>
28 <div class="row">
29 <div class="field">
30 <label class="label">
31 Password
32 </label>
33 <div class="pw-wrap">
34 <input class="input" id="pw1" type="password" placeholder="••••••••" />
35 <button class="pw-toggle" data-for="pw1" aria-label="Toggle password">
36 <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" width="16" height="16">
37 <path d="M1 12s4-8 11-8 11 8 11 8-4 8-11 8-11-8-11-8z"/>
38 <circle cx="12" cy="12" r="3"/>
39 </svg>
40 </button>
41 </div>
42 </div>
43 <div class="field">
44 <label class="label">
45 Confirm
46 </label>
47 <div class="pw-wrap">
48 <input class="input" id="pw2" type="password" placeholder="••••••••" />
49 <button class="pw-toggle" data-for="pw2" aria-label="Toggle password">
50 <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" width="16" height="16">
51 <path d="M1 12s4-8 11-8 11 8 11 8-4 8-11 8-11-8-11-8z"/>
52 <circle cx="12" cy="12" r="3"/>
53 </svg>
54 </button>
55 </div>
56 </div>
57 </div>
58 <button class="btn">
59 Create Account
60 </button>
61 <hr class="divider" />
62 <p class="terms">
63 By signing up you agree to our
64 <a href="#">
65 Terms of Service
66 </a>
67 </p>
68</div>
preview