Prototype library

Text field

The inherited Ecology text input, wearing the CBFish skin. Label, input, and help/error text in one form-associated Web Component; its focus ring picks up brand navy from --color-primary.

Inherited wc import '@esa/ecology/esa-text-field';

Preview

<esa-text-field label="Full name" placeholder="Jane Doe" help-text="As it appears on the permit."></esa-text-field>

Types

<esa-text-field label="Email" type="email" placeholder="you@example.com"></esa-text-field>
<esa-text-field label="Password" type="password"></esa-text-field>
<esa-text-field label="Count" type="number"></esa-text-field>

Sizes

<esa-text-field label="Extra small" size="xs" placeholder="Extra small"></esa-text-field>
<esa-text-field label="Small" size="sm" placeholder="Small"></esa-text-field>
<esa-text-field label="Medium" size="md" placeholder="Medium"></esa-text-field>
<esa-text-field label="Large" size="lg" placeholder="Large"></esa-text-field>

States

<esa-text-field label="Required" required placeholder="Cannot be empty"></esa-text-field>
<esa-text-field label="With error" error-text="This field is required." required></esa-text-field>
<esa-text-field label="Disabled" disabled value="Read only"></esa-text-field>

API

PropTypeDefaultDescription
label string '' Visible label rendered above the input.
type 'text' | 'email' | 'password' | 'number' | 'tel' | 'url' 'text' Native input type.
value string '' Current value; mirrored to the form on every input.
placeholder string '' Placeholder shown when empty.
help-text string '' Helper text shown below the input.
error-text string '' Error message; replaces help text and turns the field red when present.
size 'xs' | 'sm' | 'md' | 'lg' 'md' Control size.
required boolean false Marks the field required and renders an asterisk on the label.
disabled boolean false Disables interaction.

Events

EventTypeDefaultDescription
change CustomEvent<{ value: string }> Fired on every input. Composed and bubbling; detail.value is the current string.