Docs

Main site

Installation Browser support Extend config MCP server
Validation Page speed testing Responsive design
Accordion Aspect Ratio Avatar Badge Banner Bento Grid Blockquote Breadcrumbs Button Callout Card Drawer Dropdown Link Modal Navbar Navblock Pagination Popover Progress Separator Tabs Timeline Toast Tooltip
Checkbox Datepicker File upload Form field Input Label OTP Radio Range Select Textarea Toggle
Header Footer
Accordion Auth Checkbox & Radio Content Drawers Features Modals Statistics & Metrics Teams Dropdowns
Address Contact number Currency symbol Date Emirates ID Name
Close
Home Documentation Components Input

Input

An Input is the primary single-line control for collecting short text values. "aegov-input" wraps a real native input so every browser feature, autofill behaviour, and assistive-technology hook keeps working, while "aegov-input-group" adds a static prefix or suffix addon (a currency symbol, a fixed domain, a search button) and propagates its size to the inputs and buttons inside it.

Forms
Status
Active
Introduced
4.0.x
View source code

Anatomy

aegov-input renders a real native <input> inside a small wrapper that adds icon slots and, for password/copyable fields, an inset action button.

Image showing anatomy of an input

Item Name Description
1 Icon slot Optional leading icon (icon-start)
2 Native input The real <input> element — receives all typing, autofill, and focus
3 Action button Password reveal or copy-to-clipboard button, inset at the trailing edge
4 Hint / error region Validation text, then helper text, rendered below the field — the hint stays visible while an error shows

Input types

type maps directly to the native HTML input type. Use text for general fields, email for addresses (triggers email keyboards on mobile), tel for phone numbers, number for fees and amounts, and search/url for the obvious cases.

Full name Email address Mobile number Number of dependants Search services Website
<aegov-form-field>
  <aegov-label>Full name</aegov-label>
  <aegov-input type="text"></aegov-input>
</aegov-form-field>
<aegov-form-field>
  <aegov-label>Email address</aegov-label>
  <aegov-input type="email" placeholder="you@example.gov.ae"></aegov-input>
</aegov-form-field>
<aegov-form-field>
  <aegov-label>Mobile number</aegov-label>
  <aegov-input type="tel" placeholder="+971 50 000 0000"></aegov-input>
</aegov-form-field>
<aegov-form-field>
  <aegov-label>Number of dependants</aegov-label>
  <aegov-input type="number"></aegov-input>
</aegov-form-field>
<aegov-form-field>
  <aegov-label>Search services</aegov-label>
  <aegov-input type="search"></aegov-input>
</aegov-form-field>
<aegov-form-field>
  <aegov-label>Website</aegov-label>
  <aegov-input type="url" placeholder="https://"></aegov-input>
</aegov-form-field>

Sizes

size accepts five tokens — xs, sm, base (default), lg, and xl — scaling height, padding, and font size together. It also accepts a Tailwind-style responsive string (e.g. size="sm md:base xl:lg") to resize across breakpoints.

Extra small (xs) Small (sm) Base (default) Large (lg) Extra large (xl)
<aegov-form-field>
  <aegov-label>Extra small (xs)</aegov-label>
  <aegov-input size="xs"></aegov-input>
</aegov-form-field>
<aegov-form-field>
  <aegov-label>Small (sm)</aegov-label>
  <aegov-input size="sm"></aegov-input>
</aegov-form-field>
<aegov-form-field>
  <aegov-label>Base (default)</aegov-label>
  <aegov-input size="base"></aegov-input>
</aegov-form-field>
<aegov-form-field>
  <aegov-label>Large (lg)</aegov-label>
  <aegov-input size="lg"></aegov-input>
</aegov-form-field>
<aegov-form-field>
  <aegov-label>Extra large (xl)</aegov-label>
  <aegov-input size="xl"></aegov-input>
</aegov-form-field>

Variant

variant selects the colour family for the idle border and value text. The focus ring stays camel and the error border stays red regardless of variant — both are accessibility constants that never change.

Variant Idle border Value text
primary primary-600 primary-900
secondary secondary-600 secondary-900
neutral-max aeblack-800 aeblack-950
neutral-min aeblack-400 aeblack-700
Primary Secondary Neutral-max Neutral-min
<aegov-form-field>
  <aegov-label>Primary</aegov-label>
  <aegov-input variant="primary"></aegov-input>
</aegov-form-field>
<aegov-form-field>
  <aegov-label>Secondary</aegov-label>
  <aegov-input variant="secondary"></aegov-input>
</aegov-form-field>
<aegov-form-field>
  <aegov-label>Neutral-max</aegov-label>
  <aegov-input variant="neutral-max"></aegov-input>
</aegov-form-field>
<aegov-form-field>
  <aegov-label>Neutral-min</aegov-label>
  <aegov-input variant="neutral-min"></aegov-input>
</aegov-form-field>

States

Set is-disabled to prevent any interaction (the field keeps its value but drops out of the tab order); is-readonly to show a value the user can still focus, select, and copy but not edit; and is-required to add native required validation.

Emirates ID number Application number Full name *
<aegov-form-field>
  <aegov-label>Emirates ID number</aegov-label>
  <aegov-input is-disabled="true" value="784-1990-1234567-1"></aegov-input>
</aegov-form-field>
<aegov-form-field>
  <aegov-label>Application number</aegov-label>
  <aegov-input is-readonly="true" value="APP-2026-008421"></aegov-input>
</aegov-form-field>
<aegov-form-field>
  <aegov-label>Full name *</aegov-label>
  <aegov-input is-required="true" placeholder="Required field"></aegov-input>
</aegov-form-field>

Invalid state

Set is-invalid="true" together with error-message (or an error slot placed inside aegov-input) to show a validation error. The error border and message appear while an error is shown; any hint stays visible below the message, since the hint (format, length, where to find the value) is most needed exactly then.

Email address
<aegov-form-field><aegov-label>Email address</aegov-label><aegov-input type="email" value="not-an-email" is-invalid="true" error-message="Enter a valid email in the format name@example.gov.ae."></aegov-input></aegov-form-field>

Icons

Use the icon-start slot for a leading icon (search, mail, lock) and icon-end for a trailing icon. Omit width/height on the SVG so the component can size it to match the field's size token.

Search services Email address
<aegov-form-field>
  <aegov-label>Search services</aegov-label>
  <aegov-input>
    <svg slot="icon-start" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">
      <circle cx="11" cy="11" r="8"></circle>
      <path d="M21 21l-4.35-4.35"></path>
    </svg>
  </aegov-input>
</aegov-form-field>
<aegov-form-field>
  <aegov-label>Email address</aegov-label>
  <aegov-input type="email" placeholder="you@example.gov.ae">
    <svg slot="icon-start" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">
      <rect x="3" y="5" width="18" height="14" rx="2"></rect>
      <path d="m3 7 9 6 9-6"></path>
    </svg>
  </aegov-input>
</aegov-form-field>

Password reveal

Set is-revealable="true" together with type="password" to add a show/hide toggle. Useful on sign-in and password-creation screens where users frequently mistype.

Password
<aegov-form-field><aegov-label>Password</aegov-label><aegov-input type="password" is-revealable="true"></aegov-input></aegov-form-field>

Copy to clipboard

Set is-copyable="true" together with is-readonly="true" to add a button that copies the current value. It briefly switches to a check mark for feedback. Use this for application reference numbers or generated tokens.

Application number
<aegov-form-field><aegov-label>Application number</aegov-label><aegov-input is-readonly="true" is-copyable="true" value="APP-2026-008421"></aegov-input></aegov-form-field>

Input group with add-ons

aegov-input-group wraps an aegov-input (and optionally an aegov-button) to add a static prefix and/or suffix, or a trailing action button. It propagates its size to every child so everything lines up, and its variant cascades to a child that hasn't set its own. The prefix and suffix text is added to the input's description, so a screen reader announces it with the field. Inside a group, the child input's hint or error is shown below the whole group, and while the input is invalid the group shows the error in place of the hint.

Amount Service web address Search services Search
<aegov-form-field>
  <aegov-label>Amount</aegov-label>
  <aegov-input-group addon-prefix="AED">
    <aegov-input type="number" placeholder="0.00"></aegov-input>
  </aegov-input-group>
</aegov-form-field>
<aegov-form-field>
  <aegov-label>Service web address</aegov-label>
  <aegov-input-group addon-suffix=".gov.ae">
    <aegov-input placeholder="myservice"></aegov-input>
  </aegov-input-group>
</aegov-form-field>
<aegov-form-field>
  <aegov-label>Search services</aegov-label>
  <aegov-input-group size="lg">
    <aegov-input type="search"></aegov-input>
    <aegov-button variant="primary">Search</aegov-button>
  </aegov-input-group>
</aegov-form-field>

Composing with Form Field

Pair aegov-input with aegov-label and aegov-form-field for a fully accessible field. Place hint/error content directly inside aegov-input itself — either the plain-text hint/error-message props, or the hint/error slots — so it's genuinely linked via aria-describedby, not just visually placed nearby.

Emirates ID number *
<aegov-form-field>
  <aegov-label>Emirates ID number *</aegov-label>
  <aegov-input is-required="true" placeholder="784-YYYY-NNNNNNN-N" hint="15 digits, found on the front of your Emirates ID card."></aegov-input>
</aegov-form-field>

RTL support

Layout, icon slots, and the reveal/copy buttons all use CSS logical properties, so they swap sides automatically under dir="rtl". aegov-input-group add-ons flip too — a prefix ends up on the right, a suffix on the left.

رقم الهوية الإماراتية * رقم الهاتف المتحرك
<div dir="rtl">
  <aegov-form-field>
    <aegov-label>رقم الهوية الإماراتية *</aegov-label>
    <aegov-input placeholder="784-YYYY-NNNNNNN-N" is-required="true" hint="خمسة عشر رقماً موجودة على الجهة الأمامية من بطاقة الهوية."></aegov-input>
  </aegov-form-field>
  <aegov-form-field>
    <aegov-label>رقم الهاتف المتحرك</aegov-label>
    <aegov-input-group addon-prefix="+971">
      <aegov-input type="tel" placeholder="50 000 0000"></aegov-input>
    </aegov-input-group>
  </aegov-form-field>
</div>

Usage

Here is the recommended usage of an input on any website or application. These are recommended usage guides, however the developer must use the best practices of web and application development to accurately use this component.

Match type to the data being collected
email, tel, and number trigger the right on-screen keyboard on mobile and add free built-in validation — a plain text field gets neither.

Pair with aegov-label inside aegov-form-field
Gives the field a real, persistent accessible name instead of relying on placeholder text, which disappears the moment a value is typed.

Place hint/error content inside aegov-input itself
A hint/error slot only gets picked up when it's a direct child of aegov-input — put it there (or use the plain-text hint/error-message props) so it's genuinely wired into aria-describedby, not just visually nearby.

Reserve is-revealable/is-copyable for their one real purpose
is-revealable only ever matters on a real type="password" field; is-copyable only takes effect once is-readonly="true" is also set — reaching for either outside that pairing renders nothing extra.

Don't use type="password" for anything a user needs to compare or read aloud
One-time codes and confirmation PINs are usually typed once and checked visually — a plain text (or otp-style) field with inputmode="numeric" reads better than a masked password field with a reveal toggle bolted on.

Don't rely on placeholder as a substitute label
It vanishes as soon as the user starts typing, so anyone who returns to the field later — or a screen reader announcing it fresh — has nothing to go on. Use it only for a format example, alongside a real label.

API reference

The following are the properties and references of an input

aegov-input properties

AttributeDescriptionTypeDefault

field-id

DOM id for the native <input>. Auto-generated (aegov-input-{n}) if omitted.

string

auto-generated

type

Native input type — determines on-screen keyboard, autofill hints, and built-in validation.

text | email | password | tel | url | number | search | date | time | datetime-local | month | week

text

size

Field size token. Accepts a responsive breakpoint string (e.g. "sm md:base xl:lg").

xs | sm | base | lg | xl

base

variant

Colour family for the idle border and value text. The focus ring follows the variant's support colour (camel for primary, desert for secondary, seablue for neutral-max/neutral-min); the error border stays red regardless of variant.

primary | secondary | neutral-max | neutral-min

primary

value

Current value. Mutable — kept in sync internally on every input/change.

string

""

placeholder

Placeholder text shown when the field is empty.

string

none

name

Native name, read by ElementInternals during form submission.

string

none

is-disabled

Disables the input and removes it from the tab order.

boolean

false

is-readonly

Displays a value the user cannot edit, but can still focus, select, and (with is-copyable) copy.

boolean

false

is-required

Sets the native required attribute, exposing the requirement to assistive tech and native form validation.

boolean

false

is-revealable

Shows a show/hide toggle button. Only takes effect when type="password".

boolean

false

is-copyable

Shows a copy-to-clipboard button. Only takes effect when is-readonly="true".

boolean

false

is-invalid

Puts the field into error state — sets aria-invalid="true" on the native input and shows the error region above the hint. The hint stays visible, and both are linked through aria-describedby.

boolean

false

error-message

Inline error text shown when is-invalid is true. Use the error slot for richer markup instead.

string

""

hint

Helper text shown below the field. It stays visible while an error shows (below the error message), and both describe the field. Use the hint slot for richer markup instead.

string

""

extra-class

Additional CSS classes applied to the native <input>.

string

none

This component renders inside a real shadow DOM, so extra-class only applies margin/padding (spacing) utilities — e.g. mt-4, md:px-6. Colour, border, typography, and every other visual utility are silently ignored: this is an isolated component whose internal styles can't be overridden, keeping it visually consistent wherever it's used.

aegov-input-group properties

AttributeDescriptionTypeDefault

size

Group size, propagated to every child aegov-input/aegov-button.

xs | sm | base | lg | xl

base

variant

Colour family, cascaded to a child that hasn't set its own.

primary | secondary | neutral-max | neutral-min

primary

group-label

Accessible label for the group wrapper (sets aria-label).

string

none

addon-prefix

Static text shown before the input (logical start — flips under RTL).

string

none

addon-suffix

Static text shown after the input (logical end — flips under RTL).

string

none

extra-class

Additional CSS classes applied to the group wrapper.

string

none

Slots

ComponentSlotDescription

aegov-input

(default)

Not used directly — content belongs in the named slots below.

aegov-input

icon-start

Icon shown before the value (logical start).

aegov-input

icon-end

Icon shown after the value. Hidden automatically while a reveal/copy button is active.

aegov-input

hint

Rich hint markup, in place of the plain-text hint prop. Must be placed inside aegov-input itself to be picked up.

aegov-input

error

Rich error markup, in place of the plain-text error-message prop. Must be placed inside aegov-input itself to be picked up.

aegov-input-group

(default)

Place one aegov-input (and optionally one aegov-button) here.

Events

EventDetailDescription

aegovInputValue

{ value: string; event: Event }

Fires on every keystroke.

aegovInputChange

{ value: string; event: Event }

Fires when the value commits (native change — typically blur or Enter).

aegovInputFocus

FocusEvent

Fires when the input gains focus.

aegovInputBlur

FocusEvent

Fires when the input loses focus.

aegovValidate

AegovValidationDetail<string>

Fires on input/change/blur/manual validate() calls, carrying the full validity snapshot.

Pass-through attributes

AttributeNotesForwards to

aria-*, data-*

Forwarded to the native input, except aria-invalid (owned by is-invalid). Your aria-describedby is kept and combined with the error and hint ids; aria-label/aria-labelledby on the host become the inner input's accessible name.

inner <input>

pattern, min, max, minlength, maxlength, step

Standard validation-related attributes.

inner <input>

autocomplete, autofocus, inputmode, enterkeyhint

Browser/keyboard hints.

inner <input>

list, multiple, accept, capture, spellcheck, title, tabindex, form

Remaining standard input attributes. list cannot reach a <datalist> in the page, since IDs do not cross the shadow root. form associates the host itself with a <form id> elsewhere in the page.

inner <input>

id

Not forwarded — use field-id to control the input's real id.

n/a

class, style

Applied to the host element — stays host-only, never forwarded inward.

host

Notes

The following notes are applicable of this component.

Built-in accessibility

  • aegov-input renders a real native <input>, preserving native semantics, keyboard handling, autofill, and assistive-technology behaviour.
  • The label reaches the native <input> inside the shadow DOM. ID references can't cross that boundary on their own, so the component resolves each naming source to text and gives it to the inner input: aegov-label inside aegov-form-field, an aegov-label for="…" pointing at the host's id or field-id, a native <label for="…"> pointing at the host's id, and aria-label / aria-labelledby set on the host.
  • An aria-describedby you set on the host is handled the same way: the referenced text becomes part of the input's description, read before the component's own error and hint.
  • is-required sets the native required attribute, exposing the requirement to assistive tech automatically.
  • The reveal and copy buttons each carry a descriptive, bilingual aria-label ("Show password"/"Hide password", "Copy to clipboard") and sit in the natural tab order. The copy button keeps its name after a copy; a visually hidden role="status" region announces "Copied" instead.
  • Decorative SVG icons inside the reveal/copy buttons are aria-hidden="true".
  • hint/error-message (or the hint/error slots), when set directly on aegov-input, are wired to the native input's aria-describedby automatically (the hint stays visible and described while an error shows), and the error region only takes role="alert" after the user has blurred the field once, the form has reported it invalid (on submit or checkValidity()), or validate('submit') has run — so a validation message present at initial load isn't announced as an interruption.
  • aegov-input-group renders role="group" and forwards consumer aria-* attributes to it, except aria-label; use group-label for the accessible name, or add your own aria-labelledby to reference an external heading.

Developer responsibilities

  • Always provide a visible label — aegov-label inside aegov-form-field is the preferred pattern. For an unlabelled input (e.g. an icon-only search field), set aria-label on the host yourself.
  • Place hint/error content as a direct child of aegov-input itself (or use the plain-text hint/error-message props) — content placed elsewhere, such as a plain paragraph beside aegov-input inside aegov-form-field, is not linked to the field. (An element in aegov-form-field's own hint slot is the exception: the wrapper links it to the input for you.)
  • Choose the right type for the data being collected — it drives on-screen keyboards, autofill, and built-in validation.
  • Set autocomplete on fields that collect the user's own details — for example autocomplete="name", "email", "tel", "street-address", "postal-code" — so the browser can fill them in and users don't have to retype them (WCAG 1.3.5 Identify Input Purpose). The attribute is passed through to the native input.
  • For password reveal, remember the toggle only changes what's visible locally — it doesn't warn anyone else who might be looking at the screen.
  • For copyable fields, make sure the value is safe to sit in the user's clipboard history.
  • Handle form submission yourself. When the browser blocks a submit (for example a required field is empty), it only shows its own temporary bubble, in the browser's language: the field gets no error text on the page and no aria-invalid. Use the whole-form validation pattern: on submit, call validate('submit') on each field and set is-invalid and error-message from the result, so every error is shown, announced and stays on screen.

Keyboard support

Key Function
Tab Move focus into the input, then to the reveal/copy button (if shown), then to the next field.
Shift + Tab Move focus to the previous focusable element.
Enter Commit the value (fires aegovInputChange) and submits the surrounding form.
Standard text editing All native shortcuts apply — selection, cursor movement, cut/copy/paste.