Forms
Text field
Labelled inputs with required marks, one line of help, and the two-up field grid.
import { EcoTextField, EcoField, EcoFieldGrid } from "vue-ecosphere"
Field
A label, a required mark and an example placeholder.
Value: ""
Filled
Value: "Kiara Casmer"
Grid
fgrid puts two fields side by side.
Hint and error
One line of help. The error replaces the hint while the value is wrong — add a domain to see the hint come back.
That address is missing a domain, like .com.
Password with reveal
The eye button swaps the input between password and text; the end of the box is its, so iconEnd is ignored.
Your own control in a field
EcoField wraps any control with the label and help line.
Shown in the sidebar.
EcoTextField
| Name | Type | Default | Description |
|---|---|---|---|
v-model | string | "" | The input's value. |
label | string | — | Field label (field__l), wired to the input with for/id. |
required | boolean | false | Adds the req mark after the label. |
hint | string | — | One line of help: the format or the range. |
error | string | — | Replaces the hint and sets aria-invalid. Never stack the two. |
invalid | boolean | false | Invalid without a message. |
type | "text" | "email" | "password" | "tel" | "url" | "search" | "number" | "text" | Native input type. |
placeholder | string | — | An example value, never the label. |
icon | string | — | Leading glyph inside the box (ifield + ifield__ico). Inert. |
iconEnd | string | — | Trailing glyph inside the box (ifield--end). Ignored while reveal shows its button. |
reveal | boolean | false | With type="password": an eye button at the end of the box shows and hides the value (aria-pressed while shown). |
showLabel / hideLabel | string | "Show password" / "Hide password" | Accessible name of the reveal button while the value is hidden / shown. |
first | boolean | false | First field in its container: drops the top margin (field--first). |
disabled / readonly | boolean | false | Pair disabled with a hint that says why. |
id | string | — | Input id; generated when omitted. |
…attrs | — | — | name, autocomplete, inputmode and listeners go to the <input>; class/style to the field. |
EcoField
| Name | Type | Default | Description |
|---|---|---|---|
label / required / hint / error / first | — | — | As on EcoTextField. |
for | string | — | Id of your control: renders a <label for>. Without it the label is a <span>. |
labelId / describedId | string | — | Ids for aria-labelledby and aria-describedby on your control. |
slots | default · label · hint · error · foot · after | — | The control goes in the default slot; foot replaces the hint/error line. |
EcoFieldGrid
| Name | Type | Default | Description |
|---|---|---|---|
first | boolean | false | First thing in its container: drops the top margin (fgrid--first). |
default slot | — | — | Two fields; their own top margins are dropped inside the grid. |