Skip to main content

Input types

Each Input has a type, which decides the field people fill in and what useInputs gives your code. Any Input left blank comes as undefined.

The Inputs dialog with an Input's Type list open, listing every typeThe Inputs dialog with an Input's Type list open, listing every type
TypePeople fill inYour code gets
StringA line of textstring
SensitiveText that's hidden as it's typedstring
NumberA numbernumber
SelectOne choice from your list of optionsstring
Multi-SelectAny number of choices from your liststring[]
DateA date, from a date pickerDate
Time ZoneA time zone, from a liststring, such as "Europe/London"
AddressAn address, with suggestionsstring
IconAn icon, from an icon pickerstring: pass it through inputIconName
ArrayA list of values of another typeAn array of that type's values

String​

Free text, such as a city name, a stock symbol or a search term.

Sensitive​

Text that's hidden as it's typed, like a password. Use it to ask for something private to the person installing your Widget, such as their own API key or a private calendar link. For a key of your own, use a Private Input instead.

Number​

A number, such as how many headlines to show.

Select​

One choice from a list of options you write, such as a currency or a news source. Write options for people to read, and turn them into codes in your Widget. See Make Select options readable.

Multi-Select​

Any number of choices from your list. Options can't contain commas.

Date​

A date, such as a birthday or the day of an event. It comes as a Date at midnight UTC on that day, so read it with timeZone: "UTC" to get the same day back:

DATE.toLocaleDateString(undefined, {
timeZone: "UTC",
day: "numeric",
month: "long",
});

Time Zone​

A time zone, as its IANA name, such as "Europe/London". Pass it as timeZone when you format a time. To use the Frame's own time zone, you don't need an Input: use useTimeZone.

Address​

An address or place, with suggestions as people type. Turn it into coordinates with useGeocode.

Icon​

An icon people pick. Draw it with Icon, passing the value through inputIconName:

import { Icon, inputIconName } from "~lib/icon";
import { useInputs } from "~lib/use-inputs";

export const Widget = () => {
const { ICON } = useInputs();
const name = inputIconName(ICON);

return name ? <Icon name={name} size={64} /> : null;
};

Array​

A list of values, all of one Item Type, such as several stock symbols. The Item Type can be any type except Array and Sensitive. When it's Select or Multi-Select, also set its Item Options.