askrobots / dbbasic-web-native
Public
100+ copy-paste UI components in plain HTML and CSS: no dependencies, no build step.
danq9
Add canonical.html v1.0 - The single source of truth for usability standards
fb6e650
1 year ago
History
semantic-input.html · 11.7 KB · 214 lines
| 1 | <!DOCTYPE html> |
| 2 | <html lang="en"> |
| 3 | <head> |
| 4 | <meta charset="UTF-8"> |
| 5 | <meta name="viewport" content="width=device-width, initial-scale=1.0"> |
| 6 | <title>semantic-input - Semantic Components</title> |
| 7 | <script src="../semantic-components.js"></script> |
| 8 | <link rel="stylesheet" href="component-docs.css"> |
| 9 | </head> |
| 10 | <body> |
| 11 | <div class="container"> |
| 12 | <!-- Header --> |
| 13 | <div class="header"> |
| 14 | <h1 class="component-name"><semantic-input></h1> |
| 15 | <p class="tagline">Form inputs with voice hints, validation, and multi-modal support</p> |
| 16 | <div class="quick-example"> |
| 17 | <semantic-input label="Full Name" placeholder="Enter your name" type="text"></semantic-input> |
| 18 | </div> |
| 19 | </div> |
| 20 | |
| 21 | <!-- Overview --> |
| 22 | <section class="section"> |
| 23 | <h2 class="section-title">Overview</h2> |
| 24 | <p class="section-description">The semantic-input component provides form input fields with automatic validation states, voice dictation hints, and multi-modal support.</p> |
| 25 | </section> |
| 26 | |
| 27 | <!-- Examples --> |
| 28 | <section class="section"> |
| 29 | <h2 class="section-title">Examples</h2> |
| 30 | <div class="grid"> |
| 31 | |
| 32 | <div class="example"> |
| 33 | <div class="example-label">Text Input</div> |
| 34 | <div class="example-demo"> |
| 35 | <semantic-input label="Full Name" placeholder="Enter your name" type="text"></semantic-input> |
| 36 | </div> |
| 37 | <div class="example-code"><semantic-input label="Full Name" placeholder="Enter your name" type="text"></semantic-input></div> |
| 38 | <div class="example-notes">Use for: Text entry fields<br>Validation: None by default<br>Voice: "Type Full Name" to dictate</div> |
| 39 | </div> |
| 40 | <div class="example"> |
| 41 | <div class="example-label">Valid State</div> |
| 42 | <div class="example-demo"> |
| 43 | <semantic-input label="Email" value="user@example.com" type="email" valid></semantic-input> |
| 44 | </div> |
| 45 | <div class="example-code"><semantic-input label="Email" value="user@example.com" type="email" valid></semantic-input></div> |
| 46 | <div class="example-notes">Use for: Showing successful validation<br>Visual: Green border<br>Contrast: Meets WCAG AA</div> |
| 47 | </div> |
| 48 | <div class="example"> |
| 49 | <div class="example-label">Error State</div> |
| 50 | <div class="example-demo"> |
| 51 | <semantic-input label="Email" value="bad-email" type="email" error="Please enter a valid email"></semantic-input> |
| 52 | </div> |
| 53 | <div class="example-code"><semantic-input label="Email" value="bad-email" type="email" error="Please enter a valid email"></semantic-input></div> |
| 54 | <div class="example-notes">Use for: Validation errors<br>Visual: Red border + error message<br>Accessibility: Error announced to screen readers</div> |
| 55 | </div> |
| 56 | </div> |
| 57 | </section> |
| 58 | |
| 59 | <!-- Interactive States --> |
| 60 | <section class="section"> |
| 61 | <h2 class="section-title">Interactive States</h2> |
| 62 | <div class="state-showcase"> |
| 63 | |
| 64 | <div class="state-box"> |
| 65 | <div class="state-label">Default State</div> |
| 66 | <div class="state-visual state-default"> |
| 67 | <semantic-input intent="primary" >Default</semantic-input> |
| 68 | </div> |
| 69 | <div class="state-description">Dark input with grey border</div> |
| 70 | </div> |
| 71 | <div class="state-box"> |
| 72 | <div class="state-label">Focus State</div> |
| 73 | <div class="state-visual state-focus"> |
| 74 | <semantic-input intent="primary" >Focus</semantic-input> |
| 75 | </div> |
| 76 | <div class="state-description">Blue border (#0066cc), blue glow</div> |
| 77 | </div> |
| 78 | <div class="state-box"> |
| 79 | <div class="state-label">Valid State</div> |
| 80 | <div class="state-visual state-valid"> |
| 81 | <semantic-input intent="primary" >Valid</semantic-input> |
| 82 | </div> |
| 83 | <div class="state-description">Green border (#34c759)</div> |
| 84 | </div> |
| 85 | <div class="state-box"> |
| 86 | <div class="state-label">Error State</div> |
| 87 | <div class="state-visual state-error"> |
| 88 | <semantic-input intent="primary" >Error</semantic-input> |
| 89 | </div> |
| 90 | <div class="state-description">Red border (#ff3b30) + red error text below</div> |
| 91 | </div> |
| 92 | <div class="state-box"> |
| 93 | <div class="state-label">Disabled State</div> |
| 94 | <div class="state-visual state-disabled"> |
| 95 | <semantic-input intent="primary" disabled>Disabled</semantic-input> |
| 96 | </div> |
| 97 | <div class="state-description">Grey background, 50% opacity</div> |
| 98 | </div> |
| 99 | </div> |
| 100 | </section> |
| 101 | |
| 102 | <!-- Properties --> |
| 103 | <section class="section"> |
| 104 | <h2 class="section-title">Properties & Attributes</h2> |
| 105 | <table class="property-table"> |
| 106 | <thead> |
| 107 | <tr> |
| 108 | <th>Attribute</th> |
| 109 | <th>Type</th> |
| 110 | <th>Values</th> |
| 111 | <th>Default</th> |
| 112 | <th>Description</th> |
| 113 | </tr> |
| 114 | </thead> |
| 115 | <tbody> |
| 116 | |
| 117 | <tr style="border-bottom: 1px solid #333;"> |
| 118 | <td style="padding: 12px;"><span class="prop-name">label</span></td> |
| 119 | <td style="padding: 12px;"><span class="prop-type">string</span></td> |
| 120 | <td style="padding: 12px;"><span class="prop-values">text</span></td> |
| 121 | <td style="padding: 12px;"></td> |
| 122 | <td style="padding: 12px;">Label for the input</td> |
| 123 | </tr> |
| 124 | <tr style="border-bottom: 1px solid #333;"> |
| 125 | <td style="padding: 12px;"><span class="prop-name">type</span></td> |
| 126 | <td style="padding: 12px;"><span class="prop-type">string</span></td> |
| 127 | <td style="padding: 12px;"><span class="prop-values">text | email | password | number</span></td> |
| 128 | <td style="padding: 12px;">text</td> |
| 129 | <td style="padding: 12px;">Input type</td> |
| 130 | </tr> |
| 131 | <tr style="border-bottom: 1px solid #333;"> |
| 132 | <td style="padding: 12px;"><span class="prop-name">placeholder</span></td> |
| 133 | <td style="padding: 12px;"><span class="prop-type">string</span></td> |
| 134 | <td style="padding: 12px;"><span class="prop-values">text</span></td> |
| 135 | <td style="padding: 12px;"></td> |
| 136 | <td style="padding: 12px;">Placeholder text</td> |
| 137 | </tr> |
| 138 | <tr style="border-bottom: 1px solid #333;"> |
| 139 | <td style="padding: 12px;"><span class="prop-name">value</span></td> |
| 140 | <td style="padding: 12px;"><span class="prop-type">string</span></td> |
| 141 | <td style="padding: 12px;"><span class="prop-values">text</span></td> |
| 142 | <td style="padding: 12px;"></td> |
| 143 | <td style="padding: 12px;">Current value</td> |
| 144 | </tr> |
| 145 | <tr style="border-bottom: 1px solid #333;"> |
| 146 | <td style="padding: 12px;"><span class="prop-name">error</span></td> |
| 147 | <td style="padding: 12px;"><span class="prop-type">string</span></td> |
| 148 | <td style="padding: 12px;"><span class="prop-values">text</span></td> |
| 149 | <td style="padding: 12px;"></td> |
| 150 | <td style="padding: 12px;">Error message</td> |
| 151 | </tr> |
| 152 | <tr style="border-bottom: 1px solid #333;"> |
| 153 | <td style="padding: 12px;"><span class="prop-name">valid</span></td> |
| 154 | <td style="padding: 12px;"><span class="prop-type">boolean</span></td> |
| 155 | <td style="padding: 12px;"><span class="prop-values">true | false</span></td> |
| 156 | <td style="padding: 12px;">false</td> |
| 157 | <td style="padding: 12px;">Show valid state</td> |
| 158 | </tr> |
| 159 | <tr style="border-bottom: 1px solid #333;"> |
| 160 | <td style="padding: 12px;"><span class="prop-name">disabled</span></td> |
| 161 | <td style="padding: 12px;"><span class="prop-type">boolean</span></td> |
| 162 | <td style="padding: 12px;"><span class="prop-values">true | false</span></td> |
| 163 | <td style="padding: 12px;">false</td> |
| 164 | <td style="padding: 12px;">Disable input</td> |
| 165 | </tr> |
| 166 | |
| 167 | </tbody> |
| 168 | </table> |
| 169 | </section> |
| 170 | |
| 171 | <!-- Events --> |
| 172 | <section class="section"> |
| 173 | <h2 class="section-title">Events</h2> |
| 174 | <table class="property-table"> |
| 175 | <thead> |
| 176 | <tr> |
| 177 | <th>Event</th> |
| 178 | <th>Trigger</th> |
| 179 | <th>Detail</th> |
| 180 | <th>Description</th> |
| 181 | </tr> |
| 182 | </thead> |
| 183 | <tbody> |
| 184 | |
| 185 | <tr style="border-bottom: 1px solid #333;"> |
| 186 | <td style="padding: 12px;"><span class="prop-name">input</span></td> |
| 187 | <td style="padding: 12px;">User types</td> |
| 188 | <td style="padding: 12px;"><code>{ value }</code></td> |
| 189 | <td style="padding: 12px;">Fires on every keystroke</td> |
| 190 | </tr> |
| 191 | <tr style="border-bottom: 1px solid #333;"> |
| 192 | <td style="padding: 12px;"><span class="prop-name">change</span></td> |
| 193 | <td style="padding: 12px;">Value changes and loses focus</td> |
| 194 | <td style="padding: 12px;"><code>{ value }</code></td> |
| 195 | <td style="padding: 12px;">Fires when input is complete</td> |
| 196 | </tr> |
| 197 | <tr style="border-bottom: 1px solid #333;"> |
| 198 | <td style="padding: 12px;"><span class="prop-name">focus</span></td> |
| 199 | <td style="padding: 12px;">Input receives focus</td> |
| 200 | <td style="padding: 12px;"><code>{}</code></td> |
| 201 | <td style="padding: 12px;">Focus event</td> |
| 202 | </tr> |
| 203 | <tr style="border-bottom: 1px solid #333;"> |
| 204 | <td style="padding: 12px;"><span class="prop-name">blur</span></td> |
| 205 | <td style="padding: 12px;">Input loses focus</td> |
| 206 | <td style="padding: 12px;"><code>{ value }</code></td> |
| 207 | <td style="padding: 12px;">Blur event</td> |
| 208 | </tr> |
| 209 | </tbody> |
| 210 | </table> |
| 211 | </section> |
| 212 | </div> |
| 213 | </body> |
| 214 | </html> |