<kern-ip-input>
IPv4 field for a single address (192.168.1.10), a range (192.168.1.10-192.168.1.50, also 192.168.1.10-50), a CIDR block (192.168.1.0/24) or a subnet mask (255.255.255.0, also /24), form-associated. Typed text is applied on Enter or when leaving the field and normalised; value and the form value are the normalised form. Ranges, blocks and masks show their size in the field.
Examples
Address, range or CIDR
One field accepts a single address, a range (192.168.1.10-50) or a CIDR block. Typed text is applied and normalised on Enter or when leaving the field; ranges and blocks show their size. max-addresses limits the size, locale formats the count.
Single address only
allow="single" accepts only one address (also range, cidr or a space-separated combination); other forms show label-not-allowed. Also shown: required, readonly, disabled and size="sm".
Subnet mask
allow="mask" accepts only contiguous subnet masks; 255.0.255.0 or an address like 192.168.1.1 shows label-invalid-mask. A prefix (/22 or 22) is normalised to the dotted mask, or the other way round with mask-format="prefix". The field shows the prefix and the number of usable hosts (label-mask-count); kernChange reports kind: 'mask', mask, prefix and hosts. With allow="single mask", a valid mask counts as mask and anything else as address.
Properties
allowstring
Allowed forms, space-separated: single, range, cidr, mask. mask accepts only contiguous subnet masks (255.255.252.0) and prefixes (/22, 22); combined with single, a valid mask counts as mask and anything else as address.
ariaLabelTextstring | undefined
Accessible name when there is no visible label.
disabledboolean
errorstring | undefined
hideCountboolean
Hide the number of addresses in the field.
hintstring | undefined
labelstring | undefined
labelCountstring | undefined
Size of a range or block; {n} is replaced by the number.
labelInvalidstring | undefined
Shown for text that is no IPv4 address, range or CIDR block.
labelInvalidMaskstring | undefined
Shown for text that is no subnet mask when only mask is allowed.
labelMaskCountstring | undefined
Size of a mask; {prefix} is replaced by the prefix length, {n} by the number of hosts.
labelNotAllowedstring | undefined
Shown for a form excluded by allow.
labelTooManystring | undefined
Shown above max-addresses; {n} is replaced by it.
localestring | undefined
BCP 47 locale for the number of addresses; defaults to <html lang>, then the browser language.
maskFormat"dotted" | "prefix"
How a mask is normalised: dotted (255.255.255.0) or prefix (/24).
maxAddressesnumber | undefined
Largest allowed number of addresses.
namestring | undefined
noImplicitSubmitboolean
Enter does not submit the surrounding form.
placeholderstring | undefined
Defaults to an example of the first allowed form.
readonlyboolean
requiredboolean
size"md" | "sm"
valuestring
Normalised address, range, CIDR block or mask; empty when none.
Events
kernChangeCustomEvent<{ value: string; kind?: KernIpKind | "mask" | undefined; first?: string | undefined; last?: string | undefined; count?: number | undefined; mask?: string | undefined; prefix?: number | undefined; hosts?: number | undefined; }>
When typed text is applied: the normalised value and what it covers (empty value when cleared).
kernInputCustomEvent<{ value: string; }>
On every keystroke, with the raw text.
Methods
setFocus()setFocus() => Promise<void>
Focuses the native input.
CSS parts
control