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

Inputs & Controls

CSSHTMLTailwindBootstrapUIIntermediate🎯Free Tools
Introduction

Inputs and controls are the primary way users communicate with applications. This guide covers production-ready patterns for text fields, input groups, selects, toggles, checkboxes, radios, sliders, file uploads, and star ratings — implemented in vanilla HTML/CSS, Tailwind CSS, and Bootstrap with a dark terminal theme.

info

Pair every input with a <label> (explicit via htmlFor / for) and use aria-describedby to link helper text or errors.
Text Fields

Standard inputs, textareas, helper text, and invalid states.

text-fields
Live
untitled.html
HTML
1<div class="wrap">
2 <div class="field">
3 <label for="email">
4 Email address
5 </label>
6 <input type="email" id="email" placeholder="you@example.com" />
7 <span class="hint">
8 We'll never share your email.
9 </span>
10 </div>
11 <div class="field error">
12 <label for="username">
13 Username
14 </label>
15 <input type="text" id="username" value="forge learn" />
16 <span class="hint">
17 Usernames cannot contain spaces.
18 </span>
19 </div>
20 <div class="field">
21 <label for="bio">
22 Bio
23 </label>
24 <textarea id="bio" rows="3" placeholder="Tell us about yourself...">
25 </textarea>
26 </div>
27</div>
preview
Input Groups

Inputs with attached icons, currency prefixes, suffix text, and action buttons.

input-groups
Live
untitled.html
HTML
1<div class="wrap">
2 <div class="i-group">
3 <span class="i-prefix">
4 <svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
5 <circle cx="11" cy="11" r="8"/>
6 <line x1="21" y1="21" x2="16.65" y2="16.65"/>
7 </svg>
8 </span>
9 <input type="text" placeholder="Search docs..." />
10 </div>
11 <div class="i-group">
12 <span class="i-prefix">
13 $
14 </span>
15 <input type="text" placeholder="0.00" />
16 <button>
17 Pay
18 </button>
19 </div>
20 <div class="i-group">
21 <input type="text" placeholder="forgelearn" />
22 <span class="i-suffix">
23 .dev
24 </span>
25 </div>
26</div>
preview
Select & Dropdown

Custom selects with a chevron indicator, including a disabled state.

select
Live
untitled.html
HTML
1<div class="wrap">
2 <div class="field">
3 <label for="role">
4 Role
5 </label>
6 <div class="select-wrap">
7 <select id="role">
8 <option value="">
9 Choose a role...
10 </option>
11 <option value="dev">
12 Developer
13 </option>
14 <option value="designer">
15 Designer
16 </option>
17 <option value="manager">
18 Product Manager
19 </option>
20 </select>
21 <svg class="chevron" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
22 <polyline points="6 9 12 15 18 9"/>
23 </svg>
24 </div>
25 </div>
26 <div class="field">
27 <label for="theme">
28 Theme
29 </label>
30 <div class="select-wrap">
31 <select id="theme" disabled>
32 <option>
33 System default
34 </option>
35 </select>
36 <svg class="chevron" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
37 <polyline points="6 9 12 15 18 9"/>
38 </svg>
39 </div>
40 </div>
41</div>
preview
Toggle Switch

Sized toggle switches with labeled variants.

toggle
Live
untitled.html
HTML
1<div class="wrap">
2 <label class="t">
3 <input type="checkbox" checked />
4 <span class="slider">
5 </span>
6 Notifications
7 </label>
8 <label class="t">
9 <input type="checkbox" />
10 <span class="slider">
11 </span>
12 Dark Mode
13 </label>
14 <label class="t sm">
15 <input type="checkbox" checked />
16 <span class="slider">
17 </span>
18 Compact
19 </label>
20</div>
preview
Checkbox Cards

Selectable cards with a custom checkmark and active state.

checkbox-cards
Live
untitled.html
HTML
1<div class="wrap">
2 <label class="c-card">
3 <input type="checkbox" checked />
4 <span class="check">
5 <svg width="12" height="12" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="3">
6 <polyline points="20 6 9 17 4 12"/>
7 </svg>
8 </span>
9 <span class="c-text">
10 Push notifications
11 </span>
12 </label>
13 <label class="c-card">
14 <input type="checkbox" />
15 <span class="check">
16 <svg width="12" height="12" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="3">
17 <polyline points="20 6 9 17 4 12"/>
18 </svg>
19 </span>
20 <span class="c-text">
21 Email digest
22 </span>
23 </label>
24 <label class="c-card">
25 <input type="checkbox" />
26 <span class="check">
27 <svg width="12" height="12" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="3">
28 <polyline points="20 6 9 17 4 12"/>
29 </svg>
30 </span>
31 <span class="c-text">
32 SMS alerts
33 </span>
34 </label>
35</div>
preview
Radio Button Group

Styled radio buttons as a segmented card selection.

radio
Live
untitled.html
HTML
1<div class="wrap">
2 <label class="r">
3 <input type="radio" name="plan" checked />
4 <span class="radio-mark">
5 </span>
6 <div>
7 <strong>
8 Free
9 </strong>
10 <p class="r-sub">
11 $0/mo — basic features
12 </p>
13 </div>
14 </label>
15 <label class="r">
16 <input type="radio" name="plan" />
17 <span class="radio-mark">
18 </span>
19 <div>
20 <strong>
21 Pro
22 </strong>
23 <p class="r-sub">
24 $12/mo — advanced features
25 </p>
26 </div>
27 </label>
28 <label class="r">
29 <input type="radio" name="plan" />
30 <span class="radio-mark">
31 </span>
32 <div>
33 <strong>
34 Enterprise
35 </strong>
36 <p class="r-sub">
37 Custom pricing
38 </p>
39 </div>
40 </label>
41</div>
preview
Range Slider

Custom styled range slider with live value display.

slider
Live
untitled.html
HTML
1<div class="wrap">
2 <div class="slider-group">
3 <label class="label">
4 Volume
5 </label>
6 <input type="range" min="0" max="100" value="65" class="range" />
7 <span class="val" id="vol">
8 65
9 </span>
10 </div>
11 <div class="slider-group">
12 <label class="label">
13 Brightness
14 </label>
15 <input type="range" min="0" max="100" value="80" class="range green" />
16 <span class="val" id="bri">
17 80
18 </span>
19 </div>
20</div>
preview
File Upload

Drag-and-drop file upload zone with button alternative.

file-upload
Live
untitled.html
HTML
1<div class="wrap">
2 <div class="drop-zone">
3 <svg width="32" height="32" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5">
4 <path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"/>
5 <polyline points="17 8 12 3 7 8"/>
6 <line x1="12" y1="3" x2="12" y2="15"/>
7 </svg>
8 <span class="dz-text">
9 Drop files here or
10 <span class="dz-link">
11 browse
12 </span>
13 </span>
14 <span class="dz-hint">
15 PNG, JPG, PDF up to 10MB
16 </span>
17 </div>
18 <button class="upload-btn">
19 Choose File
20 </button>
21</div>
preview
Star Rating

Interactive star rating with hover and selected states.

rating
Live
untitled.html
HTML
1<div class="wrap">
2 <div class="stars" style="--val:3">
3 <span class="star" data-val="1">
4
5 </span>
6 <span class="star" data-val="2">
7
8 </span>
9 <span class="star" data-val="3">
10
11 </span>
12 <span class="star" data-val="4">
13
14 </span>
15 <span class="star" data-val="5">
16
17 </span>
18 </div>
19 <span class="label">
20 3 / 5
21 </span>
22</div>
preview
Accessibility

Accessible forms help all users complete tasks. Use semantic elements, clear labels, and visible focus indicators.

  • Associate every input with a <label> using the for attribute.
  • Mark required fields with aria-required="true" and invalid fields with aria-invalid="true".
  • Ensure focus styles are visible (outline or ring) on all interactive controls.
  • Use aria-describedby to connect helper text or error messages.
  • Keep custom controls keyboard operable; toggles should respond to Space, sliders to arrow keys.
  • Provide accessible names for icon-only buttons inside input groups.

Community

Get help on Slack, Discord or VIP

Stuck on a guide? Join the community and ask.