HTML5 Input Types and Attributes
Showcases all HTML5 input types with appropriate attributes for data collection, validation, and enhanced user experience across different devices.
Code
<form>
<label>Text: <input type="text" placeholder="Enter text"></label>
<label>Email: <input type="email" placeholder="[email protected]"></label>
<label>URL: <input type="url" placeholder="https://example.com"></label>
<label>Tel: <input type="tel" placeholder="555-123-4567"></label>
<label>Number: <input type="number" min="0" max="100" step="5" value="50"></label>
<label>Range: <input type="range" min="0" max="100" value="50"></label>
<label>Color: <input type="color" value="#ff0000"></label>
<label>Date: <input type="date" min="2025-01-01" max="2025-12-31"></label>
<label>Time: <input type="time" value="14:30"></label>
<label>Datetime: <input type="datetime-local"></label>
<label>Month: <input type="month"></label>
<label>Week: <input type="week"></label>
<label>Search: <input type="search" placeholder="Search..."></label>
<label>File: <input type="file" accept="image/*" multiple></label>
<fieldset>
<legend>Radio Group</legend>
<label><input type="radio" name="size" value="s"> Small</label>
<label><input type="radio" name="size" value="m" checked> Medium</label>
<label><input type="radio" name="size" value="l"> Large</label>
</fieldset>
<label>Checkbox: <input type="checkbox" checked></label>
<label>Password: <input type="password" minlength="8"></label>
<button type="submit">Submit</button>
</form>HTML5 input types trigger native UI widgets and validation: email, url, tel (mobile keyboard), number/range (numeric), color (picker), date/time/datetime-local/month/week (date pickers), search (search UI), file (with accept and multiple). Native validation provides immediate feedback without JavaScript. Each type has appropriate mobile keyboard support.
Interactive Tools for This Topic
JSON to Zod Schema ConverterInfer typed Zod z.object schemas from JSON payloads locally, supporting nested objects, merged array shapes, enums, nullable fields, and JSDoc comments.JSON Schema ValidatorValidate JSON data against a JSON Schema definition and get detailed error reports. Supports type checking, required fields, and common constraint validation.JSONL / NDJSON InspectorValidate NDJSON and JSON Lines line-by-line, pinpoint syntax errors by line number, analyze key frequencies and types, and export a pretty JSON array.Credit Card Brand DetectorIdentify the card network from a number's prefix and length, validate the Luhn checksum, and show a masked form and the issuer identification number.
Report a problem with this exampleOpens a pre-filled issue on GitHub.