UI snippets

General rules

Design rules

CSS Debugging

{outline:1px solid red;}
{outline:1px solid red;}

Input autofocus

<input autofocus />

Input validated length

<label for="minmax-length"> minlength="3" & maxlength="4"</label>
<input id="minmax-length" minlength="3" maxlength="4" />

Input validated regex pattern

<form action="#">
<label for="input-pattern">pattern="[A-z]{2,4}"</label>
<input id="input-pattern" pattern="[A-Za-z]{2,4}">
<input type="submit" value="click submit">
</form>

Mobile input modes

<label for="mode-numeric">inputmode="numeric"</label>
<input id="mode-numeric" inputmode="numeric" />
<label for="mode-decimal">inputmode="decimal"</label>
<input id="mode-decimal" inputmode="decimal" />
<label for="mode-tel">inputmode="tel"</label>
<input id="mode-tel" inputmode="tel" />
<label for="mode-email">inputmode="email"</label>
<input id="mode-email" inputmode="email" />
<label for="mode-url">inputmode="url"</label>
<input id="mode-url" inputmode="url" />
<label for="mode-search">inputmode="search"</label>
<input id="mode-search" inputmode="search" />

Mobile specific

<label for="mobile-selfie">make a selfie:</label>
<input id="mobile-selfie" type="file" capture="user" accept="image/jpeg,image/png" />
<label for="autocapitalize-none">autocapitalize="none"</label>
<input id="autocapitalize-none" autocapitalize="none" />

Multiple inputs in dropdown

! bigger than a regular dropdown

<label for="multiple-select">select more than one:</label>
<select id="multiple-select" multiple>
<option value="1">option 1</option>
<option value="2">Option 2</option>
<option value="3">option 3</option>
<option value="4">Option 4</option>
<option value="5">option 5</option>
<option value="6">Option 6</option>
</select>

Multiple validated email inputs

<label for="multiple-email">multiple emails (comma separated):</label>
<input type="email" id="multiple-email" multiple />

Input autocomplete from a list

<form>
<datalist id="list-autocomplete">
<option value="-> option 1 <-">option 1</option>
<option value="Option 2" />
<option value="option 3" />
<option value="Option 4" />
<option value="option 5" />
<option value="Option 6" />
</datalist>
<label for="datalist-autocomplete">start typing the letter o:</label>
<input id="datalist-autocomplete" list="list-autocomplete" />
</form>

Custom download file name

download file
<a href=".\test.txt" download="custom" >download file</a>