2024-12-17 15:17:25 -05:00
|
|
|
---
|
|
|
|
|
title: Form Inputs
|
2024-12-19 04:03:44 -05:00
|
|
|
tags: native
|
2024-12-17 18:06:33 -05:00
|
|
|
layout: element
|
|
|
|
|
component:
|
|
|
|
|
- input
|
|
|
|
|
- select
|
|
|
|
|
- textarea
|
2024-12-18 19:36:26 -05:00
|
|
|
- range
|
2024-12-17 18:06:33 -05:00
|
|
|
elements:
|
|
|
|
|
"<input>": https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input
|
|
|
|
|
"<textarea>": https://developer.mozilla.org/en-US/docs/Web/HTML/Element/textarea
|
|
|
|
|
"<select>": https://developer.mozilla.org/en-US/docs/Web/HTML/Element/select
|
2024-12-17 15:17:25 -05:00
|
|
|
---
|
2024-12-17 16:22:11 -05:00
|
|
|
<style>
|
|
|
|
|
wa-code-demo::part(preview) {
|
|
|
|
|
display: grid;
|
|
|
|
|
grid-template-columns: 1fr 1fr;
|
|
|
|
|
gap: 2rem;
|
|
|
|
|
}
|
|
|
|
|
</style>
|
|
|
|
|
|
|
|
|
|
## Text fields
|
|
|
|
|
|
|
|
|
|
```html {.example}
|
|
|
|
|
<label>Input (text) <input type="text" placeholder="placeholder"></label>
|
2024-12-17 15:17:25 -05:00
|
|
|
<wa-input label="WA Input (text)" type="text" placeholder="placeholder"></wa-input>
|
|
|
|
|
|
2024-12-17 16:22:11 -05:00
|
|
|
<label>Input (number) <input type="number"></label>
|
2024-12-17 15:17:25 -05:00
|
|
|
<wa-input label="WA Input (number)" type="number"></wa-input>
|
|
|
|
|
|
2024-12-17 16:22:11 -05:00
|
|
|
<label>Input (password) <input type="password" required></label>
|
2024-12-17 15:17:25 -05:00
|
|
|
<wa-input label="WA Input (password)" type="password" required></wa-input>
|
|
|
|
|
|
2024-12-17 16:22:11 -05:00
|
|
|
<label>Input (email) <input type="email"></label>
|
2024-12-17 15:17:25 -05:00
|
|
|
<wa-input label="WA Input (email)" type="email"></wa-input>
|
|
|
|
|
|
2024-12-17 16:22:11 -05:00
|
|
|
<label>Input (search) <input type="search"></label>
|
2024-12-17 15:17:25 -05:00
|
|
|
<wa-input label="WA Input (search)" type="search"></wa-input>
|
|
|
|
|
|
2024-12-17 16:22:11 -05:00
|
|
|
<label>Input (tel) <input type="tel"></label>
|
2024-12-17 15:17:25 -05:00
|
|
|
<wa-input label="WA Input (tel)" type="tel"></wa-input>
|
|
|
|
|
|
2024-12-17 16:22:11 -05:00
|
|
|
<label>Input (url) <input type="url"></label>
|
2024-12-17 15:17:25 -05:00
|
|
|
<wa-input label="WA Input (url)" type="url"></wa-input>
|
|
|
|
|
|
2024-12-17 16:22:11 -05:00
|
|
|
<label>Textarea <textarea></textarea></label>
|
|
|
|
|
<wa-textarea label="WA Textarea"></wa-textarea>
|
|
|
|
|
```
|
2024-12-17 15:17:25 -05:00
|
|
|
|
2024-12-17 16:22:11 -05:00
|
|
|
## Choice inputs
|
2024-12-17 15:17:25 -05:00
|
|
|
|
2024-12-17 16:22:11 -05:00
|
|
|
```html {.example}
|
|
|
|
|
<label><input type="checkbox"> Input (checkbox)</label>
|
|
|
|
|
<wa-checkbox>WA Checkbox</wa-checkbox>
|
2024-12-17 15:17:25 -05:00
|
|
|
|
2024-12-19 01:43:56 -05:00
|
|
|
<label><input type="radio" name="radio" value="radio-1" checked>Radio</label>
|
|
|
|
|
|
|
|
|
|
<wa-radio value="radio-1">WA Radio</wa-radio>
|
2024-12-17 16:22:11 -05:00
|
|
|
```
|
2024-12-17 15:17:25 -05:00
|
|
|
|
2024-12-17 16:22:11 -05:00
|
|
|
## Color picker
|
2024-12-17 15:17:25 -05:00
|
|
|
|
2024-12-17 16:22:11 -05:00
|
|
|
```html {.example}
|
|
|
|
|
<label>Input (color) <input type="color"></label>
|
|
|
|
|
|
|
|
|
|
<wa-color-picker label="WA Color Picker"></wa-color-picker>
|
|
|
|
|
```
|
2024-12-17 15:17:25 -05:00
|
|
|
|
2024-12-17 16:22:11 -05:00
|
|
|
## Time and date Pickers
|
2024-12-17 15:17:25 -05:00
|
|
|
|
2024-12-17 16:22:11 -05:00
|
|
|
```html {.example}
|
|
|
|
|
<label>Input (datetime-local) <input type="datetime-local"></label>
|
|
|
|
|
<wa-input label="WA Input (datetime-local)" type="datetime-local"></wa-input>
|
|
|
|
|
|
|
|
|
|
<label>Input (date) <input type="date"></label>
|
|
|
|
|
<wa-input label="WA Input (date)" type="date"></wa-input>
|
2024-12-17 15:17:25 -05:00
|
|
|
|
2024-12-17 16:22:11 -05:00
|
|
|
<label>Input (time) <input type="time"></label>
|
|
|
|
|
<wa-input label="WA Input (time)" type="time"></wa-input>
|
|
|
|
|
```
|
|
|
|
|
|
2024-12-18 19:36:26 -05:00
|
|
|
## Sliders
|
2024-12-17 16:22:11 -05:00
|
|
|
|
|
|
|
|
```html {.example}
|
|
|
|
|
<label>Input (range)<input type="range"></label>
|
|
|
|
|
<wa-range label="WA Range"></wa-range>
|
|
|
|
|
```
|
|
|
|
|
|
2024-12-18 19:36:26 -05:00
|
|
|
## Select dropdowns
|
2024-12-17 16:22:11 -05:00
|
|
|
|
|
|
|
|
```html {.example}
|
|
|
|
|
<label>Select
|
2024-12-17 15:17:25 -05:00
|
|
|
<select id="select">
|
|
|
|
|
<option value="option-1">Option 1</option>
|
|
|
|
|
<option value="option-2">Option 2</option>
|
|
|
|
|
<option value="option-3">Option 3</option>
|
|
|
|
|
</select>
|
2024-12-17 16:22:11 -05:00
|
|
|
</label>
|
2024-12-17 15:17:25 -05:00
|
|
|
|
|
|
|
|
<wa-select label="WA Select">
|
|
|
|
|
<wa-option value="option-1">Option 1</wa-option>
|
|
|
|
|
<wa-option value="option-2">Option 2</wa-option>
|
|
|
|
|
<wa-option value="option-3">Option 3</wa-option>
|
|
|
|
|
</wa-select>
|
2024-12-17 16:22:11 -05:00
|
|
|
```
|