Skip to main content
io.input.url() requests a web address and returns it as a URL. Provided by the @awaitio/input-url package.
A Website field filled with https://example.com/pricing, with help text under it

Install

Setup

Register it under the key you want in io, see Input components:
app.ts

Usage

Props

Optional

The field is required. Chain .optional() to let it stay empty; the handler then gets URL | undefined, see Optional fields.

Returns

A URL: read hostname, pathname or searchParams from it, or href for the text.

Built-in validation

The browser checks the format before sending, and the server checks every answer again:

Custom validation

Chain .validate() for a check of your own. It runs on the server after the checks above, gets the value the handler would get and returns a message to show under the field, or nothing when the value is fine; see Custom validation.